arXiv:2509.09754cs.LGcs.AI2025-09EMNLP被引 14

LAVa动态分配缓存预算,提升长文本生成与抽取任务性能

LAVa: Layer-wise KV Cache Eviction with Dynamic Budget Allocation

  • 按层和注意力头动态分配缓存预算,减少信息损失
  • 在多个基准上优于现有方法,生成与抽取任务均表现最佳
  • 无需训练,适用于代码生成、问答等不同任务场景

KV缓存常用于加速大语言模型的长上下文推理,但其高内存需求推动了缓存压缩的必要性。现有压缩方法多为启发式且缺乏动态预算分配。本文提出统一框架,通过最小化Transformer残差流的信息损失实现缓存压缩。基于此,分析层间注意力输出损失,提出跨头比较的新指标,实现按层压缩与动态头预算分配;同时通过跨层信息对比,实现动态层预算分配。LAVa是首个无需训练或多种策略组合的统一缓存淘汰与动态预算分配策略。在LongBench、Needle-In-A-Haystack、Ruler和InfiniteBench等基准上的实验表明其优越性。此外,实验揭示:生成任务(如代码补全)依赖动态层预算,而抽取任务(如抽取式问答)则关键在于动态头预算。作为完全动态的压缩方法,LAVa在各类任务中保持顶尖性能。代码已开源:https://github.com/MGDDestiny/Lava。

原文摘要 · Abstract (English)

KV Cache is commonly used to accelerate LLM inference with long contexts, yet its high memory demand drives the need for cache compression. Existing compression methods, however, are largely heuristic and lack dynamic budget allocation. To address this limitation, we introduce a unified framework for cache compression by minimizing information loss in Transformer residual streams. Building on it, we analyze the layer attention output loss and derive a new metric to compare cache entries across heads, enabling layer-wise compression with dynamic head budgets. Additionally, by contrasting cross-layer information, we also achieve dynamic layer budgets. LAVa is the first unified strategy for cache eviction and dynamic budget allocation that, unlike prior methods, does not rely on training or the combination of multiple strategies. Experiments with benchmarks (LongBench, Needle-In-A-Haystack, Ruler, and InfiniteBench) demonstrate its superiority. Moreover, our experiments reveal a new insight: dynamic layer budgets are crucial for generation tasks (e.g., code completion), while dynamic head budgets play a key role in extraction tasks (e.g., extractive QA). As a fully dynamic compression method, LAVa consistently maintains top performance across task types. Our code is available at https://github.com/MGDDestiny/Lava.

缓存优化大模型推理动态分配长文本处理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。