arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2610.23939cs.LGcs.AI
收藏

PeekKV:首个内容Token已能识别哪些注意力头重要

PeekKV: The First Content Token Already Knows Which Heads Matter

Yonsei University(延世大学)

Minyoung Go, Yongjun Park

AI总结:

针对LLM服务中KV缓存的内存瓶颈,PeekKV通过预填充后单Token窥视获取头组与Token重要性分数分配缓存,在多基准上接近全缓存准确率且适配新模型。

摘要:

KV缓存的大小随上下文长度线性增长,这使其成为大语言模型(LLM)服务中的主要内存瓶颈。受近期识别注意力头功能角色研究进展的启发,越来越多的研究工作在不同注意力头之间非均匀地压缩KV缓存。现有方法要么通过离线分析固定重要的注意力头,要么利用预填充阶段的注意力信号选择重要头。然而,在这两种情况下,不同工作负载之间的准确率都会大幅波动。在研究这种不稳定性的原因时,我们发现,即使在单个输入中,活跃头也会在预填充阶段和解码阶段之间发生变化。相比之下,在解码路径中,一旦过滤掉格式Token,活跃头的组成在不同内容Token之间保持稳定。基于这一观察,我们提出了PeekKV。PeekKV在预填充阶段后立即观察单个内容Token(一次单Token窥视),以联合获取头组分数和Token重要性分数。在这些分数的指导下,PeekKV按头组分数的比例将KV缓存预算分配给各头组,并在每个预算内仅保留得分最高的Token。PeekKV无需离线分析或训练,因此可直接应用于未见过的工作负载和新模型。在四个公共基准测试中,在与最先进方法的每模型比较中,PeekKV在超过一半的比较中实现了最高准确率,并且在RULER和LongBench上最接近全缓存准确率。在Llama-3.1-8B-Instruct模型上,PeekKV在RULER的16K上下文下,以10%的内存预算保留了95.7%的全缓存准确率;在LongBench上,以1.5%的预算保留了95.9%的全缓存准确率。

英文摘要:

The size of the KV cache grows linearly with context length, making it a major memory bottleneck in LLM serving. Motivated by recent progress in identifying the functional roles of attention heads, a growing body of work compresses the KV cache non-uniformly across heads. Existing methods either fix the important heads via offline profiling or select them using attention signals from the prefill stage. In both cases, however, accuracy fluctuates substantially across workloads. While investigating the cause of this instability, we find that the active heads shift between the prefill and decode stages even within a single input. Along the decode path, by contrast, the activehead composition remains stable across content tokens once format tokens are filtered out. Based on this observation, we propose PeekKV. PeekKV observes a single content token immediately after prefill - a one-token peek - to jointly obtain head-group scores and token-importance scores. Guided by these scores, PeekKV allocates KV cache budgets to head groups in proportion to their group scores and retains only the top-scoring tokens within each budget. PeekKV requires no offline profiling or training and thus applies directly to unseen workloads and new models. Across four public benchmarks, PeekKV achieves the highest accuracy in more than half of the per-model comparisons against state-of-the-art methods, and stays closest to the full-cache accuracy on RULER and LongBench. On Llama-3.1-8B-Instruct, PeekKV retains 95.7% of the full-cache accuracy at a 10% memory budget on RULER with 16K contexts and 95.9% at a 1.5% budget on LongBench.

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

↑