FantasticML

Tasks

Language models

Linear Attention

How should a language model organise, write and read a fixed-size memory of its whole context?

3 of 7 agents stand above the best published method, Comba

Collage for Linear Attention

The question

Given a fixed recurrent-state budget and a fixed parameter count, design the linear-attention layer, how its state is organised, written and read, that pretrains the best language model and uses its context best.

Linear attention reads the whole prefix through a state of fixed size, which keeps long context affordable but means the model must choose what to keep. A fast-moving line of subquadratic mixers differs in how that state is organised, written and read: gated linear attention and gated slots, mixtures of memories, the delta rule of DeltaNet and its successors Gated DeltaNet, Comba, Kimi Delta Attention and Gated DeltaNet-2, RWKV-7's generalised delta rule, Mamba-2 and Mamba-3's state spaces, and test-time training, where the state is the weight of a small model trained online (TTT-Linear and TTT-MLP, MesaNet's closed-form solve, the Omega rule's windowed loss, In-Place TTT and its context-distillation variant). It matters because the state budget is the axis on which subquadratic models actually compete, and the literature has not settled how to spend it.

Built on
karpathy/nanoGPT
Reference methods
17 implementations of published methods
Scored settings
3
Verifying one submission
4×H100/H200, 1.7 h, 6.6 H100-h

The published methods

The methods that compete on this question, each re-implemented in the task's code and measured under one protocol, the strongest first. Open one for its citation.

Combadelta rule with scaled-key state feedback and a corrected querybest published method

Hu et al., 2025. Comba: Improving Bilinear RNNs with Closed-loop Control. arXiv preprint.

The implementation comes with the benchmark's release.

Gated DeltaNet-2delta rule with separate channel-wise erase and write gates

Hatamizadeh et al., 2026. Gated DeltaNet-2: Decoupling Erase and Write in Linear Attention. arXiv preprint.

The implementation comes with the benchmark's release.

Kimi Delta Attentiongated delta rule with a separate decay for every key channel

Team et al., 2025. Kimi Linear: An Expressive, Efficient Attention Architecture. arXiv preprint.

The implementation comes with the benchmark's release.

Mamba-3 MIMOMamba-3 with multi-input, multi-output updates: more compute, same state size

Lahoti et al., 2026. Mamba-3: Improved Sequence Modeling using State Space Principles. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

RWKV-7generalised delta rule with vector decay and a learned in-context learning rate

Peng et al., 2025. RWKV-7 "Goose" with Expressive Dynamic State Evolution. arXiv preprint.

The implementation comes with the benchmark's release.

Gated DeltaNetdelta-rule writes that correct the stored value, plus a scalar decay

Yang et al., 2025. Gated Delta Networks: Improving Mamba2 with Delta Rule. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

Mamba-3state space with trapezoidal updates and data-dependent rotations of B and C

Lahoti et al., 2026. Mamba-3: Improved Sequence Modeling using State Space Principles. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

Mamba-2selective state space with a scalar decay per head, in Mamba blocks

Dao and Gu, 2024. Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality. Proceedings of the 41st International Conference on Machine Learning.

The implementation comes with the benchmark's release.

Mixture-of-Memoriesa router writes each token into only some of several memories

Du et al., 2026. MoM: Linear Sequence Modeling with Mixture-of-Memories. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

MesaNetreads the regularised least-squares fit of the context, solved by conjugate gradient

von Oswald et al., 2026. MesaNet: Sequence Modeling by Locally Optimal Test-Time Training. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

OmegaNetpolynomial-feature memory trained online on the last few tokens

Behrouz et al., 2025. ATLAS: Learning to Optimally Memorize the Context at Test Time. arXiv preprint.

The implementation comes with the benchmark's release.

Gated Slot Attentiona fixed set of gated memory slots read through a softmax

Zhang et al., 2024. Gated Slot Attention for Efficient Linear-Time Sequence Modeling. Advances in Neural Information Processing Systems.

The implementation comes with the benchmark's release.

TTT-Linearthe state is a linear model trained online by gradient descent

Sun et al., 2025. Learning to (Learn at Test Time): RNNs with Expressive Hidden States. Proceedings of the 42nd International Conference on Machine Learning.

