arXiv:2509.10798cs.CLcs.AI2025-09AAAI被引 3

用可训练的软标记提升键值缓存淘汰时的全局信息保留能力。

Judge Q: Trainable Queries for Optimized Information Retention in KV Cache Eviction

  • 通过可训练的软标记生成更优查询,捕捉全局信息。
  • 在相同淘汰预算下,LongBench提升约1分,RULER提升超3分。
  • 仅微调嵌入层,适配现有开源模型且开销极低。

大语言模型在序列处理中使用键值(KV)缓存存储历史信息,其大小随序列长度线性增长,严重占用内存并降低解码效率。现有缓存淘汰方法通常采用预填充阶段最后窗口作为查询计算重要性得分,但易过度关注局部信息,可能忽略关键全局信息。为此,我们提出Judge Q,一种新颖的可训练方法,引入软标记列表。该方法仅以低训练成本微调模型嵌入层,将软标记列表拼接至输入序列末尾,训练这些标记的注意力图与真实解码标记保持一致。由此生成的查询能有效捕获全局信息,更准确评估缓存中键值的重要性,从而在淘汰时维持解码质量。在Llama-3.1-8B-Instruct和Mistral-7B-Instruct-v0.3等模型上,基于LongBench、RULER和Needle-in-a-Haystack的实验表明,相同淘汰预算下性能下降更小:LongBench提升约1分,RULER提升超3分。该方法可无缝集成至现有开源模型,训练开销极低,显著提升缓存淘汰场景下的表现。

原文摘要 · Abstract (English)

Large language models (LLMs) utilize key-value (KV) cache to store historical information during sequence processing. The size of KV cache grows linearly as the length of the sequence extends, which seriously affects memory usage and decoding efficiency. Current methods for KV cache eviction typically utilize the last window from the pre-filling phase as queries to compute the KV importance scores for eviction. Although this scheme is simple to implement, it tends to overly focus on local information, potentially leading to the neglect or omission of crucial global information. To mitigate this issue, we propose Judge Q, a novel training method which incorporates a soft token list. This method only tunes the model's embedding layer at a low training cost. By concatenating the soft token list at the end of the input sequence, we train these tokens' attention map to the original input sequence to align with that of the actual decoded tokens. In this way, the queries corresponding to the soft tokens can effectively capture global information and better evaluate the importance of the keys and values within the KV cache, thus maintaining decoding quality when KV cache is evicted. Under the same eviction budget, our method exhibits less performance degradation compared to existing eviction approaches. We validate our approach through experiments conducted on models such as Llama-3.1-8B-Instruct and Mistral-7B-Instruct-v0.3, using benchmarks including LongBench, RULER, and Needle-in-a-Haystack. Results indicate an improvement of approximately 1 point on the LongBench and over 3 points on RULER. This proposed methodology can be seamlessly integrated into existing open-source models with minimal training overhead, thereby enhancing performance in KV cache eviction scenarios.

KV缓存大模型优化注意力机制

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