Gated DeltaNet: write the correction, not the whole fact
Linear attention averages the writes it receives. Could a later write correct an existing association instead?
Linear attention replaced the growing KV cache with weighted value totals H and contribution amounts z. Each token writes to those arrays, then its query requests information from them.
That gives us a weighted average of the writes so far. But what if a later token is meant to change an existing association, rather than contribute another value to its average?
What if the value changes?
Keep the two associations from the earlier example: [1, 0] → [2, 1] and [0, 1] → [8, 2]. Now the first key arrives with a new value, [4, 5]. What should the memory return for that key?
With linear attention, both writes contribute. The answer is their average, [3, 3]. That makes sense if we want to combine two observations. But suppose the later value is an update: we would want the answer to move to [4, 5].
Adding the new value cannot do that on its own: the old contribution is still there. Dividing by z keeps repeated writes from making the output grow, but it leaves us with the same question. How could a new write revise what is already stored?
Could we write only what needs to change?
Before adding anything, we could ask the memory what it currently associates with the incoming key. Here, that is [2, 1]. To reach [4, 5], the missing amount is only [2, 4].
That suggests a different purpose for H: keep the current associations, so Hk gives a prediction of the value associated with k. In the earlier article, H held weighted totals and needed z to turn them into an average. For this experiment, we want a direct prediction instead, so we leave out that division.
We already know how to write a value using its key: the outer product v kᵀ. Could we use the same operation with the missing amount instead of the whole value?
Call the prediction v̂ = Hk, and the difference e = v − v̂. Writing e kᵀ adds [2, 4] to the first association. It now reads [4, 5], while the second still reads [8, 2]:
There is a useful consequence. If the same value arrives again, the prediction already matches it. The difference is zero, so the memory stays as it is. Reading before writing tells us whether anything needs to change.
Our example makes this especially clear because its keys are perpendicular unit vectors: each addresses a separate column of H. With other unit-length keys, adding e kᵀ still changes that key’s own prediction by e. But overlapping keys share some of the same memory, so other reads can change too. A correction is not guaranteed to affect only one association.
This is why the full block uses L2 normalisation to make keys unit length. It also L2-normalises queries, replacing the earlier positive-feature map. There is no z branch: the query now requests information directly through Hq. The extra read with k has a different job: checking what the incoming write would change.
Should a new value replace the old prediction completely?
So far, we have treated the incoming value as a complete replacement. But a token might only supply part of an update. What if we could move partway towards it?
In our example, half the difference is [1, 2]. Adding that to the old prediction [2, 1] gives [3, 3]. A later token could move it further. Applying the full difference would take it straight to [4, 5].
A write strength β between 0 and 1 gives us that choice. β = 1 applies the full correction; β = ½ applies half; β = 0 leaves the association alone. Instead of fixing that strength ourselves, we can let the model learn to calculate it from the current token.
What about old information that never gets corrected?
The correction only acts through the incoming key. An old association that new tokens do not address can remain in H, even when it is no longer useful in the current context.
Could the current token also control how much of the old state carries forward? A retention factor α between 0 and 1 would let it do that: α = 1 keeps H, while α = ½ halves it before the new write.
That raises another question: should we compare the incoming value with the memory before or after this fading? Suppose its old prediction was [2, 1]. After halving H, it is [1, ½]. A correction based on the original prediction would no longer supply the amount missing from the memory we actually have.
So we first retain H̄ = αH, then ask that retained state for its prediction. The correction becomes e = v − H̄k. Retention decides what survives; the correction responds to what is still missing.
How could the token control both choices?
We already use learned projections to turn the token into q, k and v. Two more projections can give us the controls we have just proposed.
For β, sigmoid keeps the write strength between 0 and 1. For α, we can use the same idea of input-dependent fading explored in Mamba: a positive step Δ and a learned negative parameter A give α = exp(A × Δ). A larger step leaves less of the old state.
Both controls come from the current token, but answer different questions: how much old state should survive, and how much of the missing value should we write?
What does the whole block look like now?
The Q/K/V branches still come from the current token. What changes is how they work with H. The key first asks what the retained memory predicts; the value tells us what is missing. We write a chosen amount of that difference, then the query requests information from the updated memory.
In the diagram, Wα and Wβ sit alongside the Q/K/V weights. Follow H down through retention, prediction, correction and the final query read:
The updated H carries forward to the next token. Together, these steps give Hₜ = αHₜ₋₁ + β(v − αHₜ₋₁k)kᵀ, and its query read is y = Hₜq.
Qwen3-Next uses this kind of head with a 128 × 128 state per value head, plus convolution, output gating and normalisation around it. Kimi Linear uses a related delta update with finer-grained retention controls.
The state stays fixed in size, but its writes can still interfere. Hybrid architectures keep some attention layers so the network can also request information from separately stored key/value pairs.
Sources and assumptions
- Gated Delta Networks: Improving Mamba2 with Delta Rule, Yang, Kautz and Hatamizadeh, 2024: the gated delta recurrence and its parallel computation.
- Qwen3-Next reference implementation: decay before prediction, sigmoid β, L2-normalised q/k, shared query/key patterns and output gating.
- Qwen3-Next configuration: 32 value heads, 16 key heads and 128-dimensional linear-attention keys and values.
- Kimi Linear: Kimi Delta Attention’s finer-grained gate.
Rows of H are value coordinates and columns are key coordinates. The comparison uses two-coordinate values and orthogonal unit keys. It contrasts the normalised additive rule from the preceding article with an unnormalised delta-state read; the two heads do not share the same denominator rule. Exact replacement assumes a unit key, β = 1 and α = 1. Repeating a value does not double the preceding article’s normalised output.
The complete drawing shows a simplified head inside the familiar attention shell, with illustrative cells and model-dimension labels. Blue/orange cells identify calculated data rather than numerical signs; violet boxes identify learned parameters. Wα and Wβ are learned projections; A is a directly learned negative parameter. Decay precedes prediction. Model-specific convolution, output gating, head sharing, output scaling and extra normalisation are omitted from the drawing. Qwen3-Next has 32 value heads sharing 16 query/key patterns; Kimi Delta Attention uses finer-grained retention than the scalar α drawn here.