TL;DR
When large language models read massive documents, their short-term memory—the Key-Value (KV) cache—balloons until it chokes your GPU. Standard memory-pruning methods decide what to forget based solely on raw attention scores within isolated attention heads, missing the bigger picture of how a model actually computes answers. This paper introduces LaProx, a calibration-free method that treats memory eviction as a global matrix approximation problem, keeping LLMs sharp on long contexts even after throwing away 95% of their memory cache.
What Problem Does This Paper Address?
To generate text without re-reading the entire prompt for every new word, Transformers store intermediate representations of past tokens in a Key-Value (KV) cache. It’s a brilliant speedup, except the cache grows linearly with sequence length. Feed an LLM a 128K-token book, and the KV cache becomes a massive bottleneck for both memory capacity and decoding speed.
To stay within hardware budgets, engineers evict (delete) less important tokens from the cache on the fly. Almost all existing methods assume that attention weights ($A$) tell you everything you need to know: if a token doesn't get "looked at" much by an attention head, toss it. Furthermore, they make these eviction decisions locally, inside each attention head independently.
The authors show that this conventional wisdom has two blind spots:
- Attention is only half the equation: A layer’s actual output isn't just attention $A$; it’s the matrix product of attention, Value states ($V$), and the Output projection matrix ($W_O$), written as $A \times (VW_O)$. A token might attract tiny attention weights while carrying a massive $VW_O$ payload—or vice versa.
- Local rankings waste global budgets: Evicting tokens head-by-head forces dull, uninformative attention heads to keep "local winners" that contribute almost nothing to the final layer output, while starving critical heads of memory.
Methods
Instead of relying on attention heuristics, the authors reformulate KV cache eviction as a matrix multiplication approximation problem. Their goal: pick the subset of cached tokens that best preserves the actual mathematical output of the attention layers.
Their strategy, LaProx (Layer Approximated Cache), works in three steps without requiring any training, fine-tuning, or offline calibration:
- Output-Aware Token Scoring: Drawing on Monte Carlo matrix approximation theory, LaProx scores each token $i$ by multiplying the Euclidean ($\ell_2$) norm of its attention column by the Euclidean norm of its projected value row: $\|A[:, i]\|_2 \cdot \|VW_O[i, :]\|_2$. Because $W_O$ projects every head's output into the same shared layer space, scores across different heads naturally sit on a unified, comparable scale. (Like prior work, a small window of the most recent tokens is automatically protected).
- Layer-Wise Normalization: Because the numerical magnitudes of $V$ and $W_O$ grow substantially in deeper layers (as seen in the figure above), raw scores aren't directly comparable between layers. LaProx divides each token's score by the total score sum of its layer, converting raw magnitudes into relative importance distributions.
- Model-Wide Global Selection: With scores unified across heads and normalized across layers, LaProx flattens all token scores across the entire LLM and simply takes the global
Top-Kto fit the total memory budget. Memory dynamically flows to whichever heads and layers need it most for that specific prompt.
Datasets
Because LaProx requires no training or calibration, datasets are used strictly for evaluation. No new benchmarks are introduced; instead, the authors test on established long-context suites:
- LongBench: 16 datasets spanning single- and multi-document QA, summarization, few-shot learning, synthetic tasks, and code completion.
- RULER / Needle-In-A-Haystack (NIAH): Evaluated at 32K context length across three retrieval variants—finding 1 needle (1N-1T), isolating 1 target needle among 3 distractors (4N-1T), and retrieving 4 needles simultaneously (4N-4T).
- InfiniteBench: Mentioned as an additional evaluation for ultra-long contexts (detailed in the paper's appendix).
Key Insights and Ideas
- Attention and Value-Outputs often disagree: Visualizing Mistral-7B reveals that $|A|$ and $|VW_O|$ frequently peak on completely different tokens. Judging a token strictly by attention is like judging the impact of a physical collision by velocity alone while ignoring mass.
- Heuristic "fixes" can backfire: Recent state-of-the-art methods try to patch attention-only eviction with heuristic rescaling or adaptive head budgets. Surprisingly, the authors show these heuristics can behave unstably—sometimes performing worse than vanilla baselines (e.g., on Qwen3-8B). Grounding eviction in exact matrix mechanics avoids this fragility.
- Optimal memory allocation is wildly input-dependent: When tracking how many tokens LaProx retains per head across different prompts, the authors found variations of up to 500 tokens per head depending on the input, alongside totally different layer preferences between Llama-3.1 and Mistral. This exposes a major flaw in prior calibration-based methods, which assume you can measure a model once offline and lock in fixed head/layer budgets forever.
Key Results
Evaluated across Llama-3.1-8B-Instruct, Mistral-7B-Instruct-v0.3, and Qwen3-8B, LaProx consistently beats SOTA baselines (StreamingLLM, SnapKV, AdaKV, CAKE, and CriticalKV):
- Extreme Compression: Maintains near-full-cache performance using only 5% of the KV cache, cutting accuracy loss by up to 2$\times$ under tight budgets. At a strict 128-token-per-layer budget on LongBench, LaProx beats the strongest baseline on Mistral-7B by nearly 2.5 points (44.00 vs. 41.54).
- Sharp Retrieval: On Mistral-7B (32K context, 256-token budget), LaProx achieves a 1.5$\times$ to 3$\times$ jump in Needle-In-A-Haystack retrieval accuracy over prior methods (scoring 167 vs. CriticalKV's 109 and SnapKV's 54).
- Real Hardware Speedups: Tested on an NVIDIA H100 (80GB) at 128K context length with Llama-3.1-8B, LaProx adds negligible prefill overhead, drops peak memory from 63.3GB to ~47.5GB, and delivers a 2.3$\times$ decoding speedup over full-cache inference.
Limitations and Future Work
Not discussed in the main text of the paper. (Note: The authors focus the main manuscript on the mathematical formulation and empirical validation of LaProx, without an explicit section detailing limitations or future research directions within these pages).
Summary updated