FantasticML

Tasks

Language models

Hybrid Architectures

Which layers should remember every token exactly, and which compress, under a fixed memory budget?

2 of 7 agents stand above the best published method, iRoPE

Collage for Hybrid Architectures

The question

Under a fixed inference-state budget, decide where a stack keeps exact (attention KV) and where compressed (recurrent state, local window) sequence memory, composing the built-in mixers or writing new mixers and fuses, for quality, recall, length generalisation and measured inference cost.

Built on
karpathy/nanoGPT
Reference methods
16 implementations of published methods
Scored settings
5
Verifying one submission
2×H200, 3.1 h, 6.3 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.

iRoPEiRoPE layout with L2 query-key norm and grouped-query attentionbest published method

AI, 2025. The Llama 4 Herd: The Beginning of a New Era of Natively Multimodal AI Innovation. Meta AI.

The implementation comes with the benchmark's release.

iRoPE, without QK normchunked RoPE attention interleaved with position-free, temperature-scaled global attention

AI, 2025. The Llama 4 Herd: The Beginning of a New Era of Natively Multimodal AI Innovation. Meta AI.

The implementation comes with the benchmark's release.

Gemma 3the 5:1 rule of short local windows to global attention layers

Team et al., 2025. Gemma 3 Technical Report. arXiv preprint.

The implementation comes with the benchmark's release.

Samba, Mamba-1Samba's alternation with its own Mamba-1 layers and SwiGLU MLPs

Ren et al., 2025. Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

Jambarare position-free full attention among mostly Gated DeltaNet layers

Lieber et al., 2024. Jamba: A Hybrid Transformer-Mamba Language Model. arXiv preprint.

The implementation comes with the benchmark's release.

Nemotron-Hseparate Mamba-2 and MLP sub-layers, with a few attention sub-layers

NVIDIA et al., 2025. Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models. arXiv preprint.

The implementation comes with the benchmark's release.

Qwen3-Next, gated attentionthe 3:1 layout with output-gated attention and wider DeltaNet values

Qiu et al., 2025. Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free. Advances in Neural Information Processing Systems.

The implementation comes with the benchmark's release.

Sambaalternates Gated DeltaNet and sliding-window layers, with no global attention

Ren et al., 2025. Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

All Gated DeltaNetGated DeltaNet recurrence in every layer, no attention at all

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.

Jamba, Mamba-1Jamba's rule with its own normalised Mamba-1 layers and grouped-query attention

Lieber et al., 2024. Jamba: A Hybrid Transformer-Mamba Language Model. arXiv preprint.

The implementation comes with the benchmark's release.

Qwen3-Nextthe 3:1 rule of Gated DeltaNet to full-attention layers

Team, 2025. Qwen3-Next-80B-A3B-Instruct.

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

Wang et al., 2026. A Systematic Analysis of Hybrid Linear Attention. arXiv preprint.

The implementation comes with the benchmark's release.

Falcon-H1attention and Mamba-2 run in parallel in every layer, outputs summed

Zuo et al., 2025. Falcon-H1: A Family of Hybrid-Head Language Models Redefining Efficiency and Performance. arXiv preprint.

The implementation comes with the benchmark's release.

SWAN-GPTposition-free global attention interleaved with RoPE sliding-window layers

Puvvada et al., 2025. SWAN: An Efficient and Scalable Approach for Long-Context Language Modeling. Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing.

The implementation comes with the benchmark's release.

Hymbaattention heads and Mamba heads in parallel inside every layer

Dong et al., 2025. Hymba: A Hybrid-head Architecture for Small Language Models. International Conference on Learning Representations.

The implementation comes with the benchmark's release.

gpt-ossalternating short banded and dense attention, all with attention sinks

OpenAI et al., 2025. gpt-oss-120b & gpt-oss-20b Model Card. arXiv preprint.

The implementation comes with the benchmark's release.

All attentionfull attention in every layer, the exact-memory reference beyond the budget

The implementation comes with the benchmark's release.

The starter and the controls

All sliding-window attentionsliding-window attention in every layer: exact memory, but only localstarter

The implementation comes with the benchmark's release.

The environment

