arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2509.09754cs.LGcs.AI
收藏

LAVa:基于动态预算分配的逐层 KV Cache 驱逐

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

State Key Laboratory for Novel Software Technology, Nanjing University(新型软件技术国家重点实验室,南京大学);School of Artificial Intelligence, Nanjing University(人工智能学院,南京大学);Stepfun

Yiqun Shen, Song Yuan, Zhengze Zhang, Xiaoliang Wang, Daxin Jiang, Nguyen Cam-Tu

AI总结:

本文提出 LAVa,一种无需训练的统一缓存压缩框架,通过最小化信息损失实现逐层 KV Cache 驱逐与动态头/层预算分配,在多基准测试中表现优越并揭示了不同预算对各类任务的影响。

摘要:

KV Cache 通常用于加速长上下文下的 LLM 推理,但其高内存需求促使了对缓存压缩的需求。然而,现有的压缩方法大多是启发式的,且缺乏动态预算分配。为了解决这一局限性,我们通过最小化 Transformer 残差流中的信息损失,引入了一个统一的缓存压缩框架。在此基础上,我们分析了层注意力输出损失,并推导出一个新指标来比较不同头之间的缓存条目,从而实现了具有动态头预算的逐层压缩。此外,通过对比跨层信息,我们还实现了动态层预算。LAVa 是首个用于缓存驱逐和动态预算分配的统一策略,与以往方法不同,它不依赖于训练或多种策略的组合。在基准测试(LongBench、Needle-In-A-Haystack、Ruler 和 InfiniteBench)上的实验证明了其优越性。此外,我们的实验揭示了一个新见解:动态层预算对于生成任务(例如代码补全)至关重要,而动态头预算在抽取任务(例如抽取式问答)中起关键作用。作为一种完全动态的压缩方法,LAVa 在各种任务类型中始终保持着顶尖性能。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