Researchers Prove Why Linear Attention Always Loses to Softmax on Spike Tokens
A theoretical proof pinpoints exactly which patterns softmax attention captures that linear attention provably cannot, using a spike-token dataset.
ProTakeaways
- New theoretical paper proves softmax attention can classify datasets that linear attention provably cannot
- Construction uses a spike-token dataset where one coordinate equals 4 log n and softmax turns it into a near one-hot
- Linear attention averages the spike away, dropping the signal to order 1/sqrt(n) after random projection
- Result holds for both self-attention and cross-attention with four-layer ReLU networks
- Complements NeurIPS 2024 work showing linear attention is not injective
- No code released, but the spike-dataset diagnostic is reproducible in a few hundred lines of PyTorch
Linear attention has been the perennial understudy in transformer architectures. It promises linear-time complexity in sequence length instead of the quadratic cost of standard attention, which sounds like a free lunch. In practice it has never quite delivered, and a new theoretical paper titled Why Softmax Attention Outperforms Linear Attention finally explains the shortfall by constructing datasets that softmax can classify but that linear attention provably cannot.
The efficiency temptation
Standard attention burns compute because it materializes an n by n similarity matrix, then normalizes it with a softmax. The softmax operation on the attention matrix is the key factor contributing to the quadratic complexity of attention, and linear attention uses kernel functions to approximate the softmax function, allowing it to change the computation order of Q, K, and V, thereby reducing the computational complexity from quadratic to linear.
The trick is associativity. Based on the associative property of matrix multiplication, linear attention can change the computation order by computing K^T V first, thus reducing the computation complexity from O(N^2 d) to O(N d^2). That is huge for long-context models, high-resolution vision transformers, and any workload where the sequence dwarfs the embedding dimension.
The catch is empirical. Linear attention presents a more computationally efficient alternative by approximating the softmax operation with linear complexity, however it exhibits substantial performance degradation when compared to the traditional softmax attention mechanism. Prior work has offered intuitions such as attention dilution and non-injectivity, but a clean separation result was missing.
The construction: a single spike token
The authors build two synthetic dataset families, D0 and D1, that differ in exactly one way. In D0, the projected input A x has every coordinate in a bounded range around log n. In D1, one coordinate is pushed up to 4 log n, creating a single spike. The classification task is: does the sequence contain a spike?
The key insight is what softmax does to that spike. Because softmax exponentiates before normalizing, a value of 4 log n becomes n^4, while the background values of at most 1.4 log n become at most n^1.4. After normalization, the spike coordinate captures at least half of the mass, and every other coordinate is squashed to a level below 1 / n^2.6. The softmax output is not a smoothed average, it is essentially a one-hot indicator of the spike location.
Linear attention, which just divides raw values by their sum, sees no such blow-up. The spike coordinate contributes about 4 / n, the background coordinates about 1 / n, and the whole vector is nearly uniform. When you dot that with a random Rademacher sign vector, the concentration argument via Hoeffding kills the signal on the order of 1 / sqrt(n).
What the theorems actually say
The paper proves, for both self-attention and cross-attention, that there exist four-layer networks with the following behavior:
- A softmax-plus-ReLU network F_exp outputs a positive value on D1 and zero on D0 with probability at least
1 - delta/poly(n). - Any linear-attention-plus-ReLU network F_lin with the same architecture outputs zero on both D0 and D1 with the same probability.
In other words, softmax can separate the two distributions and linear attention cannot, no matter how the weights are set. The threshold tau in the ReLU is tuned to (c + 0.1) sqrt(log n) so that only the softmax network's spike-driven output crosses it.
The proof machinery draws on fine-grained complexity style hardness arguments, Hoeffding concentration for the random ReLU output layer, and a tensor trick that rewrites exp(A1 Q K^T A2^T) as exp((A1 tensor A2) vec(Q K^T)), letting the analysis work coordinate by coordinate.
How this sits against the wider literature
The theoretical separation lines up with several empirical diagnoses that have been circulating. The lack of non-linear attention concentration in the process of dot-product normalization is considered to be the primary cause, and the distribution of linear attention is smoother, i.e., it cannot concentrate on high attention scores as softmax can.
A parallel NeurIPS 2024 analysis reached a related conclusion from a different angle. The authors present two key perspectives to understand and alleviate the limitations of linear attention: the injective property and the local modeling ability, proving that linear attention is not injective and is prone to assign identical attention weights to different query vectors. The Deng-Song-Yuan-Zhou result is complementary: it shows that even setting injectivity aside, there are dataset distributions no linear attention network of the given depth can classify.
Why practitioners should care
The result is not a bombshell that kills linear attention as a research direction, but it does clarify what any replacement needs to preserve. Some concrete implications:
- If your workload contains rare, high-magnitude tokens that must dominate the mixture, a pure linear approximation will average them away. Retrieval-style tasks, needle-in-a-haystack evaluations, and copy heads are exactly this pattern.
- Hybrid architectures that reintroduce nonlinearity, such as focused kernels, gating, or a small softmax head alongside the linear path, are not just empirical hacks. They are patching a provable expressivity gap.
- The construction gives a diagnostic. Build the spike dataset with n around 1000 and check whether your linear-attention variant can classify it. If it cannot, you know why, and you know it is not a training issue.
The limits of the result
The paper proves existence, not tightness. It shows one architecture class where the gap appears, with specific parameter choices such as QK^T = 1_{d x d} or QK^T = I_d, and dimensions in the range d in [omega(n^0.02), n]. It does not rule out linear-attention variants with extra structure, such as multi-head averaging, positional biases, or learned kernels, that could sidestep the specific construction. Nor does it speak to hybrid designs already popular in production.
The experiments themselves are simulation only, run on a MacBook Pro with M2 and 16 GB of memory, generating models 100 or 1000 times per parameter setting and counting how often the theoretically predicted success event occurs. No code repository or trained model is released, though the constructions are simple enough that reproducing the diagnostic in a few hundred lines of PyTorch is straightforward. The full details, including the cross-attention dataset and all six ablation figures over n, d, m, c, a_0, and a_1, are in the arxiv HTML.
The bigger takeaway is that the softmax nonlinearity is doing real representational work, not just providing a convenient normalization. Any efficient replacement has to earn back the concentration property that the exponential gives away for free.