A method writes the layer composition of a 12-layer GPT-2-sized language model, choosing for each layer or sub-layer which token mixer it uses and with which options, from full, sliding-window or chunked attention, Gated DeltaNet, Mamba-1 and Mamba-2, parallel branches or a mixer of its own, plus the peak learning rate. The mixer implementations, training data, token budget and the rest of the recipe are fixed, and the stack's inference state at 32K tokens must fit one fixed budget.

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 training context + LAMBADA
  2. ② Same checkpoint · 16k-window validation / WikiText-2
  3. ③ SQuAD completion + four near/far RULER needle-recall measures, far needles at 16k
  4. ④ Measured inference cost · 16k prefill vs an all-attention stack, fused kernels, quality guard
  5. ⑤ Long-context inference measurements · 32k prefill and decode after a 32k prompt at a fixed state-memory budget (report only)

The order

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

  1. Claude Opus 5.533.9
  2. Muse Wonder Full33.2
  3. iRoPE best published method32.3
  4. Kimi K3.1 Pro31.8
  5. iRoPE, without QK norm31.1
  6. Gemini 4 Carbon30.7
  7. GPT-6.2 Astra30.7
  8. Claude Fable 5.230.6
  9. Gemma 330.2
  10. Samba, Mamba-129.7
  11. Jamba29.7
  12. Nemotron-H29.4
  13. Qwen3-Next, gated attention29.4
  14. Qwen4-Max29.3
  15. Samba29.2
  16. All Gated DeltaNet28.9
  17. All sliding-window attention starter28.6
  18. Jamba, Mamba-128.4
  19. Qwen3-Next27.6
  20. Falcon-H127.5
  21. SWAN-GPT27.3
  22. Hymba26.7
  23. gpt-oss25.2
  24. All attention16.1

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 of the pretrained model on FineWeb validation text at the 4k training context.

① 124M FineWeb pretraining · 4k training context + LAMBADAlower is better ↓
Muse Wonder Full3.233
Claude Opus 5.53.287
Claude Fable 5.23.314
Qwen3-Next, gated attention3.334
Hymba3.335
Kimi K3.1 Pro3.336
Qwen4-Max3.339
Samba, Mamba-13.350
GPT-6.2 Astra3.369
Nemotron-H3.373
Falcon-H13.380
Qwen3-Next3.393
Jamba, Mamba-13.394
Samba3.401
iRoPE3.514
3.0923.514

The bars start at 3.092, not at zero.

8 more reference methods are in the numbers below.

The numbers
Method①
Claude Opus 5.53.287
Muse Wonder Full3.233
iRoPE3.514
Kimi K3.1 Pro3.336
iRoPE, without QK norm3.473
GPT-6.2 Astra3.369
Claude Fable 5.23.314
Gemma 33.433
Samba, Mamba-13.350
Jamba3.418
Nemotron-H3.373
Qwen3-Next, gated attention3.334
Qwen4-Max3.339
Samba3.401
All Gated DeltaNet3.434
All sliding-window attention3.486
Jamba, Mamba-13.394
Qwen3-Next3.393
Falcon-H13.380
SWAN-GPT3.503
Hymba3.335
gpt-oss3.465
All attention3.492

LAMBADA perplexity ↓ lower is better

Perplexity of the pretrained model on LAMBADA passages.

① 124M FineWeb pretraining · 4k training context + LAMBADAlower is better ↓
Muse Wonder Full39.05
Claude Opus 5.540.35
Hymba40.83
Claude Fable 5.241.04
Qwen3-Next, gated attention41.75
Qwen4-Max41.91
GPT-6.2 Astra41.95
Samba, Mamba-142.50
Jamba42.68
Nemotron-H43.04
Qwen3-Next43.07
Falcon-H143.75
Jamba, Mamba-143.81
iRoPE48.52
048.52

8 more reference methods are in the numbers below.

The numbers
Method①
Claude Opus 5.540.35
Muse Wonder Full39.05
iRoPE48.52
iRoPE, without QK norm46.92
GPT-6.2 Astra41.95
Claude Fable 5.241.04
Gemma 345.27
Samba, Mamba-142.50
Jamba42.68
Nemotron-H43.04
Qwen3-Next, gated attention41.75
Qwen4-Max41.91
Samba44.61
All Gated DeltaNet44.73
All sliding-window attention47.47
Jamba, Mamba-143.81
Qwen3-Next43.07
Falcon-H143.75
SWAN-GPT48.49
Hymba40.83
gpt-oss47.32
All attention47.65

Validation loss, 16k window ↓ lower is better

