AI State of the Art
SOTA/Post-Transformer Architectures/17 min
Section 72

The Delta Rule and Gated DeltaNet: Memory That Overwrites

Listen as a podcast →

The night watchman's whiteboard

Picture a night watchman who tracks the state of a building on a fixed-size whiteboard. First method, naive: he adds every new observation on top of the others, after one night, everything overlaps and becomes unreadable. Second method, smart: when a piece of information changes ("door 3 is now closed"), he first erases the old note about door 3, then writes the new one in its place.

That second method is the delta rule. It is the ingredient that revived linear attention in 2024-2025, and the basic building block of the mechanisms used by Qwen3-Next, Kimi Linear and Kimi K3.

Reminder: the fixed-size memory

A linear-attention layer (or SSM (see the Mamba and Linear attention lessons) keeps no growing KV cache: it compresses the entire past into a fixed-size state matrix) an associative memory where each key points to a value. At every token, the memory is updated, then the next token arrives.

The whole question is: how do you update that memory without saturating it or blurring everything together?

Naive accumulation and its problem

The first linear attentions (2020) did a simple addition: memory = memory + (new key × new value). Like the watchman overloading his whiteboard, associations pile up. If the key "door 3" appears ten times with different values, all ten versions coexist and interfere with each other. Recall quickly becomes approximate.

The delta rule: erase, then write

DeltaNet applies the methodical watchman's fix. For each new key→value pair:

  1. Read what the memory already holds for this key.
  2. Subtract that old value (the targeted erase).
  3. Write the new value in its place.

Hence the name: only the delta is written, the difference between what you want to store and what was already there. A single key is touched; the rest of the memory is preserved. In 2024, researchers showed how to parallelize this computation efficiently on GPUs, that is what made DeltaNet usable at scale.

Parallelizing Linear Transformers with the Delta Rule over Sequence Length
For the mathematically inclined (optional)

The update reads S = (I − k·kᵀ)·S + v·kᵀ, where S is the memory (the state matrix), k and v the current token's key and value, and I the identity matrix (the one that changes nothing). The term (I − k·kᵀ) is a projection that "empties" the direction of key k in memory S; the term v·kᵀ writes the new value there. (In practice, a learned coefficient β, the write gate, doses the strength of this replacement.) Geometrically, (I − 2·k·kᵀ) would be a Householder reflection, the delta rule is a damped version of it.

The gate: tuning forgetfulness

Erasing what gets replaced is not enough: information that is never updated should also fade eventually, otherwise the memory fills up with stale entries. That is the role of the gate (forgetting mechanism): at each token, the whole memory is slightly attenuated.

Gated DeltaNet (NVIDIA, late 2024) combines the two: delta rule + gate.

Gated Delta Networks: Improving Mamba2 with Delta Rule Its gate is scalar: one coefficient per token, applied uniformly, the whole memory fades at the same pace. Simple and already very effective: Gated DeltaNet is the linear mechanism Alibaba picked for Qwen3-Next, in a 3:1 hybrid with full attention.

Two dashed-outline blocks. Top, Gated attention: four Linear layers produce Q, K, V and a fourth signal; Q and K go through RMSNorm layers (QKNorm) before entering a Scaled dot-product attention block, whose output is multiplied by a sigmoid labelled Sigmoid Gate before a final Linear layer. Bottom, Gated DeltaNet: Q and K go through convolutions then an L2 Norm, V through a convolution and a sigmoid, and two coefficients labelled alpha and beta arrive through Linear layers; everything feeds a Gated Delta Rule block, followed by an RMSNorm, a multiplication by a SiLU gate and a Linear layer. Three annotations on the right point respectively to the Output gate, the Update gate (beta) and the Decay gate (alpha).
A Gated DeltaNet block next to a standard attention block. The three annotations on the right name the mechanism's three valves: the decay gate alpha is the forgetting gate described above, the one that attenuates the whole memory at every token; the update gate beta controls how strongly the delta rule writes; the output gate filters what leaves the layer. The heart of the computation is the yellow Gated Delta Rule box.Source : Sebastian Raschka, Gated DeltaNet (LLMs from Scratch, chapter 4)

From scalar gate to diagonal gate

