Random Attention

Rethinking KV Cache Eviction for Efficient Reasoning

Heng Wang1,2, Jielin Qiu1, Wenting Zhao1, Cheng Qian1,2, Liangwei Yang1, Jiawei Han2, Heng Ji2, Silvio Savarese1, Shelby Heinecke1, Huan Wang1

1Salesforce AI Research · 2University of Illinois Urbana-Champaign

📄 arXiv ⭐ Code 🤗 HF Paper Thread BibTeX
TL;DR — Every KV cache eviction method scores cached tokens and keeps the top-K. We drop the score entirely: keep the prompt, evict the rest uniformly at random within each attention head.
Score-based eviction H2O · SnapKV · R-KV · VaSE · TriAttention sink everything else competes — top-K scores kept, per head .6 .2 .1 .8 .3 .7 .5 .2 .9 .4 .6 .1 .7 head 1 .3 .5 .2 .4 .7 .2 .8 .6 .1 .9 .3 .5 .6 head 2 .1 .4 .6 .7 .5 .3 .2 .8 .6 .3 .9 .2 .5 head 3 scoring pass, at every eviction attention stats · value norms · key statistics the question itself competes by score: TriAttention pins the whole prompt, the others keep only the sink tokens by default cost: score every cached token at every eviction event Random Attention (ours) no scores, no calibration — two structural rules 1 · always keep the prompt 2 · sample the trace uniformly at random, per head head 1 head 2 head 3 each head keeps a different random subset, so a copy of what the model still needs survives in some head cost: none — no scoring pass, just the compaction itself
Prior evictors vs. Random Attention. Left: every existing method runs a scoring pass and keeps the top-K scored tokens in each head (struck-through cells are evicted). Only the sink tokens are kept by rule; the rest of the question competes by score — TriAttention pins the whole prompt, but SnapKV, R-KV and VaSE leave it to the score, and an evicted prompt token cannot be re-derived. Right: Random Attention pins the prompt and samples the generated trace uniformly at random, independently in each KV head — no scores are ever computed, and the per-head draws leave redundant copies of the trace in the cache. Download this figure (PNG) · PDF

The result

The selection signal contributes almost nothing

We evaluate at a roughly 4×-compressed cache budget on MATH500, GPQA-Diamond, AIME 2025, AIME 2026, HMMT and LiveCodeBench, on Qwen3-4B/14B/32B and Phi-4-reasoning, with matched budgets and paired significance tests throughout. Random Attention matches the strongest prior evictor on every model, is significantly ahead of a baseline in 31 of the 60 main-table comparisons, and is significantly behind in exactly one (code reasoning on Qwen3-32B, explained below).

Overview: accuracy bars for four models and serving throughput
(a) Mean accuracy over the six tasks: Random Attention (red) vs. SnapKV, R-KV, VaSE and TriAttention at the same cache budget, with full attention dashed. (b) vLLM serving throughput at 32k-token generations: labels give the multiple over paged full attention and the margin over TriAttention.
MATH500K=1024GPQA-DK=2048AIMEK=4096HMMTK=4096LCBK=3072
Qwen3-4B
Full attention0.9390.5620.6420.4620.807
SnapKV0.7030.3690.4180.3950.507
R-KV0.8100.4820.4940.3710.712
VaSE0.8090.4610.5960.4210.700
TriAttention0.8640.5330.5920.4370.755
Random Attention (ours)0.8740.5300.6100.4380.744
Phi-4-reasoning
Full attention0.9220.7070.6770.4440.697
SnapKV0.8440.4420.5020.3430.314
R-KV0.9090.6360.6430.4400.621
VaSE0.8530.5620.5200.3540.373
TriAttention0.8910.6840.6330.4310.652
Random Attention (ours)0.9100.6780.6620.4300.667
Qwen3-32B
Full attention0.9500.7030.7150.5590.886
SnapKV0.8160.4760.5410.4500.609
R-KV0.8570.6380.6130.4720.779
VaSE0.8680.5970.6800.5240.797
TriAttention0.8870.6830.6770.5080.834
Random Attention (ours)0.8910.6830.6640.5090.806
The main grid: accuracy at each task's ~4× compression (LCB ~3×); K is the per-head KV budget. Bold: best eviction method per column; greyed: significantly below Random Attention (paired clustered bootstrap + sign test, 95%). AIME pools 2025 and 2026; every number is the mean over independently sampled runs.

Pushing compression harder does not change the ordering. From 2× to 16×, on both model families, Random Attention stays tied with TriAttention while the gap from both to VaSE opens — compression pressure widens the gap in the random policy's favour.

Accuracy vs compression factor, 2x to 16x
Accuracy from 2× to 16× compression on Qwen3-4B and Phi-4-reasoning; dashed lines mark full attention. At 2× every method sits near full attention; as the budget tightens, Random Attention stays tied with TriAttention while VaSE falls away. The ✕ marks budgets smaller than the prompt itself, which Random Attention scopes out.

Mechanism I

The prompt is the fragile part of the cache

Methods disagree about the prompt: TriAttention keeps the whole input by default, while SnapKV, R-KV and VaSE keep only sink tokens and leave every slot to the score. Giving every method the same rule — keep the prompt, score only the generated trace — separates the score from the protection, and the rule pays each method according to how much of the question its score was losing: SnapKV, whose score retains the least of the prompt, gains up to +22.5 points; R-KV, which already retains the most, never gains more than 1.9. Once every method keeps the prompt, the three baselines land within 2.2 points of one another in every setting — and every learned score still trails the policy that ranks nothing.