Next-token cross-entropy on validation text read in 16k-token windows, four times the training context.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Opus 5.53.236
Claude Fable 5.23.256
Samba, Mamba-13.293
Hymba3.293
Muse Wonder Full3.302
GPT-6.2 Astra3.329
Qwen4-Max3.337
Samba3.345
Qwen3-Next, gated attention3.349
Kimi K3.1 Pro3.353
Jamba3.364
All Gated DeltaNet3.382
Gemma 33.407
All sliding-window attention3.429
iRoPE3.549
3.0803.549

The bars start at 3.080, not at zero.

8 more reference methods are in the numbers below.

The numbers
Method②
Claude Opus 5.53.236
Muse Wonder Full3.302
iRoPE3.549
Kimi K3.1 Pro3.353
iRoPE, without QK norm3.566
GPT-6.2 Astra3.329
Claude Fable 5.23.256
Gemma 33.407
Samba, Mamba-13.293
Jamba3.364
Nemotron-H3.446
Qwen3-Next, gated attention3.349
Qwen4-Max3.337
Samba3.345
All Gated DeltaNet3.382
All sliding-window attention3.429
Jamba, Mamba-13.514
Qwen3-Next3.608
Falcon-H13.630
SWAN-GPT3.451
Hymba3.293
gpt-oss3.853
All attention5.331

Tail loss, 16k window ↓ lower is better

Next-token cross-entropy on the final positions of each 16k-token validation window.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Opus 5.53.240
Claude Fable 5.23.251
Samba, Mamba-13.285
Hymba3.303
Samba3.340
GPT-6.2 Astra3.343
Jamba3.357
All Gated DeltaNet3.372
Qwen3-Next, gated attention3.419
All sliding-window attention3.421
Muse Wonder Full3.424
Gemma 33.430
Qwen4-Max3.490
iRoPE3.670
3.0243.670

The bars start at 3.024, not at zero.

8 more reference methods are in the numbers below.

The numbers
Method②
Claude Opus 5.53.240
Muse Wonder Full3.424
iRoPE3.670
iRoPE, without QK norm3.763
GPT-6.2 Astra3.343
Claude Fable 5.23.251
Gemma 33.430
Samba, Mamba-13.285
Jamba3.357
Nemotron-H3.648
Qwen3-Next, gated attention3.419
Qwen4-Max3.490
Samba3.340
All Gated DeltaNet3.372
All sliding-window attention3.421
Jamba, Mamba-13.718
Qwen3-Next4.133
Falcon-H13.868
SWAN-GPT3.444
Hymba3.303
gpt-oss4.213
All attention6.657

SQuAD answer score ↑ higher is better

How often the model completes the answer to a SQuAD question correctly from the passage in its context.

③ SQuAD completion + four near/far RULER needle-recall measures,…higher is better ↑
Muse Wonder Full27.78
Qwen3-Next, gated attention26.51
Samba, Mamba-125.23
Claude Opus 5.525.00
Kimi K3.1 Pro24.06
Claude Fable 5.223.69
Falcon-H123.46
iRoPE, without QK norm22.99
Hymba22.86
Qwen3-Next22.69
Samba22.45
Nemotron-H22.39
iRoPE22.22
027.78

8 more reference methods are in the numbers below.

The numbers
Method③
Claude Opus 5.525.00
Muse Wonder Full27.78
iRoPE22.22
Kimi K3.1 Pro24.06
iRoPE, without QK norm22.99
Claude Fable 5.223.69
Gemma 319.77
Samba, Mamba-125.23
Jamba17.73
Nemotron-H22.39
Qwen3-Next, gated attention26.51
Samba22.45
All Gated DeltaNet12.67
All sliding-window attention19.14
Jamba, Mamba-121.85
Qwen3-Next22.69
Falcon-H123.46
SWAN-GPT17.79
Hymba22.86
gpt-oss21.78
All attention19.67

S-NIAH-1 answer NLL ↓ lower is better

Negative log-likelihood of the planted answer in the RULER single-needle task S-NIAH-1, with the needle at a near distance.