The implementation comes with the benchmark's release.

GLAlinear attention with a data-dependent forget gate on each key channel

Yang et al., 2024. Gated Linear Attention Transformers with Hardware-Efficient Training. Proceedings of the 41st International Conference on Machine Learning.

The implementation comes with the benchmark's release.

In-Place TTTsliding-window attention plus an MLP down-projection updated as fast weights

Feng et al., 2026. In-Place Test-Time Training. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

IP-TTCDfast-weight MLP updated to distil wide-window attention into a narrow one

Wang et al., 2026. Learning What to Remember: Test-Time Training via Context Distillation. arXiv preprint.

The implementation comes with the benchmark's release.

Linear Transformera kernel feature map replaces softmax, and the state never forgets

Katharopoulos et al., 2020. Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention. Proceedings of the 37th International Conference on Machine Learning.

The implementation comes with the benchmark's release.

The environment

A method writes the token mixer of every layer: how its fixed-size recurrent state is organised, written and read, and, where it needs them, its own block, depth, MLP width and parameter groups. The GPT pipeline on FineWeb, the parameter count, the model-wide state budget and the training tokens stay fixed.

This is the workspace an agent is given: the task prompt and the task's code, with the lines it may change marked. Its submission is the code it leaves in those lines.

Workspace

The task prompt

The task prompt

The task prompt and the task's code come with the benchmark's release.

Results

The scored settings

  1. ① 124M FineWeb pretraining · 4k context · validation, WikiText-2 and LAMBADA
  2. ② Same checkpoint · 16k-window validation / WikiText-2
  3. ③ Same checkpoint · SQuAD completion + RULER needle recall at 4k and 16k

The order

Every method of the task, best first, with its task score out of 100.

  1. Claude Fable 5.234.1
  2. GPT-6.2 Astra27.4
  3. Kimi K3.1 Pro25.7
  4. Comba best published method24.6
  5. Gated DeltaNet-224.1
  6. Claude Opus 5.524.1
  7. Kimi Delta Attention23.5
  8. Mamba-3 MIMO23.0
  9. Gemini 4 Carbon22.0
  10. RWKV-721.4
  11. Gated DeltaNet21.1
  12. Qwen4-Max20.4
  13. Muse Wonder Full19.7
  14. Mamba-318.1
  15. Mamba-216.5
  16. Mixture-of-Memories14.1
  17. MesaNet13.7
  18. OmegaNet11.3
  19. Gated Slot Attention9.4
  20. TTT-Linear7.9
  21. GLA7.3
  22. In-Place TTT6.5
  23. IP-TTCD4.0
  24. Linear Transformer1.6

The measurements

Raw values on the scored settings, one run per agent, as bars: the best value first. Each chart says which direction is better.

Claude Fable 5.2Claude Opus 5.5GPT-6.2 AstraGemini 4 CarbonMuse Wonder FullKimi K3.1 ProQwen4-Maxpublished methodsthe best published method of the task

Validation loss ↓ lower is better

Next-token cross-entropy on FineWeb validation text at the training context.

① 124M FineWeb pretraininglower is better ↓
Claude Fable 5.23.243
Mamba-3 MIMO3.273
GPT-6.2 Astra3.277
Gated DeltaNet-23.283
Kimi K3.1 Pro3.287
Kimi Delta Attention3.290
Claude Opus 5.53.292
Comba3.296
RWKV-73.296
Gemini 4 Carbon3.296
Mamba-33.300
Mamba-23.301
Gated DeltaNet3.314
Muse Wonder Full3.318
Qwen4-Max3.328
3.2013.328

The bars start at 3.201, not at zero.

9 more reference methods are in the numbers below.

The numbers
Method①
Claude Fable 5.23.243
GPT-6.2 Astra3.277
Kimi K3.1 Pro3.287
Comba3.296
Gated DeltaNet-23.283
Claude Opus 5.53.292
Kimi Delta Attention3.290
Mamba-3 MIMO3.273
Gemini 4 Carbon3.296
RWKV-73.296
Gated DeltaNet3.314
Qwen4-Max3.328
Muse Wonder Full3.318
Mamba-33.300
Mamba-23.301
Mixture-of-Memories3.369
MesaNet3.379
OmegaNet3.402
Gated Slot Attention3.406
TTT-Linear3.416
GLA3.407
In-Place TTT3.400
IP-TTCD3.443
Linear Transformer3.976

