Gated Delta Networks: Improving Mamba2 with Delta Rule

Songlin Yang, Jan Kautz, Ali Hatamizadeh

TL;DR

Gated Delta Networks (Gated DeltaNet) combine two powerful memory mechanisms—gating for rapid forgetting and the delta rule for precise updates—to overcome the retrieval limitations of Linear Transformers. By unifying these approaches and introducing a hardware-efficient parallel training algorithm, the authors achieve state-of-the-art performance on long-context and reasoning tasks, consistently outperforming models like Mamba2.

What Problem Does This Paper Address?

Standard Transformers are the gold standard for LLMs but suffer from quadratic scaling: as the input sequence grows, the computational cost explodes. Linear Transformers (and State Space Models like Mamba) offer a solution by using a fixed-size "hidden state" to summarize the past, resulting in linear scaling.

However, this fixed-size memory creates a bottleneck. If the sequence is long, the model must decide what to keep and what to overwrite. Existing solutions have been incomplete:

  1. Gating (e.g., Mamba2): Uses a decay factor to forget old information uniformly. It’s great at clearing out irrelevant data but struggles with precise "associative recall" (remembering specific key-value pairs).
  2. The Delta Rule (e.g., DeltaNet): Selectively replaces old information with new data. It’s excellent at memorization but lacks a mechanism to rapidly clear the entire memory during major context shifts.

The authors identify that these two mechanisms are complementary: one is an "eraser," and the other is a "targeted update."

Methods

The core contribution is the Gated Delta Rule, formulated as: $$S_t = S_{t-1} (\alpha_t (I - \beta_t k_t k_t^\top)) + \beta_t v_t k_t^\top$$ Here, $\alpha_t$ acts as the gate (forgetting), while the $(I - \beta_t k_t k_t^\top)$ term implements the delta rule (selective replacement).

To make this practical for modern GPUs, the authors developed a parallel training algorithm based on an "Extended WY Representation." This allows the sequential recurrence to be computed in chunks, leveraging high-speed matrix multiplications (Tensor Cores) rather than slow sequential steps.

The block design of Gated DeltaNet and its hybrid variants.

The authors also propose hybrid architectures:

  • H1: Interleaves Gated DeltaNet layers with Sliding Window Attention (SWA) to better handle local dependencies.
  • H2: Stacks Mamba2, Gated DeltaNet, and SWA layers to leverage the strengths of all three.

Datasets

  • Training: All models (1.3B parameters) were trained on 100B tokens from the FineWeb-Edu dataset.
  • Evaluation:
    • Commonsense Reasoning: PIQA, HellaSwag, WinoGrande, ARC, SIQA, BoolQ.
  • Language Modeling: Wikitext, LAMBADA.
  • In-Context Retrieval: The S-NIAH (Single Needle-In-A-Haystack) suite from RULER, and real-world tasks like SQuAD and TriviaQA.
  • Long Context: LongBench (14 tasks including summarization and QA) and various length extrapolation benchmarks (GovReport, PG19, etc.).

Key Insights and Ideas

  • The "Memory Collision" Solution: In standard linear models, new information is simply added to the state, eventually leading to "collisions" where old and new data become indistinguishable. The Gated Delta Rule uses the delta rule to "make room" for new associations by specifically erasing the old value associated with a key before writing a new one.
  • Gating as a Filter: The case study on "Needle In A Haystack" (Table 2) revealed that while the delta rule is king for pure memorization, gating is essential for filtering out "haystack" noise in real-world text.
  • Hardware Matters: A beautiful mathematical recurrence is useless if it can't run fast. The authors' chunkwise parallelization ensures that Gated DeltaNet maintains a competitive training throughput compared to Mamba2, despite having a more complex update rule.

Key Results

Gated DeltaNet consistently outperformed both Mamba2 and the original DeltaNet across the board:

  • Retrieval: In the S-NIAH-3 (UUID in haystack) task at 4K length, Gated DeltaNet achieved 27.6% accuracy, while Mamba2 plummeted to 4.6%.
  • Commonsense Reasoning: Gated DeltaNet achieved an average score of 55.32, surpassing Mamba2 (54.89) and DeltaNet (52.14).
  • Length Extrapolation: As shown in Figure 2, Gated DeltaNet maintains lower perplexity than other RNN-based models when tested on sequences far longer (up to 20K) than those seen during training (4K).
Figure 2: Length extrapolation on six long benchmarks.

Limitations and Future Work

  • Throughput Overhead: While efficient, Gated DeltaNet is slightly slower than Mamba2 (roughly 2-3K tokens/sec difference) due to its more expressive transition matrices.
  • Instruction Tuning: The models were evaluated in a zero-shot/few-shot manner without instruction fine-tuning. The authors note that instruction-unaligned models are prone to repetition errors, which might mask some of the architectural benefits.
  • Scaling: Future work involves testing these architectures at much larger scales (e.g., 7B+ parameters) and on even longer sequences (100K+ tokens).

Summary updated

Abstract

Linear Transformers have gained attention as efficient alternatives to standard Transformers, but their performance in retrieval and long-context tasks has been limited. To address these limitations, recent work has explored two distinct mechanisms: gating for adaptive memory control and the delta update rule for precise memory modifications. We observe that these mechanisms are complementary: gating enables rapid memory erasure while the delta rule facilitates targeted updates. Building on this insight, we introduce the gated delta rule and develop a parallel training algorithm optimized for modern hardware. Our proposed architecture, Gated DeltaNet, consistently surpasses existing models like Mamba2 and DeltaNet across multiple benchmarks, including language modeling, common-sense reasoning, in-context retrieval, length extrapolation, and long-context understanding. We further enhance performance by developing hybrid architectures that combine Gated DeltaNet layers with sliding window attention or Mamba2 layers, achieving both improved training efficiency and superior task performance.
BibTeX
@inproceedings{yang2025gated,
  author = {Songlin Yang and Jan Kautz and Ali Hatamizadeh},
  title = {{Gated Delta Networks: Improving Mamba2 with Delta Rule}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=r8H7xhYPwz},
}
Figure