Skip to main content
QUICK REVIEW

[论文解读] Fast KV Compaction via Attention Matching

Zweiger, Adam, Xinghong Fu|arXiv (Cornell University)|Feb 18, 2026
Natural Language Processing TechniquesComputer Science被引用 0
一句话总结

论文提出 Attention Matching,一种快速的一次性 KV-cache 压缩方法,构建紧凑的键、偏置和值以再现注意力输出和质量,实现高达 50x 的压缩,质量损失极小。

ABSTRACT

Scaling language models to long contexts is often bottlenecked by the size of the key-value (KV) cache. In deployed settings, long contexts are typically managed through compaction in token space via summarization. However, summarization can be highly lossy, substantially harming downstream performance. Recent work on Cartridges has shown that it is possible to train highly compact KV caches in latent space that closely match full-context performance, but at the cost of slow and expensive end-to-end optimization. This work describes an approach for fast context compaction in latent space through Attention Matching, which constructs compact keys and values to reproduce attention outputs and preserve attention mass at a per-KV-head level. We show that this formulation naturally decomposes into simple subproblems, some of which admit efficient closed-form solutions. Within this framework, we develop a family of methods that significantly push the Pareto frontier of compaction time versus quality, achieving up to 50x compaction in seconds on some datasets with little quality loss.

研究动机与目标

  • 在长上下文变换器中减小 KV 缓存大小,而不产生显著性能损失。
  • 为上下文压缩提供一种快速的替代梯度基础的潜在缓存训练的方法。
  • 在将紧凑前缀与新令牌或固定令牌拼接时,保持兼容性。

提出的方法

  • 将 KV 压缩表述为通过紧凑缓存 (C_k, C_v) 和每个令牌偏置 (β) 对注意力输出和注意力质量进行匹配。
  • 将问题分解为子问题,以便对其进行封闭式解,避免在压缩时进行端到端梯度优化。
  • 从重复预填、上下文预填、自我学习或按策略查询构建参考查询 Q_ref,以引导压缩。
  • 在固定 C_k 后,通过非负最小二乘法 (NNLS) 与普通最小二乘法求解 β 与 C_v。
  • 将 C_k 选择为原始键的一个子集,并对该子集的选择方法进行对比(最高注意力键或正交匹配追踪)。
  • 支持非均匀头预算和按块(每块)压缩,以扩展到长上下文。
Figure 1 : Accuracy vs. Compaction Time Trade-off (Qwen3-4B; QuALITY). We compare downstream QA accuracy ( $n=894$ ) after compaction, plotted against the average wall-clock time required to compact a context (seconds, log-scale) using a single H100 GPU at a fixed 50 $\times$ compaction ratio. Our a
Figure 1 : Accuracy vs. Compaction Time Trade-off (Qwen3-4B; QuALITY). We compare downstream QA accuracy ( $n=894$ ) after compaction, plotted against the average wall-clock time required to compact a context (seconds, log-scale) using a single H100 GPU at a fixed 50 $\times$ compaction ratio. Our a

实验结果

研究问题

  • RQ1注意力匹配是否能在使用更小的潜在缓存时再现完整 KV 缓存的注意力输出和注意力质量?
  • RQ2设计选择(参考查询采样、键选择策略和偏置)如何影响 KV 压缩中的速度-准确度权衡?
  • RQ3非均匀的逐头压缩是否有益,且是否可以对每个模型预计算?
  • RQ4分块压缩对长上下文任务和混合注意力模型的性能有何影响?

主要发现

  • 注意力匹配方法描绘出速度-质量的帕累托前沿,在多种情形下优于基于令牌选择的基线,并在许多情形中超过 Cartridges,同时速度级别量级更快。
  • AM-OMP 与 AM-HighestAttnKeys 变体在长上下文问答基准上实现了高达 50x 的压缩且质量损失很小。
  • 通过头部敏感性曲线学习得到的非均匀头预算显著改善性能,并且可以对每个模型预计算。
  • 利用自我学习、重复预填和按策略查询有助于让压缩与模型行为对齐,从而提高下游准确性。
  • AM 方法在滑动窗口模型上仍然有效,在压缩全局注意力层时仅需稍微保守的压缩比。
Figure 2 : Head sensitivity curves in Qwen3-4B. We fix all KV heads to a baseline compaction ratio of $0.05\times$ and vary the compaction ratio of a single head. We report the change in loss relative to the baseline (lower is better) as a function of the varied head’s compaction ratio. Curves are a
Figure 2 : Head sensitivity curves in Qwen3-4B. We fix all KV heads to a baseline compaction ratio of $0.05\times$ and vary the compaction ratio of a single head. We report the change in loss relative to the baseline (lower is better) as a function of the varied head’s compaction ratio. Curves are a

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。