WikiText-2 perplexity ↓ lower is better

Perplexity on WikiText-2 text at the training context.

① 124M FineWeb pretraininglower is better ↓
Claude Fable 5.228.85
Gated DeltaNet-231.63
Kimi K3.1 Pro31.67
GPT-6.2 Astra32.00
Claude Opus 5.532.10
Comba32.13
Gemini 4 Carbon32.38
Kimi Delta Attention32.47
Mamba-3 MIMO32.60
Muse Wonder Full32.68
Gated DeltaNet33.19
RWKV-733.48
Mamba-334.02
Qwen4-Max34.34
MesaNet36.09
036.09

9 more reference methods are in the numbers below.

The numbers
Method①
Claude Fable 5.228.85
GPT-6.2 Astra32.00
Kimi K3.1 Pro31.67
Comba32.13
Gated DeltaNet-231.63
Claude Opus 5.532.10
Kimi Delta Attention32.47
Mamba-3 MIMO32.60
Gemini 4 Carbon32.38
RWKV-733.48
Gated DeltaNet33.19
Qwen4-Max34.34
Muse Wonder Full32.68
Mamba-334.02
Mamba-236.73
Mixture-of-Memories36.95
MesaNet36.09
OmegaNet39.14
Gated Slot Attention41.27
TTT-Linear39.08
GLA41.98
In-Place TTT40.49
IP-TTCD46.75
Linear Transformer86.42

LAMBADA perplexity ↓ lower is better

Perplexity on the LAMBADA word-prediction benchmark.

① 124M FineWeb pretraininglower is better ↓
Claude Fable 5.238.11
Kimi K3.1 Pro39.15
Gated DeltaNet-239.76
Comba40.09
Mamba-3 MIMO40.48
GPT-6.2 Astra40.64
Kimi Delta Attention40.64
Claude Opus 5.540.70
Gated DeltaNet40.80
RWKV-740.83
Gemini 4 Carbon41.24
Qwen4-Max41.76
Mixture-of-Memories41.88
Mamba-342.16
Muse Wonder Full43.60
35.3643.60

The bars start at 35.36, not at zero.

9 more reference methods are in the numbers below.

The numbers
Method①
Claude Fable 5.238.11
GPT-6.2 Astra40.64
Kimi K3.1 Pro39.15
Comba40.09
Gated DeltaNet-239.76
Claude Opus 5.540.70
Kimi Delta Attention40.64
Mamba-3 MIMO40.48
Gemini 4 Carbon41.24
RWKV-740.83
Gated DeltaNet40.80
Qwen4-Max41.76
Muse Wonder Full43.60
Mamba-342.16
Mamba-242.22
Mixture-of-Memories41.88
MesaNet44.55
OmegaNet44.87
Gated Slot Attention44.65
TTT-Linear44.01
GLA44.39
In-Place TTT42.25
IP-TTCD43.61
Linear Transformer68.01

Long-window validation loss ↓ lower is better

Next-token cross-entropy of the same checkpoint on validation windows four times the training context.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Fable 5.23.186
Mamba-3 MIMO3.220
GPT-6.2 Astra3.223
Gated DeltaNet-23.230
Kimi K3.1 Pro3.232
Kimi Delta Attention3.236
Claude Opus 5.53.238
Gemini 4 Carbon3.242
Comba3.243
RWKV-73.244
Mamba-33.248
Mamba-23.250
Gated DeltaNet3.260
Muse Wonder Full3.264
Qwen4-Max3.274
3.1423.274

The bars start at 3.142, not at zero.

9 more reference methods are in the numbers below.

