提出防御性缓存淘汰策略,显著降低大模型推理时的精度损失。
Taming the Fragility of KV Cache Eviction in LLM Inference
- 设计两步线性时间防御聚合,控制最坏情况风险
- 在20%缓存下,生成质量损失减少2.3至4.3倍
- 适合追求高精度低内存推理的部署场景
大语言模型虽已革新自然语言处理,但其部署仍受限于Transformer结构中键值缓存带来的巨大内存与运行开销。为缓解此问题,现有方法基于稳定性假设,采用评分聚合框架淘汰不重要缓存条目,普遍使用均值聚合。然而,本文指出该假设本质脆弱,均值聚合在极端情况下极易失效。为此,提出一种简单而优雅的防御性聚合策略:两步线性时间方法,有效控制最坏情况风险,计算开销可忽略。基于此,提出新缓存淘汰方法DefensiveKV及其扩展Layer-DefensiveKV,支持层间预算分配。在七个任务领域(18个数据集)上,两种方法在20%缓存规模下相较最强基线,生成质量损失分别降低2.3倍和4.3倍,创下新性能基准,开创通过最坏情况风险管控优化缓存淘汰的新方向。代码开源:https://github.com/FFY0/DefensiveKV。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。