Gated DeltaNet

A sequence-mixing module that updates a compact recurrent memory state with input-dependent gating and delta-rule writes instead of materializing a full attention matrix.

Gated Delta Networks, often shortened to Gated DeltaNet or GDN, are a sequence-mixing module that keeps a fixed-size recurrent memory state and updates it with gated decay plus targeted delta-rule writes rather than scoring every token pair in a full attention matrix.

At a glance

Released

December 2024

Authors

Songlin Yang, Jan Kautz, Ali Hatamizadeh

Optimizes

  • Sequence Scaling
  • Attention Compute
  • Memory Bandwidth
  • Long Context Inference

Example models

What It Is

Gated Delta Networks are a sequence-mixing module used in efficient long-context language models. Gated DeltaNet is the common shorthand for the same design. At each position the module projects the hidden state into query, key, and value signals, reads from a compact matrix-valued memory state, and writes back an updated state for the next step. The past is carried forward through that recurrent state instead of through an explicit all-pairs attention map.

Why It Exists

Dense attention scales poorly as context length grows because every query token can compare against every earlier key. Linear attention lowers that cost by accumulating key-value statistics, but simple accumulation can blur or collide older information inside a fixed-size state. Gated Delta Networks exist to keep long-context sequence mixing affordable while giving the model stronger control over memory: gates can clear or retain past content, and the delta rule can replace a targeted slot instead of only adding another outer-product term.

How It Works

Each step starts from the current hidden state and projects it into query, key, and value vectors. The gate α_t is a separate control path: it scales how much of the previous memory matrix S_{t-1} survives before any new content is written. The delta-rule path is different: it uses the current key and value to perform a targeted edit, replacing the memory content associated with k_t instead of only adding another outer-product term. After that gated write completes, the updated state S_t is stored for the next position and the current query q_t reads the result to form the layer output o_t. The diagram below keeps the gate decay step and the delta-rule write as distinct stages rather than one generic memory box.
Gated DeltaNet compute path
Projections, memory, and readout
Gate decay control
Input or output step
Gating or memory stage
Mechanism note
Gated DeltaNet keeps one compact memory matrix. Gate α_t controls decay on S_{t-1}, the delta-rule path performs the targeted write into S_t, and the query reads o_t = S_t q_t instead of building a full attention matrix.

Math Or Compute Schema

Dense multi-head attention materializes softmax weights over all earlier keys. Gated Delta Networks instead keep a matrix-valued memory state S_t. The gate α_t controls memory decay on the previous state, β_t scales a targeted delta-rule write built from v_t and the residual (v_t - S_{t-1} k_t), and the output o_t = S_t q_t reads the updated memory with the current query. The formulas below contrast the dense attention path with that gated delta recurrence.
Multi-head attention (MHA)
Attention(Qi,Ki,Vi)=softmax ⁣(QiKi⊤dk)Vi\text{Attention}(Q_i, K_i, V_i) = \mathrm{softmax}\!\left(\frac{Q_i K_i^{\top}}{\sqrt{d_k}}\right) V_i
QQ
Query vectors for head i.
KK
Key vectors for head i.
VV
Value vectors for head i.
HH
Number of query heads.
dkd_k
Key dimension per head.
ii
Query head index.
Gated DeltaNet
St=αtSt−1+βt (vt−St−1kt) kt⊤,ot=StqtS_t = \alpha_t S_{t-1} + \beta_t\,(v_t - S_{t-1} k_t)\,k_t^{\top},\quad o_t = S_t q_t
qtq_t
Current-step query vector.
ktk_t
Current-step key vector.
vtv_t
Current-step value vector.
αt\alpha_t
Input-dependent gate that decays S_{t-1}.
βt\beta_t
Input-dependent write strength for the delta-rule update.
StS_t
Matrix-valued memory state after gated decay and the delta write.
oto_t
Layer output read from S_t with q_t.

Compared To Nearby Modules

Multi-head attention keeps the full pairwise score matrix and remains the most direct way to address any earlier token. Linear attention compresses the past into a running summary, but ordinary accumulation-only updates can be harder to erase or replace precisely. DeltaNet-style updates use the same delta-rule write without the separate input-dependent gate that scales memory decay, so older content can linger unless another write overwrites it. Mamba2-style gating controls state decay in selective state-space mixers, but it does not use the same targeted key-value delta edit that Gated Delta Networks apply on top of their memory matrix. Sliding-window attention and sparse attention stay closer to dense softmax attention, yet they only connect tokens inside a local band or chosen pattern. Gated DeltaNet keeps one compact global recurrent state and updates it selectively at each step. That design trades direct token-by-token addressability for near-linear long-context cost: gated decay plus delta-rule editing can clear or replace memory slots without materializing an n-by-n attention map. Hybrid stacks that mix Gated DeltaNet with sliding-window attention or sparse attention are common when a model needs both efficient global mixing and direct local or patterned access.
Comparison dimensionGated DeltaNetLinear AttentionMulti-Head AttentionSliding-Window Attention
Memory formFixed-size matrix-valued recurrent state carried across positionsRunning key-value summary accumulated across positionsExplicit attention weights over all earlier tokensDense attention inside a fixed local window
Sequence scalingNear-linear O(n) per layer with constant state widthNear-linear O(n) per head with fixed feature-map dimensionQuadratic O(n²) per headLinear O(n·W) per head when window width W is fixed
Update styleGated decay plus targeted delta-rule memory editsAssociative accumulation of feature-mapped keys and valuesSoftmax-weighted sum over all allowed key positionsSoftmax over keys inside the local band only
Past addressabilityIndirect; the past is compressed into one recurrent state rather than stored per tokenIndirect; earlier tokens are summarized in accumulated statisticsDirect; any earlier token can be scored explicitlyDirect only inside the local window; distant tokens need other layers or patterns

Example Architectures

The source paper studies decoder language models that replace some attention layers with Gated DeltaNet blocks and reports hybrid stacks that mix Gated DeltaNet with sliding-window attention or Mamba2-style layers. Qwen3.5-0.8B is one shipped model family on this site that routes part of its stack through Gated DeltaNet layers.

Limitations And Tradeoffs

The main tradeoff is retrieval fidelity. A fixed-size recurrent state cannot store every past token independently the way dense attention can, because the past is compressed rather than directly addressable token by token. Retrieval quality depends on how cleanly keys, gates, and delta writes use the available state width, so very long contexts can still stress the compressed memory even when compute stays affordable. Hybrid designs that mix Gated DeltaNet with sliding-window attention, sparse attention, or dense attention remain common when a model needs both efficient global mixing and direct token access.

Why It Still Matters

Gated Delta Networks sit on a practical path between quadratic attention and simpler linear recurrent mixers. They show how gated memory control and delta-rule editing can be combined in one hardware-friendly recurrence, which makes them a useful reference when reading newer efficient long-context model stacks.

Tags

References

  1. Yang, Songlin, Jan Kautz, and Ali Hatamizadeh. "Gated Delta Networks: Improving Mamba2 with Delta Rule." arXiv, 2024, https://arxiv.org/abs/2412.06464.