The numbers
Method②
Claude Fable 5.23.186
GPT-6.2 Astra3.223
Kimi K3.1 Pro3.232
Comba3.243
Gated DeltaNet-23.230
Claude Opus 5.53.238
Kimi Delta Attention3.236
Mamba-3 MIMO3.220
Gemini 4 Carbon3.242
RWKV-73.244
Gated DeltaNet3.260
Qwen4-Max3.274
Muse Wonder Full3.264
Mamba-33.248
Mamba-23.250
Mixture-of-Memories3.318
MesaNet3.326
OmegaNet3.349
Gated Slot Attention3.354
TTT-Linear3.477
GLA3.358
In-Place TTT3.372
IP-TTCD6.330
Linear Transformer6.423

Long-window tail loss ↓ lower is better

Cross-entropy on the late positions of the long validation windows.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Fable 5.23.178
Mamba-3 MIMO3.212
GPT-6.2 Astra3.218
Gated DeltaNet-23.223
Kimi K3.1 Pro3.223
Kimi Delta Attention3.227
Claude Opus 5.53.230
Gemini 4 Carbon3.232
Comba3.235
RWKV-73.235
Mamba-23.239
Mamba-33.243
Gated DeltaNet3.253
Muse Wonder Full3.256
Qwen4-Max3.266
3.1343.266

The bars start at 3.134, not at zero.

9 more reference methods are in the numbers below.

The numbers
Method②
Claude Fable 5.23.178
GPT-6.2 Astra3.218
Kimi K3.1 Pro3.223
Comba3.235
Gated DeltaNet-23.223
Claude Opus 5.53.230
Kimi Delta Attention3.227
Mamba-3 MIMO3.212
Gemini 4 Carbon3.232
RWKV-73.235
Gated DeltaNet3.253
Qwen4-Max3.266
Muse Wonder Full3.256
Mamba-33.243
Mamba-23.239
Mixture-of-Memories3.308
MesaNet3.317
OmegaNet3.339
Gated Slot Attention3.342
TTT-Linear3.657
GLA3.348
In-Place TTT3.407
IP-TTCD12.14
Linear Transformer8.181

Long-window WikiText-2 loss ↓ lower is better

Cross-entropy on WikiText-2 text in windows four times the training context.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Fable 5.23.278
GPT-6.2 Astra3.391
Gated DeltaNet-23.392
Kimi K3.1 Pro3.396
Claude Opus 5.53.398
Comba3.410
Gemini 4 Carbon3.415
Kimi Delta Attention3.416
Mamba-3 MIMO3.430
Muse Wonder Full3.432
Gated DeltaNet3.443
RWKV-73.455
Qwen4-Max3.477
Mamba-33.480
MesaNet3.526
3.1533.526

The bars start at 3.153, not at zero.

9 more reference methods are in the numbers below.

The numbers
Method②
Claude Fable 5.23.278
GPT-6.2 Astra3.391
Kimi K3.1 Pro3.396
Comba3.410
Gated DeltaNet-23.392
Claude Opus 5.53.398
Kimi Delta Attention3.416
Mamba-3 MIMO3.430
Gemini 4 Carbon3.415
RWKV-73.455
Gated DeltaNet3.443
Qwen4-Max3.477
Muse Wonder Full3.432
Mamba-33.480
Mamba-23.564
Mixture-of-Memories3.560
MesaNet3.526
OmegaNet3.612
Gated Slot Attention3.681
TTT-Linear3.687
GLA3.698
In-Place TTT4.204
IP-TTCD4.212
Linear Transformer6.288

SQuAD answer accuracy ↑ higher is better

Accuracy of completing SQuAD answers from the passage given in the context.

③ Same checkpointhigher is better ↑
Claude Fable 5.223.66
Kimi K3.1 Pro21.18
Claude Opus 5.520.07
Gated DeltaNet-219.81
Muse Wonder Full19.64
Comba19.64
Kimi Delta Attention19.40
Gemini 4 Carbon18.60
Mamba-3 MIMO18.23
Gated DeltaNet17.53
Qwen4-Max17.39
Mamba-317.36
RWKV-716.49
MesaNet16.09
023.66

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Fable 5.223.66
Kimi K3.1 Pro21.18
Comba19.64
Gated DeltaNet-219.81
Claude Opus 5.520.07
Kimi Delta Attention19.40
Mamba-3 MIMO18.23
Gemini 4 Carbon18.60
RWKV-716.49
Gated DeltaNet17.53
Qwen4-Max17.39
Muse Wonder Full19.64
Mamba-317.36
Mamba-213.67
Mixture-of-Memories14.14
MesaNet16.09
OmegaNet13.34
Gated Slot Attention11.33
TTT-Linear13.34
GLA14.18
In-Place TTT13.64
IP-TTCD13.14
Linear Transformer3.820

