Skip to main content
QUICK REVIEW

[Paper Review] Fast KV Compaction via Attention Matching

Zweiger, Adam, Xinghong Fu|arXiv (Cornell University)|Feb 18, 2026
Natural Language Processing TechniquesComputer Science0 citations
TL;DR

The paper presents Attention Matching, a fast one-shot KV-cache compaction method that constructs compact keys, biases, and values to reproduce attention outputs and mass, enabling up to 50x compaction with minimal quality loss.

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.

Motivation & Objective

  • Reduce KV cache size for long-context transformers without significant performance loss.
  • Offer a fast alternative to gradient-based latent-cache training for context compaction.
  • Preserve compatibility when concatenating compacted prefixes with new or fixed tokens.

Proposed method

  • Formulate KV compaction as matching attention outputs and attention mass per KV head using a compact cache (C_k, C_v) and per-token biases (β).
  • Decompose the problem to enable closed-form solutions for subproblems, avoiding end-to-end gradient optimization at compaction time.
  • Construct reference queries Q_ref from repeat-prefill, context-prefill, self-study, or on-policy queries to guide compaction.
  • Solve for β and C_v with nonnegative least squares (NNLS) and ordinary least squares after fixing C_k.
  • Choose C_k as a subset of the original keys and contrast methods for selecting this subset (highest-attention keys or orthogonal matching pursuit).
  • Support nonuniform head budgets and chunked (per-chunk) compaction to scale to long contexts.
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

Experimental results

Research questions

  • RQ1Can Attention Matching reproduce the attention outputs and attention mass of the full KV cache using a smaller latent cache?
  • RQ2How do design choices (reference-query sampling, key-selection strategy, and biases) affect speed-accuracy trade-offs in KV compaction?
  • RQ3Is nonuniform per-head compaction beneficial, and can it be precomputed per model?
  • RQ4How does chunked compaction affect performance for long-context tasks and hybrid attention models?

Key findings

  • Attention Matching methods trace the speed–quality Pareto frontier, outperforming token-selection baselines and surpassing Cartridges in many regimes while being orders of magnitude faster.
  • AM-OMP and AM-HighestAttnKeys variants achieve up to 50x compaction with little quality loss on long-context QA benchmarks.
  • Nonuniform head budgets, learned via head-sensitivity curves, significantly improve performance and can be precomputed per model.
  • Using self-study, repeat-prefill, and on-policy queries helps align compaction with model behavior, improving downstream accuracy.
  • AM methods remain effective on sliding-window models, with only modestly more conservative compaction ratios when compacting global attention layers.
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

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.