Gated Delta Networks: Improving Mamba2 with Delta Rule
TL;DR. Linear-attention models keep a matrix-valued memory . Mamba2 adds a decay gate that can wipe memory quickly but cannot edit one entry. DeltaNet uses the delta rule to overwrite the value at one key but cannot forget quickly. Gated DeltaNet uses both. It beats Mamba2 and DeltaNet at 1.3B, and hybrids that add sliding-window attention beat Transformer++.
Key idea
Section titled “Key idea”A two-key example first. Treat the memory as a key-value store read by . Store value under unit key and value under an orthogonal unit key , so ; querying with returns . Now the fact under changes to :
- Append (plain linear attention) adds , so querying returns , a corrupted mix.
- Scalar decay (Mamba2) first scales everything by , so returns and returns : the stale value fades only slowly and the unrelated fact fades too.
- Delta rule () first erases what is stored at , then writes, so returns exactly and still returns .
- Gated delta rule does both: returns and returns , a targeted edit plus global forgetting.
Three memory updates, with key , value and read-out :
The delta rule is one online gradient step on . It removes the value currently stored at before writing . The gate adds fast global forgetting. Training stays linear-time by splitting the sequence into chunks. As an implementation detail, the WY representation writes the product of the terms within a chunk compactly, so most work runs as matrix multiplications on tensor cores; it is not needed to understand what the memory does. In the block, q, k and v pass through a linear layer, a short convolution and SiLU, and q and k are L2-normalised, which keeps the update stable.
Results. With 1.3B models trained on 100B FineWeb-Edu tokens (Table 3), Gated DeltaNet reaches a common-sense average of 55.32, against 54.89 for Mamba2, 52.14 for DeltaNet and 52.25 for Transformer++. Its Wikitext perplexity is 16.42, against 16.56 for Mamba2 and 18.53 for Transformer++. The hybrids H1 and H2 reach 56.40 and 56.18. On recall-intensive tasks (Table 4), Gated DeltaNet averages 30.6, ahead of Mamba2 at 29.8 but behind Transformer++ at 37.0. H1 and H2 reach 39.0 and 40.1, so attention layers are still needed for exact recall.
Connections
Section titled “Connections”- Builds on Mamba, with Mamba2-style scalar decay replacing the selective SSM.
- Deployed in Qwen3.8-Flash-Next as a 3:1 GDN-to-attention hybrid. A related hybrid is Nemotron-H.
- Evaluation: S-NIAH comes from RULER.
- IR angle: the state is an associative key-value memory, and the delta rule is an “upsert” rather than an “append”. That is a useful lens for memory in long-horizon search agents.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Show that the delta-rule update S_t = S_(t−1)(I − β_t k_t k_tᵀ) + β_t v_t k_tᵀ is one gradient-descent step with learning rate β_t on the loss ½‖S k_t − v_t‖². Then show that with β_t = 1 and a unit-norm key, the new state returns exactly v_t when queried with k_t. What does the gate α_t add?
What a strong answer covers
- Gradient of ½‖S k − v‖² with respect to S is (S k − v)kᵀ. One step gives S − β(S k − v)kᵀ = S(I − β k kᵀ) + β v kᵀ.
- With β = 1 and ‖k‖ = 1: S_t k = S_(t−1)k − S_(t−1)k(kᵀk) + v(kᵀk) = v. The old value stored at key k is replaced, not added to.
- Plain linear attention adds v kᵀ, so repeated keys pile up and collide. The delta rule first removes what is already stored at that key.
- The gated version multiplies the whole state by α_t, giving S_(t−1)(α_t(I − β_t k_t k_tᵀ)) + β_t v_t k_tᵀ. α_t → 0 clears all memory quickly, as in Mamba2. α_t → 1 recovers the pure delta rule.
- Mechanism
The S-NIAH case study (§3.2) contrasts Mamba2, DeltaNet and Gated DeltaNet. Explain which failure each mechanism fixes: why Mamba2 loses old needles, why DeltaNet degrades with long real-text contexts, and why combining them helps.
What a strong answer covers
- Mamba2 decays all history at every step. On S-NIAH-1 it degrades beyond 2K tokens because the needle fades, while DeltaNet stays near perfect.
- DeltaNet never decays globally. With essays as haystack, irrelevant information piles up in a fixed-size state and collides with the needle, so performance drops at longer lengths.
- Gating filters and clears irrelevant content. The delta rule writes the needle precisely and helps memorise complex values such as UUIDs (S-NIAH-3), where Mamba2 drops quickly.
- Gated DeltaNet gets both behaviours from one update, and it remains trainable in chunks using the WY representation for products of Householder-like matrices.
- Critique
Gated DeltaNet beats Mamba2 and Transformer++ on language modelling and common-sense averages at 1.3B, yet trails Transformer++ on recall-intensive tasks. Use Table 4 to critique the claim that linear recurrent layers are ready to replace attention in retrieval-augmented generation.
What a strong answer covers
- Recall average (Table 4): Mamba2 29.8, Gated DeltaNet 30.6, Transformer++ 37.0. On FDA, Gated DeltaNet scores 23.7 against 52.2.
- Hybrids close the gap. H1 (Gated DeltaNet + SWA) gets 39.0 and H2 (Mamba2 + Gated DeltaNet + SWA) gets 40.1, both above Transformer++.
- The cause is structural. A fixed-size state cannot store all key-value pairs from a long document, and the delta rule only improves how that limited capacity is used.
- Scale caveat: results are at 1.3B on 100B tokens. Production use, such as the 3:1 GDN-to-attention ratio in Qwen3.8-Flash-Next, keeps some full or sparse attention layers.