Linear attention scales linearly with sequence length, but its finite-state memory can limit long-context retrieval. In gated linear recurrences, memory retention depends on state decay, which is shaped jointly by gate parameters A_log and dt_bias and by input activations. In controlled Gated DeltaNet (GDN) experiments, both parameters remain highly correlated with their initial values after training, highlighting the importance of initialization. Therefore, we introduce Dual-Axis Memory Initialization (DAMI), which jointly configures these parameters before training. DAMI assigns geometric timescales across heads for varied retrieval distances and a low-high-low input-sensitivity profile across layers. A small activation sample calibrates the GDN-family implementation to match both behavioral targets without adding trainable parameters. Across GDN, KDA, GDN2, Mamba-2, and RWKV-7, DAMI improves average RULER-style retrieval accuracy by 5.29 to 16.71 percentage points over the corresponding random-initialization baselines. Performance on language modeling, commonsense reasoning, and 2K real-world retrieval remains broadly comparable to those baselines. Our code is available at https://speedai.com/research/dami.
Figures & tables
Figure 1: Dual-axis memory initialization. (a) Diverse head-wise timescales broaden memory coverage across evidence–query distances; curves illustrate normalized exponential decay. (b) Schematic uniform-high and uniform-low Random regimes illustrate recent-pair bias and mixed memories, contrasted with DAMI’s low–high–low sensitivity profile. Text excerpts are from RULER; placements and outcomes are schematic.
Figure 2: Overview of DAMI initialization. (a) Head-wise timescales and layer-wise sensitivities define dual-axis targets. (b) Calibration proceeds layer by layer using projected activations without gradients. (c) Each head’s dt_bias is solved before A_log using calibration-set statistics. (d) Schematic parameter layouts illustrate the head and layer axes.
Model
Gate gt
A_log
dt_bias
Decayed state
State update
GDN
−eAlogϕ(zt+dt_bias)
Head-level
Head-level
St−1=egtSt−1
St=St−1+βtkt(vt⊤−kt⊤St−1)
KDA
−eAlogϕ(zt,k+dt_biask)
Head-level
Key-channel
St−1=Diag(egt)St−1
St=St−1+βtkt(vt⊤−kt⊤St−1)
GDN2
−eAlogϕ(zt,k+dt_biask)
Head-level
Key-channel
St−1=Diag(egt)St−1
St=St−1+kt[(wt⊙vt)⊤−(bt⊙kt)⊤St−1]
Mamba-2
−eAlogϕ(zt+dt_bias)
Head-level
Head-level
St−1=egtSt−1
St=St−1+ΔtBtxt⊤
RWKV-7
−eAlogσ(zt,k+dt_biask)
Head-level (frozen)
Key-channel
St−1=Diag(egt)St−1
St=St−1+k~tvt⊤−pt(κ^t⊤St−1)
Table 1: Gate parameterizations and state updates. ϕ=softplus , σ is sigmoid, and ⊙ denotes element-wise multiplication. βt is scalar; bt,wt are independent channel-wise coefficients. For Mamba-2, Δt=ϕ(zt+dt_bias) , with input vectors Bt,xt . For RWKV-7, pt=at⊙κ^t , with normalized key κ^t and channel-wise coefficient at .
Figure 3: Initial–trained Pearson correlations of GDN memory parameters.
Figure 4: Effect of dt_bias on local Softplus sensitivity. Dashed and dotted curves show the asymptotic approximations; ϕ′(−4)≈0.018 and ϕ′(4)≈0.982 .
Single-Key NIAH-1
Single-Key NIAH-2
Multi-Key MK-NIAH
Model
1K
2K
4K
8K
1K
2K
4K
8K
1K
2K
4K
Avg.
GDN
92.6
62.0
32.4
13.2
19.8
41.6
13.8
1.6
24.4
20.8
12.4
30.42
+PoST
93.2
64.8
35.6
14.6
47.6
47.6
2.4
9.4
23.6
21.4
8.2
33.49
+DAMI
95.4
84.0
53.8
24.2
89.6
55.6
13.0
12.8
25.0
22.0
12.6
44.36
KDA
63.8
29.4
16.8
5.6
88.8
25.6
1.2
3.8
23.0
18.2
14.0
26.38
+PoST
93.6
72.0
34.2
9.6
79.8
16.8
9.6
5.4
18.2
17.2
14.0
33.67
Table 2: Answer-containment accuracy (%) on the fixed v1 RULER-style NIAH benchmark. Each task–length setting contains the same 500 pregenerated samples for all models. Bold denotes the best result within each architecture; Avg. is the unweighted mean over the 11 settings.
Model
WikiText
WinoG.
ARC-E
ARC-C
OBQA
SIQA
ppl ↓
acc ↑
acc ↑
acc ↑
acc ↑
acc ↑
GDN
44.44
48.93
43.81
25.00
31.60
36.64
+PoST
44.83
48.78
43.90
24.74
30.20
37.15
+DAMI
45.27
52.09
44.07
23.72
31.80
37.00
KDA
42.04
51.30
44.11
24.32
30.60
37.56
+PoST
42.42
51.22
43.52
24.06
31.40
37.10
Table 3: Language modeling and commonsense results. WikiText reports perplexity (lower is better); other tasks report accuracy (%, higher is better). Bold denotes the best result within each architecture. WinoG., ARC-E, ARC-C, OBQA, and SIQA denote WinoGrande, ARC-Easy, ARC-Challenge, OpenBookQA, and Social IQa, respectively.
Model
SWDE
SQuAD
FDA
TQA
NQ
DROP
Avg.
GDN
9.18
18.53
2.00
0.17
0.14
2.16
5.36
+PoST
6.48
18.10
1.54
0.23
0.11
2.49
4.83
+DAMI
7.47
19.81
1.09
0.24
0.14
2.25
5.16
KDA
9.81
21.31
1.18
0.31
0.11
2.33
5.84
+PoST
8.91
19.44
2.18
0.26
0.08
2.30
5.53
+DAMI
8.46
20.27
1.27
0.07
0.03
2.35
5.41
Table 4: Real-world retrieval at 2K tokens (%). TQA denotes TriviaQA; Avg. is the unweighted mean over six tasks. Bold denotes the best result within each architecture.
Variant
NIAH-1
NIAH-2
MK-NIAH
Overall
Avg. ↑
Avg. ↑
Avg. ↑
Avg. ↑
Random
50.05
19.20
19.20
30.42
Random A_log
49.15
2.40
14.87
22.80
Random dt_bias
42.55
16.90
17.27
26.33
DAMI
64.35
42.75
19.87
44.36
Table 5: GDN single-parameter replacement ablations (%). The named parameter is restored to Random; the other retains its DAMI value.
Variant
NIAH-1
NIAH-2
MK-NIAH
Overall
Avg. ↑
Avg. ↑
Avg. ↑
Avg. ↑
τ : 1–2048
47.95
17.30
19.60
29.07
τ : 1–1024
22.05
25.50
21.40
23.13
Linear spacing
62.40
5.65
15.47
28.96
DAMI
64.35
42.75
19.87
44.36
Table 6: Effects of timescale coverage and spacing on GDN retrieval (%).
Figure 5: Normalized target sensitivity profiles across layers. The horizontal axis is normalized depth rℓ=(ℓ−1)/(L−1) ; the vertical axis is (Sℓ⋆−Smin)/(Smax−Smin) . Curves indicate initialization targets.
Shape
NIAH-1
NIAH-2
MK-NIAH
Overall
Avg. ↑
Avg. ↑
Avg. ↑
Avg. ↑
L-H
54.70
19.55
19.40
32.29
H-L
50.55
9.15
18.87
26.85
L-H-L (DAMI)
64.35
42.75
19.87
44.36
H-L-H
60.05
16.60
18.27
32.85
Table 7: GDN retrieval with four layer-wise sensitivity profiles (%).
Variant
NIAH-1
NIAH-2
MK-NIAH
Overall
Avg. ↑
Avg. ↑
Avg. ↑
Avg. ↑
Shift +0.2
45.25
6.10
20.67
24.31
Shift −0.2
57.40
14.75
23.13
32.55
Peak L4
51.25
22.25
24.13
33.31
Peak L13
52.60
20.80
18.60
31.76
DAMI
64.35
42.75
19.87
44.36
Table 8: GDN sensitivity-level and peak-location perturbations (%). Shift denotes profile translation; Peak denotes the peak layer.
Figure 6: GDN retrieval accuracy by relative distance at four context lengths. Points show task-averaged accuracy in 16 shared bins.
Linear attention replaces the unbounded cache of softmax attention with a fixed-size recurrent state, reducing sequence mixing to linear time and decoding to constant memory. The hard part is not just what to forget, but how to edit this compressed memory without scrambling existing associations. Delta-rule models subtract the current read before writing a new value, and Kimi Delta Attention (KDA) sharpens forgetting with channel-wise decay. But the active edit still uses a single scalar gate to control two different things: how much old content to erase on the key side and how much new content to commit on the value side. We introduce Gated DeltaNet-2, which generalizes both Gated DeltaNet and KDA by inheriting adaptive forgetting and channel-wise decay while addressing their shared limitation, the scalar tie between erasing and writing. Gated Delta Rule-2 separates these roles with a channel-wise erase gate b_t and a channel-wise write gate w_t, reducing to KDA when both gates collapse to the same scalar and to Gated DeltaNet when the decay also collapses. We derive a fast-weight update view, a chunkwise WY algorithm with channel-wise decay absorbed into asymmetric erase factors, and a gate-aware backward pass that preserves efficient parallel training. At 1.3B parameters trained on 100B FineWeb-Edu tokens, Gated DeltaNet-2 achieves the strongest overall results among Mamba-2, Gated DeltaNet, KDA, and Mamba-3 variants across language modeling, commonsense reasoning, and retrieval. Its advantage is most pronounced on long-context RULER needle-in-a-haystack benchmarks, where it improves the evaluated multi-key retrieval setting and remains strong in both recurrent and hybrid settings. Code is available at https://github.com/NVlabs/GatedDeltaNet-2.
Linear attention models allow a fixed state size and a fixed amount of compute per token. However, due to their limited state size, linear attention models fall behind in long-context recall compared to softmax-attention-based transformer architectures. Increasing the state size of linear attention improves recall performance but at the cost of higher FLOPs. In this work, we introduce Sparse Delta Memory (SDM), an architecture that scales the hidden state of gated linear RNNs to orders of magnitude higher capacity using a sparse addressing scheme. SDM extends the Gated DeltaNet architecture by replacing the dense key-value outer product with sparse reads and writes to a large explicit memory. We show that, under an isoFLOP constraint and with an identical number of parameters, a higher state memory capacity significantly improves performance on in-context learning and long-context retrieval tasks. Moreover, by learning the initial state of the SDM memory and therefore using it as a parametric memory, we show that the model further improves on a wide range of common-knowledge and reasoning tasks.
Loïc Cabannes, Pierre-Emmanuel Mazaré, Gergely Szilvasy +6
Meta FAIR · Inria Paris & ENS-PSL University · University of Tübingen
Linear attention enables efficient long-context autoregressive decoding by compressing history into recurrent states, but this compression can make selective access to sparse and distant information difficult. Existing chunk-based extensions increase memory capacity, yet learned chunk-mixing coefficients may remain fixed with respect to input content and therefore cannot adapt historical access to each query. We introduce Hybrid Linear Attention (HLA), a query-dependent chunk-level attention mechanism for Gated DeltaNet (GDN). HLA represents each completed chunk as an exact affine state transition and computes content-dependent routing gates from compact, self-attentively pooled representatives. Each gate interpolates the corresponding historical transition with the identity map, controlling both the chunk's additive memory and its transformation of earlier states. Effective-support regularization further encourages concentrated routing for sparse inference. We evaluate HLA under both pretrained adaptation and from-scratch training. Across Qwen3.5 models from 0.8B to 9B, HLA consistently improves over native GDN and fixed chunk mixing, with gains of up to 5.57 percentage points on LongBench-V2 and 3.97 points on RULER. In a controlled from-scratch 1.3B setting trained for 100B tokens with a 4K context, HLA also improves RULER performance from 4K to 32K, with gains increasing from 0.83 points at 4K to 4.22 points at 32K. These results demonstrate that query-dependent composition of recurrent memory improves long-context modeling and remains effective beyond the training context while using compact per-chunk affine summaries. Project page: https://caesarhhh.github.io/hla/