TL;DR
Modern transformers save memory by letting multiple attention heads share keys and values, yet each query head still burns quadratic compute calculating its own token-to-token "routing" map. This paper proves that, in the worst case, sharing keys and values gives you zero shortcut around that compute bottleneck—even though real-world models like Llama 3 and Qwen3 exhibit massive redundancy, using only a tiny fraction of their routing capacity in practice. This clash between mathematical worst-cases and empirical laziness defines both the opportunity and the core obstacle for next-generation attention compression.
What Problem Does This Paper Address?
Every time a transformer processes a sequence of $N$ tokens, its attention mechanism builds $N \times N$ routing matrices to decide which tokens read from which. Recent theoretical work proved that for standard multi-head attention, evaluating every head independently is essentially optimal—you cannot cleverly pool work across heads to beat that quadratic arithmetic cost.
However, modern LLMs rarely use vanilla multi-head attention anymore. Instead, they rely on Multi-Query Attention (MQA) and Grouped-Query Attention (GQA), which share keys and values across query heads to relieve memory bandwidth bottlenecks. This leaves a nagging open question: does sharing keys and values let us bypass the compute barrier and share the expensive $N \times N$ routing calculations too? And if worst-case math says no, are trained models actually using all those independent routes anyway?
Methods
To investigate both theory and reality, the author pairs fine-grained complexity proofs with a new diagnostic tool: the calibration-stacked spectral framework.
Instead of looking at attention weights in isolation, this framework treats a layer as a combined routing-and-message operator—capturing both where a head looks (the $N \times N$ routing matrix) and what it transmits (its value-output projection, or "message map"). Crucially, looking at one prompt at a time can be deceiving; a layer might look simple on individual inputs while requiring incompatible message channels across different prompts. To prevent this illusion, the author stacks hundreds of calibration prompts together.
Analyzing a stacked matrix of 50 million rows directly via Singular Value Decomposition (SVD) is intractable, so the paper introduces a neat Gram-matrix trick: reducing the massive problem to a tiny $H \times H$ eigenproblem (e.g., $32 \times 32$ for a 32-head layer) comparing head-by-head similarities. Finally, the framework carefully separates three levels of compression difficulty:
Datasets
Because this is a diagnostic and theoretical study rather than a model-training paper, datasets are used strictly for calibration and evaluation across 14 open-weight models (from Qwen3, Llama 3, Gemma 2, and Mistral, spanning 0.6B to 70B parameters). No new benchmarks are introduced. The authors use:
- C4 (validation set prompts for primary spectral calibration and bootstrap stability tests)
- WikiText-103 and CodeParrot (to test robustness across domains and sequence lengths)
- WikiText-2 (to measure perplexity impacts when greedily merging routes)
Key Insights and Ideas
- KV sharing is not compute sharing: Even in a single-layer MQA setup where all heads share one key-value pair, worst-case query heads still require full, independent quadratic routing computations (assuming the Strong Exponential Time Hypothesis).
- Algebraic simplicity doesn't mean easy compute: Remarkably, the exact mathematical construction used to prove computational hardness has an algebraic "stochastic route width" of just 1! Knowing that an aggregate route exists in low dimensions doesn't mean you can compute it cheaply from raw token embeddings via a
softmaxfunction. - Giant models are shockingly redundant: In practice, trained models leave most of their routing capacity on the table. Effective rank can even drop below the number of KV heads, meaning heads in different KV groups are quietly doing overlapping work.
- Compilers face a hard puzzle: Even if you just want to greedily reassign existing heads to reuse a smaller subset of representative routing patterns (a setup the paper calls
PATTERNMERGE), finding the optimal assignment is NP-hard.
Key Results
Measuring 14 GQA checkpoints reveals stark, widespread spectral decay across layers:
- Low effective rank: Against 8 to 64 query heads, layer-median effective rank ($r_{\text{eff}}$) sits between just 4.3 and 11.7. Llama-3-70B has 64 query heads and 8 KV heads, yet operates at a median effective rank of 4.3, with a single direction capturing ~97% of its signed energy ($T_1 = 0.026$).
- Eight directions rule them all: On C4 at length $N=512$, just 8 signed route-message directions capture >90% of the calibration energy in every single tested model. Across 126 domain-by-length combinations, 8 directions capture at least 87.9% everywhere (and >90% in 121 of them).
- Diagnostic ranking works, naive merging doesn't: When forcing heads to share routes (
PATTERNMERGE), picking routes using the paper's joint routing-message metric beats pure attention-similarity baselines in >97.5% of layers. However, brute-force patching degrades language modeling quality (e.g., Qwen3-8B WikiText-2 perplexity jumps from 12.87 unpatched to 20.7 with 16 routes, and collapses completely at 4 routes).
Limitations and Future Work
The author is refreshingly candid about what this paper doesn't do: it diagnoses redundancy, it does not build a faster attention kernel. Measuring high algebraic compressibility ("signed" relaxation) only proves that redundancy is present—it does not solve the "softmax realizability" hurdle of generating those shared routes cheaply on new inputs without computing the original heads first. Turning this spectral map into an actual wall-clock speedup will require new training recipes or learned routing compilers that bridge the gap between algebraic low-rank structure and efficient softmax execution, validated on downstream tasks.
Summary updated