Gated Delta Networks: Improving Mamba2 with Delta Rule
- Publication
- ICLR 2025Conference
- First submitted to arXiv
- arXiv:2412.06464
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{mambagateddeltanet2024,
title = {{Gated Delta Networks: Improving Mamba2 with Delta Rule}},
author = {Songlin Yang and Jan Kautz and Ali Hatamizadeh},
year = {2024},
eprint = {2412.06464},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2412.06464}
}
The subtitle states that this paper uses the delta rule to improve Mamba-2.
The delta rule is nothing new. It goes back to work by Widrow et al. in 1960; in 2021, Schlag et al. brought it into linear attention under the name DeltaNet; and in 2024, others designed an algorithm that lets it train in parallel on GPUs.
The authors are Songlin Yang of MIT CSAIL, together with Jan Kautz and Ali Hatamizadeh of NVIDIA. They observed that Mamba-2 and DeltaNet each solve half of linear attention's problem, and that the two happen to complement each other.
Defining the Problem
Linear Attention Is a Phone Book Where Entries Collide
First, let's write linear attention in recurrent form. Drop the softmax and leave out the normalization and the query/key feature maps; then, each time it reads a token, it writes a “key–value” pair into a matrix state:
To look something up, multiply the state by . Suppose the state starts at zero and all keys are mutually orthogonal with length 1; then querying with returns exactly .
But a -dimensional space has at most mutually orthogonal directions. Once the sequence is longer than , the keys are bound to interfere with one another. The authors call this memory collision, where looking up one key brings back several values piled on top of each other.
Mamba-2: Everything Gets Discounted Together
Mamba-2's approach is to add a data-dependent decay:
Old content gradually fades, so collisions become less severe.
But this decay treats everything the same. To forget one entry, every other entry has to fade along with it.
DeltaNet: Change Only That Entry
DeltaNet writes in a different way. Before writing a new key–value pair, it uses the key to read out the old value, then replaces that value with the new one:
is the write strength. When the key has length 1 and , the old value read with this key is replaced entirely by the new one. Other keys are completely unaffected only if they are orthogonal to it; if they aren't, the values read with them get corrected a little as well.
This is precise, but it can only change one entry at a time. When the context switches and a large amount of old information needs to be cleared at once, DeltaNet can't wipe the slate clean. The authors cite an earlier observation that DeltaNet is strong on synthetic retrieval tasks but merely average on real-world tasks.
Solving the Problem
Three Update Rules, Worked Through
Let's compare the three update rules on a tiny example. The keys are three-dimensional unit vectors, and each value is a single number. We write three entries in order:
- Key , value 5
- Key , value 7
- Key , value changed to 9
At the end, querying should return 9 and querying should return 7. With the two keys as orthogonal unit vectors and the global decay multiplying by 0.5 at each step, the three update rules give the following:
- Linear attention adds together the two values written to and returns 14.
- Uniform decay lets the old 5 fade somewhat and returns 10.25; but also gets discounted to 3.5, even though it did nothing wrong.
- The delta rule first erases 's old value, then writes 9; is left completely untouched.
In this example the keys happen to be orthogonal, which is the most comfortable case for the delta rule. Real models' keys won't be this clean, but the same principle holds, with the delta rule good at precisely changing one entry and decay good at clearing things out on a broad scale.
Combining the Two
The gated delta rule the authors propose simply multiplies the decay back in front of the delta rule:
Each of the two knobs handles one job:
- controls how much of the old state to keep. As it approaches 0, old information is cleared away, leaving only this step's write , which suits a context switch; as it approaches 1, it reduces to the pure delta rule.
- controls how strongly to correct along the current key.
The authors also explain these rules from an online learning perspective, treating every state update as solving a small optimization problem. The objectives behind linear attention and Mamba-2 raise the inner product of and while penalizing the new state for straying too far from the old state (or the discounted old state); the delta rule corresponds to shrinking the squared error between and , taking just one step of gradient descent. The latter is closer to regression, so the stored pairs are less likely to blur together.
Making It Trainable in Parallel
The recurrence is simple to write down, but training on GPUs requires parallelism. Mamba-2's chunked algorithm can handle scalar decay; the delta rule's transition matrix is different at every step, which makes multiplying them together trickier.
Earlier work had already used the WY representation (a technique that compresses a product of Householder-like matrices into a low-rank form) to rewrite DeltaNet in a chunkwise parallel form. The authors fold the decay term into this algorithm as well, keeping the structure of “matrix multiplication within chunks, state passing between chunks.”
Architecture and Hybrid Variants