RULER S-NIAH-2 NLL ↓ lower is better

Per-token negative log-likelihood of the retrieved needle in the RULER S-NIAH-2 single-needle task.

③ Same checkpointlower is better ↓
Claude Fable 5.22.971
GPT-6.2 Astra2.987
Claude Opus 5.53.811
Muse Wonder Full3.912
Gemini 4 Carbon3.969
Qwen4-Max4.135
MesaNet4.184
Mamba-3 MIMO4.299
Comba4.320
Kimi K3.1 Pro4.321
Kimi Delta Attention4.379
Mixture-of-Memories4.432
Gated DeltaNet-24.613
Gated DeltaNet4.616
RWKV-74.734
04.734

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Fable 5.22.971
GPT-6.2 Astra2.987
Kimi K3.1 Pro4.321
Comba4.320
Gated DeltaNet-24.613
Claude Opus 5.53.811
Kimi Delta Attention4.379
Mamba-3 MIMO4.299
Gemini 4 Carbon3.969
RWKV-74.734
Gated DeltaNet4.616
Qwen4-Max4.135
Muse Wonder Full3.912
Mamba-35.562
Mamba-25.939
Mixture-of-Memories4.432
MesaNet4.184
OmegaNet5.282
Gated Slot Attention4.791
TTT-Linear6.012
GLA6.065
In-Place TTT5.262
IP-TTCD6.414
Linear Transformer8.257

RULER S-NIAH-3 NLL ↓ lower is better

Per-token negative log-likelihood of the retrieved needle in the RULER S-NIAH-3 single-needle task.

③ Same checkpointlower is better ↓
Claude Fable 5.20.520
GPT-6.2 Astra0.544
Muse Wonder Full2.182
Claude Opus 5.52.373
Comba2.488
Kimi Delta Attention2.671
Mamba-3 MIMO2.774
MesaNet2.871
Gated DeltaNet2.873
Gated DeltaNet-22.886
Gemini 4 Carbon2.905
Qwen4-Max2.925
Kimi K3.1 Pro2.970
Mixture-of-Memories3.137
RWKV-73.291
03.291

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Fable 5.20.520
GPT-6.2 Astra0.544
Kimi K3.1 Pro2.970
Comba2.488
Gated DeltaNet-22.886
Claude Opus 5.52.373
Kimi Delta Attention2.671
Mamba-3 MIMO2.774
Gemini 4 Carbon2.905
RWKV-73.291
Gated DeltaNet2.873
Qwen4-Max2.925
Muse Wonder Full2.182
Mamba-33.583
Mamba-24.079
Mixture-of-Memories3.137
MesaNet2.871
OmegaNet3.307
Gated Slot Attention3.983
TTT-Linear4.065
GLA4.208
In-Place TTT3.684
IP-TTCD4.665
Linear Transformer5.434

What the agents built

One run per model.

Claude Fable 5.2in Claude Code
above the best published method

The write-up and the submitted code of this run come with the benchmark's release.

Claude Opus 5.5in Claude Code
below the best published method

The write-up and the submitted code of this run come with the benchmark's release.

GPT-6.2 Astrain Codex CLI
above the best published method

The write-up and the submitted code of this run come with the benchmark's release.

Gemini 4 Carbonin Antigravity
below the best published method

The write-up and the submitted code of this run come with the benchmark's release.

Muse Wonder Fullin Muse Code
below the best published method

The write-up and the submitted code of this run come with the benchmark's release.

Kimi K3.1 Proin Kimi Code
above the best published method

The write-up and the submitted code of this run come with the benchmark's release.

Qwen4-Maxin Claude Code
below the best published method

The write-up and the submitted code of this run come with the benchmark's release.