The scalar gate's limitation: everything is forgotten at the same pace. Yet some information deserves to stay for a long time (a name, an instruction given at the start), while other information can vanish quickly (transitional details).

Hence the next refinement: one forgetting coefficient per channel of the memory. Each dimension fades at its own pace. Mathematically, this amounts to multiplying the state by a diagonal matrix (one coefficient per row, zeros everywhere else), hence the term "diagonal gate". This is the core of KDA, Kimi's mechanism (next lesson).

Side-by-side comparison of two architectures. Left, Qwen3 Next 80B-A3B: a stack of 48 layers running from the token embedding layer to the linear output layer, with a central block labelled Gated DeltaNet or Gated Attention, expanded on the right into two insets, Gated attention and Gated DeltaNet, the latter built around a Gated Delta Rule box fed by Q, K, V, alpha and beta. Right, Kimi Linear 48B-A3B: a stack of 27 layers with the same structure, whose central block is labelled Kimi Delta Attn or Multi-head Latent Attn, expanded into two insets, Multi-head latent attention and Kimi Delta Attention, the latter also built around a Gated Delta Rule box. Under each architecture a 3:1 Ratio table lists the layers: three Linear attention layers followed by one Full attention layer, each followed by an MoE.
The two mechanisms of this lesson as they are actually wired into two production models. On the left Qwen3-Next uses Gated DeltaNet (scalar gate), on the right Kimi Linear uses Kimi Delta Attention (diagonal gate): the two blocks look almost identical, the difference being the nature of the forgetting coefficient. The tables at the bottom show the 3:1 ratio mentioned above, three linear layers for one full-attention layer.Source : Sebastian Raschka, Gated DeltaNet (LLMs from Scratch, chapter 4)
The hierarchy to remember

Naive accumulation → delta rule (overwrite what you replace) → + scalar gate (everything fades uniformly) = Gated DeltaNet → + diagonal gate (each channel fades at its own pace) = KDA. Each step adds control over what the memory keeps or forgets.

Why it matters

In 2025-2026 this family of mechanisms became the de facto standard for the linear layers of large hybrid models: Qwen3-Next (Gated DeltaNet), Kimi Linear and Kimi K3 (KDA), and several NVIDIA research architectures. When a paper or technical document mentions a "delta rule", a "gate" or "diagonal matrices" inside a linear-attention layer, this is exactly what it is talking about.

Three-part figure. Left, Gated DeltaNet-H1: a block repeated N times stacking a Gated DeltaNet layer followed by an MLP, then an SWA (sliding window attention) layer followed by an MLP, with residual connections. Center, Gated DeltaNet-H2: the same stacking but with three stages, Mamba2 then MLP, Gated DeltaNet then MLP, and SWA then MLP. Right, Block Design: the internals of a Gated DeltaNet layer, where four Linear layers produce q and k (through convolutions then an L2 Norm), v (through a convolution) and the coefficients alpha and beta, all feeding a Gated Delta Rule box, followed by a Norm, a multiplication and an output Linear layer.
The figure from the original paper. On the right, the internals of a Gated DeltaNet layer: the Gated Delta Rule box and the two coefficients alpha (forgetting) and beta (writing) are both there. On the left and in the center, two ways of hybridising that layer with other building blocks: with sliding-window attention alone, or alternating it with Mamba2 layers as well. This alternation principle is exactly what the production models mentioned above rely on.Source : Paper Gated Delta Networks: Improving Mamba2 with Delta Rule (NVIDIA / MIT, arXiv 2412.06464), via Hugging Face Papers

Key takeaways

  1. A linear layer compresses the past into a fixed-size memory; the whole game is the update rule.
  2. The delta rule erases a key's old value before writing the new one, a targeted "erase and replace".
  3. The gate tunes forgetting: scalar (uniform, Gated DeltaNet) or diagonal (per channel, KDA).
  4. These mechanisms power the linear layers of recent large hybrids (Qwen3-Next, Kimi K3).
Check your understanding0 / 4

1. Why did the first generation of linear attentions, which simply added every new key-value association to the memory, end up recalling information poorly?

2. What exactly does the delta rule do when an already-known key comes back with a new value?

3. The delta rule already erases what it replaces. Why does Gated DeltaNet still add a forgetting gate?

4. What is the difference between Gated DeltaNet's scalar gate and KDA's diagonal gate?