驯服LLM推理中KV缓存驱逐的脆弱性
Taming the Fragility of KV Cache Eviction in LLM Inference
AI总结:
针对LLM推理中KV缓存驱逐依赖稳定性假设的脆弱性,提出防御性聚合策略及DefensiveKV方法,通过控制最坏情况风险,在20%缓存下将质量损失降低2.3-4.3倍。
摘要:
大型语言模型已经彻底改变了自然语言处理,但其部署仍然受到Transformer键值缓存大量内存和运行时开销的阻碍。为了缓解这一问题,近期方法采用评分-聚合框架来驱逐不重要的缓存条目,其基础是稳定性假设——即固定子集的条目在生成过程中始终保持重要。然而,先前的工作主要集中于改进评分的显著性指标,而由于对稳定性假设的忠实信任,默认使用均值聚合。在本工作中,我们认为这一基本假设本质上是脆弱的,使得均值聚合在极端情况下极易受到攻击。为应对此问题,我们提出了一种简单而优雅的防御性聚合策略:一种两步、线性时间的方法,控制最坏情况风险,从而以可忽略的计算开销防御极端情况。体现这一策略,我们提出了一种新颖的缓存驱逐方法DefensiveKV及其扩展Layer-DefensiveKV,后者引入了逐层预算分配。在七个任务领域(18个数据集)中,在20%缓存大小下,我们的方法相比最强基线分别将生成质量损失降低了2.3倍和4.3倍。这些结果树立了新的性能基准,并开创了通过最坏情况风险管理优化缓存驱逐以应对潜在脆弱性的有前景方向。我们的代码可在https://github.com/FFY0/DefensiveKV获取。
英文摘要:
Large language models have revolutionized natural language processing, yet their deployment remains hampered by the substantial memory and runtime overhead of the transformer's Key-Value cache. To mitigate this, recent methods employ a scoring-aggregation framework to evict unimportant cache entries, based on the stability assumption-that a fixed subset of entries remains consistently important during generation. However, prior work has largely focused on refining importance indicators for scoring, while defaulting to mean aggregation due to a faithful trust in the stability assumption. In this work, we argue that this underlying assumption is inherently fragile, making mean aggregation highly vulnerable in extreme cases. To counter this, we propose a simple yet elegant defensive aggregation strategy: a two-step, linear-time approach that controls worst-case risk, thereby defending against extreme cases with negligible computational overhead. Embodying this strategy, we propose a novel cache eviction method, DefensiveKV and its extension, Layer-DefensiveKV, which incorporates layer-wise budget allocation. Across seven task domains (18 datasets), our methods reduce generation quality loss by 2.3x and 4.3x respectively, versus the strongest baseline under a 20% cache size. These results set new performance benchmarks and pioneer a promising direction for optimizing cache eviction against underlying fragility through worst-case risk management. Our code is available at https://github.com/FFY0/DefensiveKV.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。