Summary (Overview)

  • Random Attention is a signal-free KV cache eviction policy that keeps the prompt and evicts uniformly at random within each attention head, computing no score at all.
  • Across four models (Qwen3-4B, 14B, 32B, Phi-4-reasoning) and six reasoning tasks, it matches the strongest prior evictor (TriAttention) while serving 32–43% higher throughput in vLLM deployment.
  • The paper demonstrates that the selection signal contributes almost nothing: the prompt is the fragile part of the cache, and the reasoning trace protects itself through redundancy at two levels (text-level restatement and cross-head duplication).
  • In 31 of 60 baseline comparisons, Random Attention is significantly ahead; only one cell (code reasoning on Qwen3-32B) shows a baseline significantly ahead, traced to prompt length rather than selection quality.
  • The method requires no calibration, no tuning, and no scoring pass, making it both a deployable method and a null hypothesis for future eviction research.

Introduction and Theoretical Foundation

Background and Motivation

Reasoning models solve hard problems by generating chains of thought that can run to tens of thousands of tokens. The key-value (KV) cache grows linearly with generation length, creating a severe memory bottleneck. KV cache eviction methods address this by keeping a fixed budget of KV cache entries and discarding the rest as decoding proceeds.

The Prevailing Paradigm

Existing KV cache eviction methods follow a single paradigm: score each cached token by an estimate of how much it will matter later, and keep the top-scoring ones. This line of work includes:

  • H2O (Zhang et al., 2023): accumulated attention scores
  • SnapKV (Li et al., 2024): attention from a recent window
  • R-KV (Cai et al., 2025): attention combined with redundancy penalty
  • VaSE (Chang et al., 2026): value magnitude
  • TriAttention (Mao et al., 2026): position-dependent key statistics

The premise behind all of these is that the score decides accuracy under compression. The paper tests this premise directly and shows it is largely false.

Formal Setting

At step tt, an attention head holds NN cached key-value pairs (ki,νi)(k_i, \nu_i), i=1,,Ni = 1, \ldots, N, with ki,νiRdk_i, \nu_i \in \mathbb{R}^d. The head forms its output from the current query qtq_t as:

ot=iNαi(t)vi,αi(t)=exp(qtki/d)jNexp(qtkj/d),(1)o_t = \sum_{i \leq N} \alpha_i^{(t)} v_i, \quad \alpha_i^{(t)} = \frac{\exp\left(q_t^{\top} k_i / \sqrt{d}\right)}{\sum_{j \leq N} \exp\left(q_t^{\top} k_j / \sqrt{d}\right)}, \tag{1}

where αi(t)\alpha_i^{(t)} is the attention weight at step tt. Eviction decisions are made independently in every layer and KV head.

Periodic eviction framework: The cache keeps a persistent budget of KK pairs plus a buffer of rKr \ll K most recent pairs. Each eviction keeps the KK highest-scoring candidates:

St=top-KiCtsi,(2)\mathcal{S}_t = \operatorname{top-}K_{i \in \mathcal{C}_t} s_i, \tag{2}

where sis_i is a policy-specific score.


Methodology

Random Attention Algorithm

Random Attention is defined by two structural choices:

  1. Protect the question: Positions 1,,p1, \ldots, \ell_p (the entire prefill — system prompt, chat template, and question) are never evicted.
  2. Scatter the rest, per head: Every remaining cached position receives an i.i.d. uniform random score, and each KV head keeps its top-KK independently.

The entire method is:

