TL;DR
Compressing a Transformer’s working memory—its KV cache—without knowing what questions the model will ask next is fundamentally no better than rolling dice and keeping random tokens. By framing KV cache compression as a geometric "center-of-mass" balancing problem, the authors prove exact mathematical limits on compression accuracy and turn those limits into an efficient algorithm that shrinks memory during both prompt reading and text generation.
What Problem Does This Paper Address?
Imagine reading a thousand-page novel, except before reading every single new word, you have to re-read every word that came before it. That is essentially what a Transformer does during long-context inference. Its working memory of past tokens—the key–value (KV) cache—balloons as sequences grow, creating a massive bottleneck in memory and speed.
Practitioners usually tackle this by evicting "unimportant" tokens using clever rules of thumb, like keeping recent words or tokens that got lots of attention earlier. Meanwhile, theorists have mostly proven bleak worst-case results: if attention is sharp enough to pluck a single needle from a haystack, lossless compression is impossible.
What has been missing is a middle ground: a precise theory explaining what makes a specific cache compressible in practice, how close we can get to optimal accuracy, and how to design principled algorithms when compression actually is possible.
Methods
Instead of viewing the KV cache as a static list of tokens to keep or toss, the authors recast it as a discrete probability distribution over key–value pairs. This generalizes standard token eviction: rather than just deleting tokens, you are allowed to keep $K$ tokens and reweight them so they stand in for the missing ones.
To measure how tossing and reweighting tokens distorts softmax attention, each token is mapped to a response profile in a Hilbert space—a mathematical vector capturing how that token nudges both the numerator and denominator of the softmax fraction across future queries.
As illustrated above, the attention error caused by compression turns out to be governed by how far the barycenter (center of mass) of these response profiles shifts. KV compression thus becomes a sparse balancing game: pick $K$ tokens and assign them weights so the center of mass barely moves.
To make this practical for autoregressive models with causal masking, the authors introduce two streaming algorithms based on a local REDUCE subroutine (which shrinks $2K$ tokens down to $K$):
- Parallel prefix scan (Prefill): Uses a tree-like Blelloch scan over token chunks so even the initial prompt reading only ever attends to compressed summaries plus the local chunk.
- Streaming merge-reduce (Decoding): Maintains logarithmic buckets of past summaries online as new tokens arrive.
Because future queries aren't known in advance, the REDUCE step lets practitioners plug in a finite-dimensional feature map $\Phi$—a heuristic guess at what token features will matter later—and uses balanced clustering to preserve those features while randomly sampling the rest.
Datasets
The authors evaluate their algorithms (using the Qwen3-32B model) on the "long" subset of LongBench-v2, an existing multiple-choice benchmark featuring contexts ranging from 128,000 to 2 million words. No new datasets are introduced.
Key Insights and Ideas
- Blind compression can't beat random sampling: Once an attention head is expressive enough to sharply retrieve individual tokens, no query-agnostic algorithm can uniformly beat the error rate of simple Monte Carlo random sampling—no matter how redundant the cache looks on its own. Redundancy only exists relative to future queries.
- Query awareness unlocks spectral decay: Looking at the covariance of token response profiles ($\Sigma_{P,\nu}$), a query-agnostic method pays an error proportional to the full trace (total variance across all directions). A query-aware method can lock down the dominant directions and only pay for the spectral tail—the leftover variance outside the top eigenspace.
- Safe bets with upside: By designing local reducers that are unbiased in expectation, you can guarantee the worst-case safety net of random sampling unconditionally, while smoothly approaching oracle-level accuracy to the exact extent your chosen feature map $\Phi$ aligns with future queries.
Key Results
Testing on LongBench-v2 at roughly a 95% compression rate (shrinking the KV budget from 130,944 tokens down to 6,152 per head):
- Matching uncompressed accuracy: Their balanced clustering reducer ($d = 128$ features) achieved 37.04% ($\pm 4.65$) accuracy—matching the full, uncompressed KV cache baseline (37.04%) down to the decimal.
- Outperforming while doing more with less: Literature baselines—ScissorHands (35.19%), SnapKV (34.26%), and StreamingLLM (32.41%) —all required the full 130,944-token cache during prefill and only compressed during decoding. The authors' methods compressed both prefill and decoding to 6,152 tokens while matching or beating them.
- Random sampling is shockingly strong: Consistent with their minimax theory, plain random sampling scored 34.26%, tying SnapKV and beating StreamingLLM despite using 95% fewer tokens during prefill.
- Efficiency: Prefill runs in $\mathcal{O}(\log(n/K))$ parallel depth, while decoding uses $\mathcal{O}(K \log(t/K))$ memory and $\mathcal{O}(\log(t/K)/K)$ amortized
REDUCEcalls per token.
Limitations and Future Work
The authors candidly note that in their empirical evaluation, the standard errors (~4.6%) overlap across all tested methods—including simple random sampling and full KV attention—meaning larger-scale empirical validation is warranted to separate the methods definitively. Additionally, the theoretical analysis models a single attention head in isolation rather than multi-layer error propagation, and achieving improvements over random sampling in practice still relies on choosing or learning a good proxy feature map $\Phi$ for future queries.
Summary updated