arXiv:2504.14051cs.LGcs.CL2025-04被引 7

用注意力输出误差优化大模型缓存淘汰,提升长文本处理效率

CAOTE: KV Cache Selection for LLMs via Attention Output Error-Based Token Eviction

  • 基于注意力输出误差设计缓存淘汰准则,融合注意力分数与值向量
  • 相比传统方法,在多个任务上准确率均提升,尤其在长文本场景
  • 可兼容现有淘汰策略,适合资源受限设备上的大模型部署

大型语言模型虽支持长上下文以拓展能力,但带来内存与计算压力,成为资源受限设备的关键瓶颈。令牌淘汰作为常见后训练缓解手段,通常以注意力分数为重要性代理指标。然而,注意力分数缺乏对令牌贡献于注意力输出的信息。本文提出一种基于注意力输出误差的淘汰准则——CAOTE,通过无缝整合注意力分数与值向量,优化因淘汰导致的误差。这是首个在闭式形式中利用值向量的淘汰方法。此外,CAOTE可作为元启发式方法,灵活适配任意淘汰策略。实验表明,当与当前最优注意力分数基方法结合时,始终提升下游任务准确率,证明了在淘汰过程中利用值信息的重要性。

原文摘要 · Abstract (English)

While long context support of large language models has extended their abilities, it also incurs challenges in memory and compute which becomes crucial bottlenecks in resource-restricted devices. Token eviction, a widely adopted post-training methodology designed to alleviate the bottlenecks by evicting less important tokens from the cache, typically uses attention scores as proxy metrics for token importance. However, one major limitation of attention score as a token-wise importance metrics is that it lacks the information about contribution of tokens to the attention output. In this paper, we propose a simple eviction criterion based on the contribution of cached tokens to attention outputs. Our method, CAOTE, optimizes for eviction error due to token eviction, by seamlessly integrating attention scores and value vectors. This is the first method which uses value tokens on top of attention-based eviction scores in closed-form. Additionally, CAOTE can act as a meta-heuristic method with flexible usage with any token eviction method. We show that CAOTE, when combined with the state-of-the-art attention score-based methods, always improves accuracies on the downstream task, indicating the importance of leveraging information from values during token eviction process.

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

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