si={+,ip(the prompt),uiUniform(0,1),otherwise,(3)s_i = \begin{cases} +\infty, & i \leq \ell_p \quad (\text{the prompt}), \\ u_i \sim \text{Uniform}(0, 1), & \text{otherwise}, \end{cases} \tag{3}

drawn independently per KV head at every eviction.

Algorithm 1: Random Attention scoring (one eviction event; runs per layer)
Require: batch size B; number of KV heads H_kv; number of cached positions S; 
        prompt length ℓ_p; budget K
Ensure: keep, the K positions each KV head retains, of shape (B, H_kv, K)

1:  s ← rand(B, H_kv, S)          ▷ i.i.d. uniform score per cached position, per KV head
2:  s[:, :, 0:ℓ_p] ← +∞           ▷ force-keep the question
3:  keep ← topk(s, K)             ▷ independent top-K per KV head
4:  return keep

The per-eviction cost is one rand and one topk — the weakest possible selection signal.

Experimental Setup

  • Models: Qwen3-4B, Qwen3-14B, Qwen3-32B, Phi-4-reasoning (14B)
  • Tasks: MATH500, GPQA-Diamond, AIME 2025+2026, HMMT, LiveCodeBench-v6 medium
  • Compression: ~4× compression of typical trace (~3× for LiveCodeBench)
  • Baselines: SnapKV, R-KV, VaSE, TriAttention, full attention (ceiling)
  • Statistics: Paired, problem-clustered percentile bootstrap (95% CI) plus exact sign test

Controlled Experiments

Experiment 1 (Prompt fragility): Give every method the same rule (keep the prompt) and measure how much each method gains relative to its score alone.

Experiment 2 (Cross-head redundancy): A planted-fact probe inserts a synthetic fact (e.g., "Let z_q = 4729") into real MATH500 reasoning traces, 1,536 tokens before a question needing the value. The fact is pinned in a chosen set of heads and evicted from all others. Two metrics measure survival:

  • Retrieval: fraction of traces whose greedy decode reproduces the value
  • Graded recall:
R=i(LPiLPidel)i(LPikeptLPidel),(4)R = \frac{\sum_i \left(\mathrm{LP}_i - \mathrm{LP}_i^{\mathrm{del}}\right)}{\sum_i \left(\mathrm{LP}_i^{\mathrm{kept}} - \mathrm{LP}_i^{\mathrm{del}}\right)}, \tag{4}

where LPi\mathrm{LP}_i is the log-probability of the correct value under the tested condition, LPikept\mathrm{LP}_i^{\mathrm{kept}} with the fact in every cache, and LPidel\mathrm{LP}_i^{\mathrm{del}} with it deleted from every cache. R=1R=1 means surviving copies are as good as never evicting.


Empirical Validation / Results

Main Results

Table 1: Accuracy under KV cache eviction at ~4× compression

MethodMATH500 K=1024GPQA-D K=2048AIME K=4096HMMT K=4096LiveCodeBench K=3072
Qwen3-4B
Full0.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 Attention0.8740.5300.6100.4380.744
Phi-4-reasoning
Full0.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 Attention0.9100.6780.6620.4300.667
Qwen3-32B
Full0.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 Attention0.8910.6830.6640.5090.806

Key findings:

  • Random Attention is significantly ahead in 31 of 60 baseline cells, significantly behind in only one.
  • On math and science reasoning (MATH500, GPQA-D), no selector beats Random Attention significantly.
  • On code reasoning (LiveCodeBench), most signal-based selectors collapse due to much longer prompts (average 557 tokens vs. ~100 for MATH500); Random Attention pins every prompt token.

Compression Pressure

From 2× to 16× compression, Random Attention stays tied with TriAttention while the gap from both to VaSE opens. At 2×, every method sits near full attention.

Prompt Protection Experiment

Table 2: Performance before and after protecting the prompt

MethodQwen3-4B MATH500 (score → +prompt)Qwen3-4B GPQA-DPhi-4 MATH500Phi-4 GPQA-D
SnapKV0.703 → 0.829 (+12.6)0.369 → 0.492 (+12.3)0.844 → 0.889 (+4.5)0.442 → 0.667 (+22.5)
R-KV0.810 → 0.812 (+0.2)0.482 → 0.471 (−1.1)0.909 → 0.902 (−0.7)0.636 → 0.655 (+1.9)
VaSE0.809 → 0.812 (+0.3)0.461 → 0.470 (+0.9)0.853 → 0.895 (+4.2)0.562 → 0.664 (+10.2)
Recency window0.246 → 0.843 (+59.7)0.093 → 0.519 (+42.6)0.665 → 0.884 (+21.9)0.323 → 0.658 (+33.5)
Random Attention0.459 → 0.874 (+41.5)0.231 → 0.530 (+29.9)0.759 → 0.910 (+15.1)0.434 → 0.678 (+24.4)

The rule pays each method according to how much of the question its score was losing. Once every method keeps the prompt, baselines land within 2.2 points of one another.

Cross-Head Redundancy Findings

  • Copies pool across heads: Only 3 of Qwen3-4B's 8 KV heads retain a usable trace of a fact alone (best single head: 3% retrieval). But two heads together yield 60%, three heads 83%, all eight 99%. Pooling is strongly superadditive.
  • The shape of copies does not matter: Dealing the fact out token-by-token across heads barely moves retrieval (0.33 vs. 0.39 for an intact sentence) and recall is essentially unchanged (R=0.75R=0.75 vs. 0.760.76).

Needle-Finding (What's Left for a Signal)

Table 3: Passcode stated once, 57 compression rounds before the question

PolicyRetr.log p
Random Attention0.000−18.35
VaSE0.344−3.88
SnapKV0.004−11.11
R-KV0.836−0.71
TriAttention0.016−11.11

R-KV, the best needle-finder, leads only one column of Table 1, while TriAttention, the strongest baseline there, recovers almost nothing here. On real traces this case is rare because the model keeps restating what it is still using.

Serving Throughput

Table 4: Serving throughput under vLLM with PagedAttention on one H200 (K=2048, 1k-token prompts, 32k-token generations)

MethodQwen3-4BPhi-4-reasoningQwen3-14BQwen3-32B
Full1296 (1.00×)780 (1.00×)925 (1.00×)346 (1.00×)
TriAttention1494 (1.15×)1212 (1.55×)1303 (1.41×)700 (2.02×)
Random Attention2046 (1.58×)1737 (2.23×)1819 (1.97×)923 (2.67×)
Ours over TriAttention+37%+43%+40%+32%

The margin comes from skipping the scoring pass: with 128 concurrent requests, vLLM compresses some request at nearly every decoding step (~62k times per workload), and all requests wait during each compression.


Theoretical and Practical Implications

Theoretical Implications

  1. The ranking problem is largely irrelevant: The accuracy of an evictor is decided by what it protects, not by how it ranks the rest.

  2. Two-level redundancy explains robustness:

    • Text-level: Reasoning traces restate what they are still using, so a value that matters rarely lives at one position only.
    • Cross-head: Each KV head caches its own copy of every token; a token is only lost when all heads drop it. Independent per-head random draws maximize the chance that some head keeps a needed value.
  3. The prompt is the fragile part: The question is stated once and cannot be recovered if evicted. Methods differ mainly in whether their score happens to preserve it.

Practical Implications

  1. Random Attention is a deployable method: It needs no calibration, no tuning, and no scoring pass. It is the fastest evictor measured at equal accuracy, making it a reasonable default for serving reasoning models under a memory budget.

  2. New baseline for eviction research: Any new selection signal must beat Random Attention at matched budget and matched prompt protection.

  3. Redirected research questions:

    • How to budget long prompts, especially in code tasks where protecting the entire prompt consumes a substantial fraction of the cache budget.
    • How to recover rare once-stated facts that only a content-dependent signal can preserve.

Conclusion

KV cache eviction for reasoning has been treated as a ranking problem: estimate which cached tokens will matter and keep those. The paper finds that the ranking contributes almost nothing. A policy that keeps the prompt and evicts uniformly at random within each head:

  • Matches the strongest baselines across four models and six tasks
  • Serves 32–43% higher throughput in vLLM deployment
  • Requires no scoring pass, calibration, or tuning

The explanation rests on two findings: (1) the prompt is the fragile part of the cache, and once every method keeps it, most gaps disappear; (2) the reasoning trace protects itself through redundancy in the text and across heads, so a random draw keeps enough copies of what the model still needs.

Future directions: The open questions move to where protection still matters — budgeting long prompts (especially code tasks) and recovering rare once-stated facts. The code is publicly available at https://github.com/SalesforceAIResearch/Random-Attention.

Related papers