Eliciting the Recall Capacity of Linear Attention
Organizations: ELLIS Institute Tübingen · MPI-IS · Tübingen AI Center · KTH Royal Institute of Technology
Abstract
Linear attention models exhibit a disproportionate deficit relative to softmax attention in associative recall (AR) in language modeling. We investigate this gap through natural language evaluations, synthetic recall tasks, and targeted training interventions. Using a synthetic setting, we quantify the role of state-size in how many items can be recalled from memory and find a similar empirical scaling across the tested linear-attention architectures. Testing this relationship reveals that even a single layer at scale can learn to retrieve thousands of associations across long distances. Yet, standard language model training does not reliably teach a linear model to copy from context, whereas a comparable softmax model learns to do so. Considering this, we strengthen recall supervision during training through in-context sentence repetition and context-sensitive loss reweighting. Both methods improve recall-intensive benchmark performance and narrow the long-distance AR gap to the softmax baseline without changing the architecture, token budget, or number of optimization steps, at a slight cost to general language modeling. These targeted changes to training can thus elicit substantial but underutilized retrieval capacity in linear-attention models. These findings suggest that, although linear-attention architectures have substantial capacity for recall, their inductive biases and the demands of language model training make it difficult to develop this capability without dedicated incentives.
Figures & tables
| Loss difference vs. softmax (nats) | ||||||
| Group | Count | Softmax (nats) | DN | GLA | GDN | KDA |
| Standard tokens | 15,712,918 | |||||
| AR-hits | 273,070 | |||||
| 1–511 tokens back | 226,922 | |||||
| 512+ tokens back | 46,148 | |||||
| Rare tokens, first mention | 35,323 | |||||
| KDA | Std. | Colon | Prefix | TF |
|---|---|---|---|---|
| Base | 37.2 | 45.9 | 53.1 | 91.9 |
| Cooldown | 39.3 | 51.7 | 66.8 | 95.9 |
| Full | 54.4 | 65.8 | 83.8 | 98.1 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Architecture | State update | Mechanism |
|---|---|---|
| LA a | Additive write | |
| RWKV-5 b | Fixed channel-wise decay | |
| Mamba-2 c | Scalar decay per head | |
| GLA d | Input-dependent channel-wise decay | |
| RWKV-6 e | Input-dependent channel-wise decay | |
| DN f | Delta update |
| Corpus | Tokenizer | AR-hits (%) | Repeated bigrams (%) |
|---|---|---|---|
| FineWeb-Edu | Llama-2 (32k) | 1.7 | 22.7 |
| GPT-2 BPE (50k) | 2.4 | 19.9 | |
| Pile | Llama-2 (32k) | 3.8 | 40.8 |
| GPT-2 BPE (50k) | 4.3 | 43.7 | |
| Zoology Arora et al. (2023) , Pile | 6.4 | – | |
| Dataset | Original prompt (end) | Four-word prefix | Answer | Substitute |
|---|---|---|---|---|
| Question answering | ||||
| DROP | “The player who kicked the longest field goal is Shaun” | “when the kicker Shaun” | Suisham | Disgust |
| TQA | “The singer who played the Goblin King Jareth in the film ‘Labyrinth’ was” | “Goblin King (played by” | David Bowie | Syrup Check |
| NQ | “The whistling in the Muppet movie was done by” | “was performed by musician” | Andrew Bird | Matrix Cape |
| Document extraction | ||||
| SWDE | “Summary of information above… director:” | “for their survival. Director:” | Frank Marshall | Thank Homework |
| Softmax attention | KDA | ||||||||
| Swap | Swap | ||||||||
| Dataset | Prompt | Full | No ctx | Sub. | Orig. | Full | No ctx | Sub. | Orig. |
| DROP | Original | 19.7 | 2.4 | 7.0 | 4.6 | 22.0 | 1.6 | 6.6 | 6.7 |
| Prefix | 67.8 | 5.1 | 54.1 | 5.3 | 57.5 | 5.8 | 38.8 | 4.9 | |
| TQA | Original | 44.0 | 13.6 | 16.4 | 13.4 | 42.7 | 15.1 | 14.4 | 14.6 |
| Prefix | 83.6 | 7.2 | 73.8 | 3.8 | 69.8 | 7.1 | 60.3 | 4.8 | |
| Channels with | Copy accuracy (%) | ||
|---|---|---|---|
| Model | (%) | Learned decay | Decay fixed to 1 |
| H-GLA | 0.0 | 83.7 | 83.7 |
| GDN | 0.0 | 88.0 | 88.0 |
| D-GLA | 30.7 | 66.8 | 58.4 |
| KDA | 43.7 | 48.5 | 0.4 |
| Document extraction | In-context QA | Language modeling | |||||||
| Model | Prompt | SWDE | FDA | SQuAD | TQA | NQ | DROP | LMB | Wiki |
| Standard | |||||||||
| Softmax | Base | 53.7 | 50.5 | 28.4 | 50.2 | 19.4 | 19.1 | 35.1 | 26.2 |
| Prefix | 65.8 | 69.5 | 74.0 | 84.0 | 48.9 | 67.7 | – | – | |
| DN | Base | 21.1 | 8.2 | 29.3 | 44.8 | 12.4 | 19.1 | 37.8 | 27.9 |
| Prefix | 26.6 | 11.9 | 58.5 | 70.4 | 17.5 | 51.3 | – | – | |
| Recall accuracy (%) | LM | |||||
| Method | Loss | All | QA | Extr. | Prefix | PPL |
| Baseline | 2.3439 | 27.1 | 30.2 | 21.0 | 43.6 | 27.84 |
| Repetition | ||||||
| Sentence 5% | 2.3510 (+0.0071) | 30.0 (+2.9) | 30.2 (+0.0) | 29.5 (+8.5) | 56.2 (+12.6) | 27.95 (+0.11) |
| Sentence 10% | 2.3562 (+0.0123) | 30.8 (+3.7) | 30.7 (+0.5) | 31.1 (+10.1) | 58.7 (+15.2) | 28.15 (+0.32) |
| Sentence 22% | 2.3680 (+0.0241) | 30.8 (+3.7) | 30.2 (+0.0) | 32.1 (+11.1) | 61.2 (+17.6) | 29.12 (+1.29) |
| LM | Original-prompt answer loss | Prefix | ||||
| Method | Loss | SWDE | FDA | QA | Loss | Acc. |
| Baseline | 2.963 | 2.739 | 1.859 | 2.048 | 1.908 | 16.1 |
| Sentence repetition: changes from baseline | ||||||
| Sentence 5% | +0.017 | -0.143 | -0.351 | -0.033 | -0.284 | +4.6 |
| Sentence 9% (short) | +0.027 | -0.177 | -0.402 | -0.034 | -0.329 | +5.9 |
| Sentence 9% | +0.029 | -0.254 | -0.563 | -0.045 | -0.453 | +8.0 |
| Repeat share | Exposure | LM loss | Prefix loss | Prefix acc. |
|---|---|---|---|---|
| 9.3% | Cooldown | +0.029 | -0.453 | +8.0 |
| 10.0% | Throughout | +0.029 | -0.909 | +21.4 |
| 19.8% | Cooldown | +0.057 | -0.592 | +11.3 |
| 20.0% | Throughout | +0.060 | -1.066 | +25.9 |
| Group | Count | Softmax | DN | GLA | GDN | KDA |
|---|---|---|---|---|---|---|
| Standard run | ||||||
| AR-hits, 1–511 back | 226,922 | 0.770 ∗ | ||||
| AR-hits, 512+ back | 46,148 | 1.454 ∗ | ||||
| Rare tokens | ||||||
| New prefix, 1–511 back | 16,158 | 4.027 ∗ | ||||
| New prefix, 512+ back | 3,541 | 5.355 ∗ | ||||
| NIAH-1 | NIAH-2 | NIAH-3 | NIAH-4 | ||||||||||||||
| Model | Run | S | C | P | T | S | C | P | T | S | C | P | T | S | C | P | T |
| 2K context | |||||||||||||||||
| Softmax | Base | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 69 | 74 | 77 | 99 | 89 | 95 | 99 | 99 |
| R | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 94 | 96 | 98 | 100 | 94 | 100 | 100 | 100 | |
| L | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 88 | 88 | 86 | 100 | 89 | 100 | 100 | 100 | |
| R+L | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 97 | 96 | 99 | 100 | 95 | 100 | 100 | 100 | |
| MK-1 | MQ | MV | ||||||||||
| Model | Run | S | C | P | T | S | C | P | T | S | C | P |
| 2K context | ||||||||||||
| Softmax | Base | 70 | 70 | 45 | 94 | 31 | 30 | 25 | 85 | 36 | 36 | 22 |
| R | 52 | 53 | 81 | 94 | 29 | 29 | 25 | 85 | 26 | 27 | 24 | |
| L | 66 | 65 | 54 | 95 | 31 | 31 | 27 | 86 | 32 | 32 | 24 | |
| R+L | 50 | 50 | 93 | 93 | 29 | 29 | 29 | 86 | 29 | 29 | 25 | |
Linear Attention
Linear attention reduces sequence-length costs by replacing pairwise token interactions with kernel features, recurrent states, or compact memory.
See all 148 papers