Losing the prompt is catastrophic; cutting the trace at random is not. That is what makes the prompt the fragile part of the cache.

Mechanism II

The reasoning trace protects itself

Why does random eviction of the trace not hurt? Because the trace is stored redundantly at two levels. In the text: the model restates the intermediates it still needs as it works, so a needed value usually has a recent copy. Across attention heads: every head holds its own copy of every token, and eviction decides per head which copies die — a token is only lost when every head happens to drop it. A planted-fact probe makes the second level visible: we insert a synthetic fact into real reasoning traces 1,536 tokens before a question that needs it (15 eviction rounds pass in between) and control which KV heads keep it. A fact surviving in a single head is almost never retrieved (3%), while the same fact surviving in several heads is retrieved almost always (99% with all eight) — and the shape of the surviving copies barely matters.

Planted-fact probe: copies in different heads pool
The planted-fact probe. (a) Retrieval accuracy grows with the number of heads holding the fact, from 0.03 (one head) to 0.99 (all eight). (b) Two facts held in different heads are both recovered more often than the sum of either alone. (c) On real MATH500 traces, evicting in contiguous blocks of 1–64 tokens changes nothing: the draw's shape is free.

The boundary

What is left for a selection signal

The one case a signal-free policy cannot cover is a fact stated once, never restated, and needed much later — the case redundancy cannot reach. In a passcode probe (announced once, 57 eviction rounds before the question), Random Attention never reproduces it, while R-KV — whose score accumulates attention over the whole history — finds it 84% of the time. Needle-finding is real selection skill, but it neither implies nor follows from aggregate strength: R-KV, the best needle-finder, leads only one column of the main grid, and TriAttention, the strongest baseline there, recovers almost nothing. On real traces the case is rare, because the model keeps restating what it is still using. The other honest cost is code reasoning: prompts average 557 tokens (six times MATH500's), so pinning them consumes a large share of the budget — the setting behind the single significant baseline win.

Serving

No scoring pass means real speed

Random Attention needs no calibration, no tuning, and no per-step scoring. Under paged vLLM serving it delivers 1.6–2.7× full-attention throughput across the four models — 32–43% more than TriAttention on the same kernels at 32k-token generations, a margin that holds at capacity. In an iso-memory benchmark (largest batch fitting one H200), the compressed cache fits 109–200 concurrent sequences where full attention fits 20–28, and Random Attention reaches up to 10× full-attention throughput at K=3072 and 28.8× at MATH500's tighter K=1024. It is also the baseline any new selection signal has to beat, at matched budget and matched prompt protection.

+32–43%
tokens/s over the strongest baseline (vLLM, 32k generations)
28.8×
full-attention multiple, iso-memory benchmark (K=1024)
0
scores computed, calibration passes, tuned hyperparameters

Implications & future work

What this changes for eviction research

Two practical implications follow. First, Random Attention is a deployable method in its own right: it needs no calibration, no tuning and no scoring pass, and it is the fastest evictor we measured at equal accuracy — a reasonable default for serving reasoning models under a memory budget, and the baseline any new selection signal has to beat at matched budget and matched prompt protection. Second, the findings redirect what eviction research should optimise: the accuracy of an evictor is decided by what it protects, not by how it ranks the rest.

That moves the open questions to where protection still matters:

Use it

Try it on your own model

The repository contains the eviction engine (every method in the paper as an eviction mode), the evaluation harness, the paired significance tests, the efficiency benchmarks and the vLLM port.

git clone https://github.com/SalesforceAIResearch/Random-Attention && cd Random-Attention
bash setup.sh && . env.sh

# one (model, task, method, budget) accuracy cell
scripts/run_cell.sh Qwen3-4B math random_pp   # Random Attention, K defaults to the ~4x point
scripts/run_cell.sh Qwen3-4B math triattn     # strongest baseline, per-model calibration
scripts/grade_cell.sh Qwen3-4B math_K1024 random_pp,triattn_ph_memofix

Citation

BibTeX

@article{wang2026random,
  title         = {Random Attention: Rethinking KV Cache Eviction for Efficient Reasoning},
  author        = {Wang, Heng and Qiu, Jielin and Zhao, Wenting and Qian, Cheng and
                   Yang, Liangwei and Han, Jiawei and Ji, Heng and Savarese, Silvio and
                   Heinecke, Shelby and Wang, Huan},
  journal       = {arXiv preprint arXiv:2609.03430},
  year          = {2026},
  eprint        = {2609.03430},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL}
}

References

Key references

  1. Zhang et al. "H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models." NeurIPS 2023.
  2. Li et al. "SnapKV: LLM Knows What You are Looking for Before Generation." NeurIPS 2024.
  3. Cai et al. "R-KV: Redundancy-aware KV Cache Compression for Reasoning Models." NeurIPS 2025.
  4. Chang et al. "Value-Aware Stochastic KV Cache Eviction for Reasoning Models (VaSE)." arXiv:2606.03928.
  5. Mao et al. "TriAttention: Efficient Long Reasoning with Trigonometric KV Compression." ICML 2026.
  6. Xiao et al. "Efficient Streaming Language Models with Attention Sinks." ICLR 2024.
  7. Kwon et al. "Efficient Memory Management for Large Language Model Serving with PagedAttention." SOSP 2023.
  8. X. Wang. "How Much Cache Does Reasoning Need? Depth-Cache Tradeoffs in KV-Compressed Transformers." arXiv:2604.17935.