Start with the block design on the right. The overall skeleton follows Llama, stacking token mixers and SwiGLU MLPs in alternation, except that self-attention is replaced by the gated delta rule.
- , , and all pass through a linear projection, a short convolution, and SiLU; and also get L2 normalization, which the paper says is for training stability. (This note adds that when keys are fixed at length 1, setting makes project out that direction entirely, so the “erase” really does wipe it clean.)
- and use only linear projections, with following Mamba-2's parameterization.
- The output is normalized first, then multiplied by a gate branch, and finally projected back.
The left and middle diagrams show two hybrid variants:
- Gated DeltaNet-H1: Gated DeltaNet alternates with sliding-window attention (SWA).
- Gated DeltaNet-H2: Mamba2, Gated DeltaNet, and SWA take turns.
Linear Transformers are poor at local shifting and comparison, and a fixed-size state makes retrieval harder, so, following Griffin and Samba, the authors add local attention with a 2K window.
Discussion
Experimental Setup
All models are trained under the same conditions, with 1.3B parameters, 100B tokens sampled from FineWeb-Edu, the Llama 2 tokenizer, and a training length of 4K. The baselines are RetNet, HGRN2, Mamba, Mamba2, DeltaNet, Samba, and Transformer++.
Needle in a Haystack: How the Three Rules Divide the Work
RULER's single needle-in-a-haystack test (S-NIAH) best reveals the intent of the design:
| Task | DeltaNet | Mamba2 | Gated DeltaNet |
|---|---|---|---|
| S-NIAH-1 4K | 99.0 | 65.4 | 91.4 |
| S-NIAH-1 8K | 98.8 | 30.4 | 91.8 |
| S-NIAH-2 4K | 18.6 | 56.2 | 92.2 |
| S-NIAH-2 8K | 14.4 | 17.0 | 29.6 |
| S-NIAH-3 2K | 47.0 | 47.6 | 84.2 |
| S-NIAH-3 4K | 22.4 | 4.6 | 27.6 |
In this table, the three models' rankings flip from one setting to the next.
Start with S-NIAH-1, where the background is a synthetic sentence repeated over and over and the model only has to remember one passkey. DeltaNet is nearly perfect at both 4K and 8K, Mamba2 drops to 30.4 at 8K, and Gated DeltaNet sits around 91. When the job is “remember one thing for a long time,” a decay that keeps discounting everything is actually a burden.
Switch to S-NIAH-2, where the background becomes real essays, and the ranking reverses, with Gated DeltaNet scoring 92.2 at 4K, Mamba2 56.2, and DeltaNet only 18.6. This time the answer has to be held on to amid a pile of content that all looks potentially useful, and DeltaNet, which can't clear out old information, is the first to give way.
S-NIAH-3 replaces the answer with a long, patternless string such as a UUID. At 4K, Mamba2 manages only 4.6, DeltaNet 22.4, and Gated DeltaNet 27.6.
The authors explain these reversals as a trade-off between two abilities, “clearing memory” and “remembering pairs.” Decay clears out irrelevant content, the delta rule keeps pairs accurate, and the version that combines them doesn't lose out in most settings.
Note, too, that these models were trained at 4K, so the 8K columns also test length extrapolation. On S-NIAH-2 at 8K, Gated DeltaNet also falls to 29.6, so a clear gap in retrieval remains.
Language Modeling and Real-World Retrieval
On commonsense reasoning and perplexity (Table 3), among purely recurrent models, Gated DeltaNet's average zero-shot accuracy over eight tasks is 55.32, slightly above Mamba2's 54.89 and above Transformer++'s 52.25. The two hybrid variants score higher still. (The original table lists H1's average as 56.40; recomputing it from the eight numbers in the same row gives about 56.46, so the table itself has a small discrepancy.)
Real-world retrieval tasks (Table 4, inputs truncated to 2K tokens) are another story:
| Model | Six-task average |
|---|---|
| Mamba2 | 29.8 |
| DeltaNet | 26.2 |
| Gated DeltaNet | 30.6 |
| Transformer++ | 37.0 |
| Gated DeltaNet-H1 | 39.0 |
| Gated DeltaNet-H2 | 40.1 |
Among purely recurrent models, Gated DeltaNet is best, but it is still more than 6 points behind Transformer++. Only the hybrid variants, with sliding-window attention added, turn the tables and surpass pure attention.
The authors are candid here too, admitting that on real-world retrieval tasks Gated DeltaNet's advantage over Mamba2 is much smaller than on S-NIAH. They suspect this is because these small models weren't instruction-tuned, so their ability to answer questions is limited to begin with.
Speed
On training throughput (Figure 3: a single H100, 1.3B models, about 32K tokens per batch), Gated DeltaNet is about on par with DeltaNet and somewhat slower than Mamba2; the authors put the gap at roughly 2,000 to 3,000 tokens per second, due to the more complex update rule. The variants mixed with SWA are actually faster.
Conclusion
The contribution of this paper can be summed up briefly:
- Mamba-2's decay and DeltaNet's delta rule are complementary. The former is good at broad forgetting, the latter at precise edits.
- The combined gated delta rule can be trained in parallel. In the comparison at 1.3B parameters and 100B tokens, its averages on language benchmarks and real-world retrieval both beat Mamba2 and DeltaNet; length extrapolation varies by task, and DeltaNet still leads on S-NIAH-1.
- The retrieval gap of purely recurrent models remains. On real-world retrieval tasks, local attention has to be added back before the model overtakes the Transformer.
Less than a year after publication, this paper had made its way from academic comparisons into large models. In September 2025, Alibaba's Qwen3-Next adopted a 48-layer layout in which every 4 layers consist of 3 Gated DeltaNet layers plus 1 Gated Attention layer. Qwen3-Next model card In October of the same year, Moonshot AI's Kimi Linear went further and turned from a scalar into a per-channel vector.
From Mamba's selectivity and Mamba-2's scalar decay to the erase-then-write rule here, the names have changed, but the thread of “letting the model decide for itself what to remember and what to forget” has never been broken.