Yggdrasil: Tree-Routed Recurrent Experts for State Tracking and Fast CPU Inference
Organizations: Imperial College London, London, United Kingdom
Abstract
Parallel-trainable recurrences such as Mamba, linear attention, and DeltaNet offer constant-cost streaming inference, but they suffer from two limitations: 1) they struggle to track discrete state, and 2) they read every parameter at every step, tying model capacity directly to CPU latency. We introduce Yggdrasil, a recurrent architecture that decouples capacity from per-step compute by looking up each layer's transition in a large, tree-routed bank of recurrent experts. Each router addresses its bank using the current token and the state of the layer below. We prove that this cross-layer context is necessary---a single token-indexed layer of non-expanding transitions with finitely many reachable states cannot perform conditional resets---while avoiding feedback from the layer's own past preserves parallel-scan training. Because each step traverses one tree path and reads a single expert per layer, active weights stay within a few hundred kilobytes in CPU L2 cache while the full bank resides in RAM. Among the parallel-trainable models we evaluate, Yggdrasil is the only one to solve all five state-tracking tasks. At matched active parameter counts, it achieves the lowest test bits on enwik8 (1.540 bpb) and the human genome hg38 (1.567 bpb), while stepping and faster on a single CPU core ( and ) than the fastest streaming baseline, and delivering the highest GPU throughput of all models at batch 1024. On the Genomic Benchmarks, it is the strongest causal model at matched active parameters (86.0% mean accuracy).
Figures & tables
| Non-solvable | Abelian | Reset | ||||
| Model | Parity | Cycle | Mod. arith. | |||
| ( Merrill et al., 2024 ) | ( Merrill et al., 2024 ) | ( Delétang et al., 2023 ) | ( Delétang et al., 2023 ) | ( Delétang et al., 2023 ) | ||
| Sequential | GRU | 0.979 | 1.000 | 1.000 | 1.000 | 1.000 |
| LSTM | 0.995 | 0.999 | 1.000 | 1.000 | 1.000 | |
| Parallel | Transformer | 0.010 | 0.031 | 0.506 | 0.238 | 0.225 |
| Mamba-2 | 0.010 | 0.017 | 0.569 | 0.650 | 0.395 | |
| Published | ||||
|---|---|---|---|---|
| Task | CNN | HyenaDNA | Mamba | Yggdrasil |
| ( Grešová et al., 2023 ) | ( Schiff et al., 2024 ) | ( Schiff et al., 2024 ) | ( Schiff et al., 2024 ) | |
| Mouse | 71.5 8.7 | 78.0 2.5 | 74.3 5.4 | 74.0 4.1 |
| Coding | 89.2 0.8 | 90.4 0.5 | 90.4 0.4 | 93.4 0.6 |
| Hum./worm | 94.2 0.2 | 96.4 0.2 | 96.7 0.2 | 96.6 0.2 |
| Cohn | 70.2 2.1 | 72.9 1.4 | 73.2 2.9 | 72.9 1.6 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Searched values | enwik8 (sizes) | hg38 (sizes) | State tasks |
|---|---|---|---|---|
| Peak learning rate ( ) | 4.2/8.3/0.84 | 0.86/0.75/0.84 | 5.4/6.7/3.3/15.6/2.8 | |
| Routed-layer learning-rate scale | 1/0.3/1 | 1/1/0.3 | 0.3/0.3/1/1/1 | |
| Router noise | 0.05/0.05/0.1 | 0.05/0.05/0.1 | 0.05/0/0.1/0/0.1 | |
| Backward temperature | – | 0.5 | 0.5 | 0.5 |
| Router top- | 8/8/8 | 8/8/8 | 8/8/4/4/8 | |
| Routed layers | 4 | 4 | 4/2/2/4/4 |
| Task | Models | Search | Final training | Seeds | Evaluation |
|---|---|---|---|---|---|
| enwik8 | Yggdrasil, GRU, LSTM, Mamba-2, Mamba-2 + PKM, Transformer, Gated DeltaNet, DeltaProduct-2/4 | 8 Bayesian trials per size, , 1 seed | 3 | best validation, full test split | |
| hg38 | Yggdrasil, GRU, LSTM, Mamba-2, Mamba-2 + PKM, Transformer, Gated DeltaNet, DeltaProduct-2/4, HyenaDNA | 8 Bayesian trials per size, , 1 seed | 3 | best validation, full test split | |
| State tracking | all models of Table 1 | 8 Bayesian trials per task, size searched, steps of 256 sequences, 1 seed | steps of 256 sequences | 3 | best validation, test lengths 40–256 |
| Ablation | every variant of Tables 9 and 10 | 8 Bayesian trials per variant and task, with the trial length of the full model on that task, 1 seed | as for the full model | 3 | as for the full model |
| Setting | Text and DNA | State tasks |
|---|---|---|
| Learning rate | ||
| Weight decay on matrices | ||
| Layers | fixed | 1 to 4 |
| Width | fixed | |
| Head size, Transformer | fixed | 16 to 128 |
| Model | enwik8 | hg38 |
|---|---|---|
| Small | ||
| Yggdrasil | 4 routed layers, , | 4 routed layers, , |
| GRU | , | , |
| LSTM | , | , |
| Mamba-2 | , , , | , , , |
| Transformer | , , | , , |
| Model | Total | Active | File (MB) | CPU s / token | GPU s / token | Test bits / byte | |
|---|---|---|---|---|---|---|---|
| ( Hutter, 2006 ) | |||||||
| Small, 35k active parameters | |||||||
| Sequential | GRU | 46.5k | 35.3k | 0.2 | 10.0 | 40.0 | 2.371 |
| LSTM | 47.0k | 36.8k | 0.2 | 11.3 | 44.4 | 2.353 | |
| Parallel | Transformer | 43.2k | 35.0k | 0.1 | 64.0 | 193.6 | 2.298 |
| Mamba-2 | 42.6k | 32.4k | 1.0 | 22.9 | 29.3 | 2.436 | |
| Model | Total | Active | File (MB) | CPU s / base | GPU s / base | Test bits / base | |
|---|---|---|---|---|---|---|---|
| ( Kelley et al., 2018 ; Nguyen et al., 2023 ) | |||||||
| Small, 27k active parameters | |||||||
| Sequential | GRU | 28.7k | 28.5k | 0.1 | 9.4 | 46.1 | 1.728 |
| LSTM | 26.6k | 26.5k | 0.1 | 11.1 | 48.2 | 1.726 | |
| Parallel | Transformer | 27.1k | 27.0k | 0.2 | 111.7 | 197.3 | 1.753 |
| Mamba-2 | 29.4k | 29.1k | 0.9 | 21.4 | 28.2 | 1.822 | |
| Variant | Parity | Cycle | Mod. arith. | ||
|---|---|---|---|---|---|
| Full Yggdrasil | 1.000 | 0.980 | 1.000 | 1.000 | 0.981 |
| Pass output, not state | 1.000 | 1.000 | 1.000 | 1.000 | 0.998 |
| Residual stream | 1.000 | 1.000 | 1.000 | 1.000 | 0.800 |
| Router reads output | 1.000 | 1.000 | 1.000 | 1.000 | 0.741 |
| Shared transition | 1.000 | 1.000 | 1.000 | 1.000 | 0.290 |
| Diagonal transitions | 0.016 | 0.016 | 1.000 | 0.918 | 0.370 |
| Variant | enwik8 | hg38 |
|---|---|---|
| Full Yggdrasil | 1.559 | 1.590 |
| Store outputs | 1.803 | 1.689 |
| Route on token only | 1.712 | 1.676 |
| Shared transition | 1.562 | 1.594 |
| Pass output, not state | 1.599 | 1.606 |
| Residual stream | 1.564 | 1.594 |
| Component | Compute | Grows with experts? |
|---|---|---|
| Router traversal (routed layers) | dot products of length | only through |
| Transition (every layer) | multiply-adds | no |
| Token input | one table row per layer | no |
| Layer input (routed layers) | multiply-adds | no |
| Output (every layer) | multiply-adds | no |
| Model | Runtimes tried | Fastest |
|---|---|---|
| Transformer | llama.cpp ( Gerganov and llama.cpp contributors, 2023 ) with Q8_0 or fp32 weights, ONNX Runtime with 8-bit or fp32 weights | ONNX Runtime at five of the six active sizes, llama.cpp Q8_0 at equal stored parameters |
| Mamba-2 | llama.cpp with Q8_0 or fp32 weights | llama.cpp, Q8_0 at equal stored parameters |
| GRU, LSTM | OpenVINO 2026.4 C++ API (GRUCell and LSTMCell on oneDNN, fp32 weights, fp32 or bf16 arithmetic), 8-bit TorchScript step in libtorch, ONNX Runtime with 8-bit or fp32 weights | OpenVINO at every active size, 8-bit libtorch at equal stored parameters except ONNX Runtime for the LSTM at 5M |
| HyenaDNA | libtorch in fp32 or with dynamic 8-bit linear layers | libtorch |
| Data | Size | File (MB) | Read per step (KB) | Warm ( s/tok) | Evicted ( s/tok) |
|---|---|---|---|---|---|
| enwik8 | Small | 154 | 44.2 | 1.50 | 6.93 |
| Medium | 317 | 101.4 | 2.51 | 9.54 | |
| Large | 681 | 280.7 | 6.76 | 17.74 | |
| hg38 | Small | 18 | 29.9 | 1.22 | 6.12 |
| Medium | 48 | 78.1 | 1.91 | 7.78 | |
| Large | 147 | 239.5 | 5.78 | 15.66 |
| Reset | Stream | ||||
|---|---|---|---|---|---|
| Data | Size | Float | 8-bit | Float | 8-bit |
| enwik8 | Small | 1.667 | 1.676 | 1.626 | 1.635 |
| Medium | 1.559 | 1.565 | 1.510 | 1.516 | |
| Large | 1.540 | 1.545 | 1.485 | 1.490 | |
| hg38 | Small | 1.620 | 1.625 | 1.614 | 1.620 |
| Medium | 1.590 | 1.594 | 1.583 | 1.589 | |
| enwik8 ( ) ( Hutter, 2006 ) | hg38 ( ) ( Kelley et al., 2018 ; Nguyen et al., 2023 ) | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Yggdrasil | Speedup over | Yggdrasil | Speedup over | |||||||||||
| Stored params | Active | CPU s | File / Q8_0 | Transf. | Mamba-2 | GRU | LSTM | Active | CPU s | File / Q8_0 | Transf. | Mamba-2 | GRU | LSTM |
| 5M | 56k | 1.02 | 0.98 | 518 | 473 | 174 | 162 | 62k | 0.96 | 0.86 | 1,740 | 421 | 173 | 165 |
| 20M | 123k | 3.15 | 1.07 | 493 | 451 | 166 | 163 | 98k | 2.14 | 0.88 | 2,177 | 555 | 219 | 217 |
| 50M | 102k | 3.76 | 1.16 | 1,178 | 1,480 | 511 | 512 | 81k | 2.25 | 0.87 | 5,332 | 2,219 | 811 | 816 |
| 200M | 103k | 5.45 | 1.16 | 3,311 | 3,895 | 1,805 | 1,812 | 83k | 3.48 | 0.87 | 9,375 | 5,780 | 2,823 | 2,831 |
| enwik8 ( ) | hg38 ( ) | |||||
| Model | Shape | Params | B/p | Shape | Params | B/p |
| 5M | ||||||
| Yggdrasil | 2 routed layers, | 5.5M | 1.05 | 3 routed layers, | 4.9M | 0.92 |
| 1 routed layer, | 5.4M | 1.05 | 1 routed layer, | 6.5M | 0.92 | |
| Transformer | , , head 64 | 5.5M | 1.07 | , , head 64 | 5.0M | 1.06 |
| Mamba-2 | , , , | 5.3M | 1.25 | , , , | 4.9M | 1.25 |
| Batch 1, s / token | Batch 1024, tokens / s | ||||||
| Model | Small | Medium | Large | Small | Medium | Large | |
| enwik8, 35k, 105k and 330k active parameters ( Hutter, 2006 ) | |||||||
| Sequential | GRU | 40.0 | 60.9 | 87.1 | 12.5M | 5.84M | 1.65M |
| LSTM | 44.4 | 52.8 | 125.3 | 11.0M | 5.83M | 889k | |
| Parallel | Transformer | 193.6 | 236.3 | 224.4 | 1.39M | 685k | 398k |
| Mamba-2 | 29.3 | 45.7 | 43.8 | 7.77M | 3.18M | 1.77M | |
| Model | Params | Mouse | Coding | Hum./worm | Cohn | Ensembl | Reg. | OCR | Non-TATA | Mean | |
| ( Grešová et al., 2023 ) | |||||||||||
| CNN ( Schiff et al., 2024 ) | 264k | 71.5 8.7 | 89.2 0.8 | 94.2 0.2 | 70.2 2.1 | 74.4 12.2 | 87.2 0.5 | 69.8 1.3 | 86.1 0.9 | 80.3 | |
| Causal | HyenaDNA ( Schiff et al., 2024 ) | 436k | 78.0 2.5 | 90.4 0.5 | 96.4 0.2 | 72.9 1.4 | 84.9 0.6 | 86.9 1.2 | 78.3 0.7 | 94.4 0.2 | 85.3 |
| Mamba ( Schiff et al., 2024 ) | 468k | 74.3 5.4 | 90.4 0.4 | 96.7 0.2 | 73.2 2.9 | 86.2 0.8 | 81.4 21.1 | 81.5 0.2 | 93.3 0.7 | 84.6 | |
| Yggdrasil | 470k | 74.0 4.1 | 93.4 0.6 | 96.6 0.2 | 72.9 1.6 | 88.2 0.6 | 87.1 1.3 | 79.6 0.5 | 96.0 1.0 | 86.0 | |
| Bidirectional | Caduceus-Ph ( Schiff et al., 2024 ) | 470k | 75.4 7.4 | 91.5 0.3 | 97.3 0.1 | 74.7 0.4 | 89.3 0.8 | 87.2 1.1 | 82.8 0.6 | 94.6 0.7 | 86.6 |