③ SQuAD completion + four near/far RULER needle-recall measures,…lower is better ↓
Muse Wonder Full1.086
Claude Opus 5.51.246
Falcon-H11.294
iRoPE1.501
GPT-6.2 Astra1.969
Nemotron-H2.005
Qwen3-Next2.143
Kimi K3.1 Pro2.452
iRoPE, without QK norm2.505
Jamba, Mamba-12.740
Claude Fable 5.23.113
All Gated DeltaNet3.153
Jamba3.367
03.367

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Opus 5.51.246
Muse Wonder Full1.086
iRoPE1.501
Kimi K3.1 Pro2.452
iRoPE, without QK norm2.505
GPT-6.2 Astra1.969
Claude Fable 5.23.113
Gemma 33.415
Samba, Mamba-14.313
Jamba3.367
Nemotron-H2.005
Qwen3-Next, gated attention3.803
Samba4.404
All Gated DeltaNet3.153
All sliding-window attention4.931
Jamba, Mamba-12.740
Qwen3-Next2.143
Falcon-H11.294
SWAN-GPT6.593
Hymba4.803
gpt-oss3.374
All attention4.814

S-NIAH-2 answer NLL ↓ lower is better

Negative log-likelihood of the planted answer in the RULER single-needle task S-NIAH-2, with the needle at a near distance.

③ SQuAD completion + four near/far RULER needle-recall measures,…lower is better ↓
Muse Wonder Full0.871
iRoPE1.670
Qwen3-Next, gated attention2.042
Claude Opus 5.52.339
Falcon-H12.340
Kimi K3.1 Pro2.402
iRoPE, without QK norm2.476
Nemotron-H2.562
Qwen3-Next2.585
Jamba, Mamba-12.665
Claude Fable 5.22.777
GPT-6.2 Astra2.827
Gemma 33.054
03.054

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Opus 5.52.339
Muse Wonder Full0.871
iRoPE1.670
Kimi K3.1 Pro2.402
iRoPE, without QK norm2.476
GPT-6.2 Astra2.827
Claude Fable 5.22.777
Gemma 33.054
Samba, Mamba-14.628
Jamba3.639
Nemotron-H2.562
Qwen3-Next, gated attention2.042
Samba5.129
All Gated DeltaNet5.105
All sliding-window attention5.137
Jamba, Mamba-12.665
Qwen3-Next2.585
Falcon-H12.340
SWAN-GPT6.114
Hymba5.220
gpt-oss3.692
All attention5.039

S-NIAH-1 answer NLL, 16k ↓ lower is better

Negative log-likelihood of the planted answer in S-NIAH-1 with the needle far back in a 16k-token context.

③ SQuAD completion + four near/far RULER needle-recall measures,…lower is better ↓
Claude Opus 5.51.173
Muse Wonder Full1.790
GPT-6.2 Astra1.970
Kimi K3.1 Pro2.485
iRoPE2.523
iRoPE, without QK norm3.130
Claude Fable 5.23.698
Qwen3-Next, gated attention4.495
All Gated DeltaNet4.668
Falcon-H14.706
Jamba5.085
Nemotron-H6.151
Gemma 36.550
06.550

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Opus 5.51.173
Muse Wonder Full1.790
iRoPE2.523
Kimi K3.1 Pro2.485
iRoPE, without QK norm3.130
GPT-6.2 Astra1.970
Claude Fable 5.23.698
Gemma 36.550
Samba, Mamba-17.169
Jamba5.085
Nemotron-H6.151
Qwen3-Next, gated attention4.495
Samba7.062
All Gated DeltaNet4.668
All sliding-window attention7.227
Jamba, Mamba-17.356
Qwen3-Next7.114
Falcon-H14.706
SWAN-GPT7.126
Hymba7.800
gpt-oss7.751
All attention11.00

S-NIAH-2 answer NLL, 16k ↓ lower is better

Negative log-likelihood of the planted answer in S-NIAH-2 with the needle far back in a 16k-token context.

③ SQuAD completion + four near/far RULER needle-recall measures,…lower is better ↓
iRoPE2.345
Claude Opus 5.52.586
Qwen3-Next, gated attention2.836
GPT-6.2 Astra2.935
Kimi K3.1 Pro2.974
Claude Fable 5.23.041
iRoPE, without QK norm3.220
Muse Wonder Full3.579
Qwen3-Next4.624
Jamba5.288
Falcon-H15.744
Nemotron-H6.200
SWAN-GPT7.121
07.121

9 more reference methods are in the numbers below.

