Long-context inference is constrained by KV-cache memory, which grows linearly with sequence length; KV-cache compression therefore hinges on reliably selecting which past tokens to retain. Most geometry-based eviction methods score keys by cosine similarity to a global centroid, but cosine is scale-invariant and can discard magnitude cues that distinguish semantically salient tokens. We propose ManifoldKV, a training-free scorer that ranks tokens by Euclidean distance to the key centroid, capturing both angular and radial deviations. On the RULER benchmark, ManifoldKV achieves 95.7% accuracy at 4K-16K contexts with 20% compression; matching the best geometric baseline while improving robustness in two regimes where cosine scoring fails. First, on multi-key retrieval, ManifoldKV reduces directional collisions, achieving 92.4% vs KeyDiff's 77.0% (+15.4 points) on 3-key NIAH at 50% compression. Second, to address dilution and performance collapse of global centroids at 64K context, we introduce WindowedManifoldKV, which restores accuracy to 84.3% at 25% compression, a 49-point recovery over global L2 and +3.2 points over KeyDiff. The method requires only 3 lines of code and works across 4 architectures without tuning.


翻译:长上下文推理受限于KV缓存内存,其随序列长度线性增长;因此,KV缓存压缩的关键在于可靠地选择保留哪些过往令牌。大多数基于几何的淘汰方法通过令牌键向量与全局质心的余弦相似度进行评分,但余弦相似度具有尺度不变性,可能丢弃用于区分语义显著令牌的幅度信息。我们提出ManifoldKV,一种无训练的评分器,通过计算令牌键向量到键质心的欧几里得距离对令牌进行排序,同时捕捉角度和径向偏差。在RULER基准测试中,ManifoldKV在4K-16K上下文长度下,以20%的压缩率实现了95.7%的准确率;在匹配最佳几何基线的同时,在两个余弦评分失效的场景中提升了鲁棒性。首先,在多键检索任务中,ManifoldKV减少了方向碰撞,在50%压缩率下,于3键NIAH任务上取得了92.4%的准确率,而KeyDiff为77.0%(提升15.4个百分点)。其次,针对64K上下文长度下全局质心稀释和性能崩溃的问题,我们引入了WindowedManifoldKV,在25%压缩率下将准确率恢复至84.3%,相较于全局L2方法恢复了49个百分点,并较KeyDiff提升了3.2个百分点。该方法仅需3行代码,且无需调参即可在4种架构上工作。

0
下载
关闭预览

相关内容

【CVPR2025】BIMBA:面向长范围视频问答的选择性扫描压缩
TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
Github 项目推荐 | YOLOv3 的最小化 PyTorch 实现
AI研习社
25+阅读 · 2018年5月31日
如何设计基于深度学习的图像压缩算法
论智
41+阅读 · 2018年4月26日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
【CVPR2025】BIMBA:面向长范围视频问答的选择性扫描压缩
TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员