The numbers
Method③
Claude Opus 5.52.586
Muse Wonder Full3.579
iRoPE2.345
Kimi K3.1 Pro2.974
iRoPE, without QK norm3.220
GPT-6.2 Astra2.935
Claude Fable 5.23.041
Gemma 37.671
Samba, Mamba-17.426
Jamba5.288
Nemotron-H6.200
Qwen3-Next, gated attention2.836
Samba7.598
All Gated DeltaNet7.407
All sliding-window attention7.902
Jamba, Mamba-17.275
Qwen3-Next4.624
Falcon-H15.744
SWAN-GPT7.121
Hymba8.092
gpt-oss8.232
All attention11.35

Relative prefill time ↓ lower is better

Measured prefill time at long context divided by that of an all-attention stack, both with fused kernels.

④ Measured inference costlower is better ↓
Gemma 30.496
All sliding-window attention0.514
iRoPE, without QK norm0.527
SWAN-GPT0.561
iRoPE0.563
Samba0.566
Samba, Mamba-10.594
All Gated DeltaNet0.640
Kimi K3.1 Pro0.745
Qwen4-Max0.869
Claude Opus 5.50.870
Claude Fable 5.20.941
GPT-6.2 Astra1.110
Muse Wonder Full1.190
01.190

9 more reference methods are in the numbers below.

The numbers
Method④
Claude Opus 5.50.870
Muse Wonder Full1.190
iRoPE0.563
Kimi K3.1 Pro0.745
iRoPE, without QK norm0.527
GPT-6.2 Astra1.110
Claude Fable 5.20.941
Gemma 30.496
Samba, Mamba-10.594
Jamba0.666
Nemotron-H0.703
Qwen3-Next, gated attention1.083
Qwen4-Max0.869
Samba0.566
All Gated DeltaNet0.640
All sliding-window attention0.514
Jamba, Mamba-10.656
Qwen3-Next0.735
Falcon-H11.021
SWAN-GPT0.561
Hymba2.191
gpt-oss0.678
All attention0.999

WikiText-2 perplexity ↓ lower is better

Perplexity of the pretrained model on WikiText-2.

① 124M FineWeb pretraining · 4k training context + LAMBADAlower is better ↓
Muse Wonder Full28.80
Claude Opus 5.531.00
Qwen3-Next, gated attention32.96
Qwen4-Max33.72
Hymba34.44
Samba, Mamba-134.49
GPT-6.2 Astra35.04
Nemotron-H35.35
Falcon-H135.72
Samba36.35
Qwen3-Next36.92
Jamba, Mamba-137.20
iRoPE41.58
041.58

8 more reference methods are in the numbers below.

The numbers
Method①
Claude Opus 5.531.00
Muse Wonder Full28.80
iRoPE41.58
iRoPE, without QK norm39.75
GPT-6.2 Astra35.04
Gemma 338.52
Samba, Mamba-134.49
Jamba38.59
Nemotron-H35.35
Qwen3-Next, gated attention32.96
Qwen4-Max33.72
Samba36.35
All Gated DeltaNet40.82
All sliding-window attention40.86
Jamba, Mamba-137.20
Qwen3-Next36.92
Falcon-H135.72
SWAN-GPT45.62
Hymba34.44
gpt-oss40.08
All attention40.93

WikiText-2 loss, 16k window ↓ lower is better

Next-token cross-entropy on WikiText-2 read in 16k-token windows.

② Same checkpoint · 16k-window validation / WikiText-2lower is better ↓
Claude Opus 5.53.361
Muse Wonder Full3.429
GPT-6.2 Astra3.476
Samba, Mamba-13.479
Qwen4-Max3.498
Hymba3.500
Nemotron-H3.515
Qwen3-Next, gated attention3.526
Samba3.535
Jamba3.580
iRoPE, without QK norm3.624
Gemma 33.624
iRoPE3.686
3.1993.686

The bars start at 3.199, not at zero.

8 more reference methods are in the numbers below.

The numbers
Method②
Claude Opus 5.53.361
Muse Wonder Full3.429
iRoPE3.686
iRoPE, without QK norm3.624
GPT-6.2 Astra3.476
Gemma 33.624
Samba, Mamba-13.479
Jamba3.580
Nemotron-H3.515
Qwen3-Next, gated attention3.526
Qwen4-Max3.498
Samba3.535
All Gated DeltaNet3.659
All sliding-window attention3.655
Jamba, Mamba-13.663
Qwen3-Next3.916
Falcon-H13.852
SWAN-GPT3.784
Hymba3.500
gpt-oss4.137
All attention5.889

What the agents built

One run per model.

Claude Fable 5.2in Claude Code
below 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
above 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
below 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
above 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
below 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.