Delta-rule lineage: DeltaNet, Gated DeltaNet, Kimi Linear
The delta rule read as one gradient step on an associative-recall loss — DeltaNet (explicit Euler) and Longhorn (backward Euler) as the textbook explicit/implicit discretization pair, the stability dichotomy that follows, chunkwise parallelization via the WY trick, and gated forgetting from Gated DeltaNet to Kimi Linear.
On this page
- 12.1 The recall objective and its gradient flow
- 12.2 DeltaNet: one explicit gradient step
- 12.3 Longhorn: the implicit step
- 12.4 Stability regions: the explicit/implicit dichotomy
- 12.5 Chunkwise parallelization: the WY trick
- 12.6 Gating the delta rule: Gated DeltaNet and Kimi Linear
- 12.7 What’s next
- 12.8 Exercises
- Exercise 12.1 (short)
- Exercise 12.2 (short, code)
- Exercise 12.3 (short)
- Exercise 12.4 (theory) — solution in §12.9
- Exercise 12.5 (theory) — solution in §12.9
- Exercise 12.6 (theory) — solution in §12.9
- 12.9 Full solutions to theory exercises
- Solution to Exercise 12.4
- Solution to Exercise 12.5
- Solution to Exercise 12.6
- 12.10 Companion code
Delta-rule lineage: DeltaNet, Gated DeltaNet, Kimi Linear
12.1 The recall objective and its gradient flow
Chapter 11 ended at a wall (Proposition 11.4): the additive state accumulates and never forgets, so every stored pair interferes with every retrieval through the key overlaps , and no finite state escapes the trend. The closing promise was a smarter write rule. To derive one, stop postulating recurrences and instead ask what the state is for.
The state of every architecture in this part of the book is an associative memory: it should return when probed with . Make that a loss. At time , with the incoming pair ,
Two conventions before anything else. First, shapes: this chapter writes the state as with retrieval — the row-state form used by the DeltaNet literature and by Chapter 3’s low-rank update discussion. Chapter 11 wrote the transposed form (, projector acting on the left); the map converts one to the other, and every claim below transposes with it. Second, the feature map: the delta-rule literature works with the keys directly (typically -normalized) rather than through a kernel feature map ; we follow that and write for what Chapter 11 would call . Nothing in this chapter depends on the distinction — and the normalization choice will turn out to be a stability decision (§12.4).
Gradient descent on in continuous time is the recall gradient flow
a linear (affine) matrix ODE. Its equilibrium is the rank-one matrix that retrieves perfectly:
For a fixed pair with , the gradient flow has fixed-point set , and the minimum-norm equilibrium reachable from is
The flow contracts the deviation in the direction at rate and leaves the orthogonal complement untouched: directions the memory has never been asked about are neither corrected nor forgotten.
The proof is a two-line computation with the substitution (Exercise 12.5 carries it through the discretizations). The inert orthogonal complement is a feature, not a defect — it is persistent memory, and §12.6 will need a gate precisely because gradient flow on the current pair never cleans up stale directions on its own.
Everything in this chapter is now one sentence: DeltaNet, Longhorn, and their gated descendants are different one-step discretizations of this flow, interleaved over a stream of pairs . The architecture zoo becomes an integrator catalog, and the book’s Part-I machinery applies.
12.2 DeltaNet: one explicit gradient step
Take one forward-Euler step of size on the recall flow (Chapter 4’s explicit workhorse), at the incoming pair:
One explicit gradient step is identical to the erase-then-write form
The first form costs one mat-vec plus one rank-one update, per step, and never materializes the projector; the second exposes the mechanism — selective erasure along , then a fresh rank-one write.
The identity is one distribution of terms: . Chapter 3 previewed exactly
this update as the recurring “low-rank correction” pattern — for the factor is a contraction toward
the hyperplane , and at it is the orthogonal
projector onto it. With a learned, input-dependent write
strength and the read , this recurrence is DeltaNet’s state
update Yang et al. (2024)
, the delta rule of fast-weight
programming Schlag et al. (2021)
made into a sequence layer. The
companion’s lax.scan (rank-one form) and a deliberately different
materialized-projector loop agree to over 48 steps — the
two faces are one operator.
What did the erase term buy over Chapter 11’s accumulation? The defining semantics: re-storing a key replaces its value. Write , then , with on a unit key. The erase factor annihilates the old binding before the new write lands, so the delta-rule state retrieves exactly — measured residual — while the additive state retrieves , off by the entire stale residue (measured error on the same data). An additive memory can only pile bindings on top of each other; a delta-rule memory updates them.
The figure is deliberately honest about the limit. With orthonormal keys both rules are exact — the delta rule’s advantage is zero when keys do not overlap — and with random keys both error curves still grow as passes : a rank- state cannot hold more than independent associations no matter how cleverly it writes (Proposition 11.4 still binds). The delta rule answers Chapter 11’s interference problem and its staleness problem (the overwrite), not the capacity bound. That distinction is exactly where Chapter 13’s matrix-memory architectures and Chapter 14’s hybrids will pick up.
12.3 Longhorn: the implicit step
Forward Euler is not the only one-step method, and Chapter 6 taught the alternative. Longhorn Liu et al. (2024) reaches it from the optimization side: frame the update as amortized online learning and solve, at each step, the regularized problem
a trust-region (proximal) step: improve recall on the incoming pair, but do not move far from the state you have. Setting the gradient to zero gives
Read the right-hand form against §12.1: this is the recall gradient evaluated at the endpoint , with step size — the backward-Euler step on the recall flow, the implicit method of Chapter 6.
An implicit equation usually costs a solve. Here the solve is free:
For the backward-Euler equation above has the unique solution
i.e. the implicit step is the delta rule evaluated at the self-limiting rate . In particular and for every key, however large.
The proof (Exercise 12.4, §12.9) is the classic implicit-solve move: right-
multiply the stationarity equation by , solve the resulting scalar
equation for the post-update prediction , and substitute back. In the
companion the identification is structural — longhorn_step simply is
delta_rule_step evaluated at — so the closed form gets
an independent certificate instead: solving the stationarity system
by dense linear solve
(no code shared with the rank-one form) reproduces it to ,
and the closed form zeroes the stationarity residual to
(pinned in
tests/test_longhorn.py::test_closed_form_equals_dense_implicit_solve).
Explicit and implicit methods
on this flow live in the same parametric family — they differ only in how the
effective step size responds to the data. DeltaNet’s is whatever the
network learned to emit; Longhorn’s self-adapts to the
key magnitude. Scaling the key by pushes the product
to ; by , to — approaching but provably never reaching . That
denominator is the entire difference between the two architectures, and §12.4
shows it is exactly the difference between conditional and unconditional
stability.
12.4 Stability regions: the explicit/implicit dichotomy
Both updates iterate an affine map in , so no linearization is needed: with and , a step at the (for now, repeated) pair gives exactly
The iteration matrix is a rank-one perturbation of the identity; its spectrum is immediate.
The matrix has eigenvalue in the direction and on the orthogonal complement. The deviation therefore contracts in the only direction the update touches iff , and:
- DeltaNet (explicit, ): stable iff . Past the boundary the deviation alternates sign and grows geometrically — forward Euler leaving its stability interval, Chapter 5’s picture replayed.
- Longhorn (implicit, ): for every and every key. Unconditional stability — the backward-Euler guarantee of Proposition 6.1, transferred to the online-learning flow. Moreover as : the hardest writes are the most strongly contracted, the L-stability signature.
Because the deviation recurrence is exact — not a linearization — the geometric law is measurable to machine precision. Starting from under a repeated unit-norm key, the per-step ratio measured from the companion equals the analytic radius to twelve digits: for DeltaNet at , for Longhorn at . The trajectories make the dichotomy visceral:
One degenerate-looking feature of Theorem 12.4 deserves emphasis: the orthogonal eigenvalue is exactly for both methods. Neither integrator forgets directions it has not been asked about — stability here is about the write direction only. Whole-state forgetting needs a different mechanism (§12.6).
Why trained DeltaNets are stable anyway. The dichotomy explains a design detail that looks cosmetic in the paper and is load-bearing in the lens: Yang et al. -normalize keys and parameterize Yang et al. (2024) . With that pins — not merely inside the stability interval but inside its monotonically-contracting half. And the per-step guarantee composes, which discharges the repeated-pair scoping above: with every factor has eigenvalues in , so the streaming product over any key sequence is non-expansive — the repeated pair is the worst case, not a special case. The architecture’s normalization choices are its stability guarantee, chosen at design time the way a step-size rule is chosen for an integrator. Longhorn needs no such guard, and that is precisely its selling point: stability by method, not by parameterization — the implicit-method trade Chapter 6 priced out, here with a free solve.
12.5 Chunkwise parallelization: the WY trick
The recurrent delta rule is sequential — fine for inference, hostile to training hardware. Chapter 11 met the same tension and resolved it with a second face of the same operator (Theorem 11.1); the delta rule’s resolution is the same move with one extra piece of numerical linear algebra. Split the sequence into chunks of size and unroll the erase-then-write form across one chunk:
with the chunk’s accumulated writes — the chunk’s own §12.2 recurrence run from a zero entry state, which is exactly how the companion materializes it. The cross-chunk recurrence is now one affine update per chunk ( sequential steps) and everything inside a chunk touches only chunk-local data Yang et al. (2024) . The remaining cost is the erase product — naively a chain of matrix products. But is a product of rank-one perturbations of , and numerical linear algebra has compressed exactly this object for decades:
For keys and rates , the chunk erase product admits the compact form
where the rows of are the keys and the rows of obey the recursion . Applying to a state is then two GEMMs, , never a materialized product chain.
The induction (Exercise 12.6, §12.9) is three lines. The companion pins both identities at machine precision on a stable-regime stream (unit-norm keys, — §12.4’s recommended operating point): the WY form matches the explicitly multiplied product to at worst across chunk sizes through , and the chunkwise driver — cross-chunk state passing with chunk-local sweeps — reproduces the monolithic recurrence bitwise (measured difference for every chunk size , because both run the same scan arithmetic in the same order). As in Chapter 11, the equivalence is the correctness certificate for the production form: one operator, two computation schedules.
The practical punchline mirrors Chapter 11’s: the recurrent form is the inference mode, the chunkwise form is the training mode, and a fused kernel is an engineering refinement of an identity that is already exact in pure JAX.
12.6 Gating the delta rule: Gated DeltaNet and Kimi Linear
Theorem 12.4 left one direction untouched: everything orthogonal to the current key sits at eigenvalue exactly . A delta-rule memory never spontaneously forgets — stale bindings persist until their key is revisited. Chapter 9’s selective SSMs had the complementary skill: a scalar decay that forgets everything, uniformly. Gated DeltaNet Yang et al. (2025) composes the two:
The gate multiplies the erased state; the fresh write lands ungated. Both parents are exact limits, and the companion pins both reductions: recovers plain DeltaNet to , and is pure exponential decay — Chapter 9’s scalar-decay contraction with the carry promoted to a matrix, the same promotion Chapter 11 made for accumulation (Theorem 11.2).
The division of labor is exact, not approximate. Store a pair , then perform gated-delta writes whose keys are orthogonal to : the erase factors never touch the direction, so the retrieval decays only through the gate,
and the companion measures the product law at over forty writes. Gating forgets uniformly (a half-life for everything); the delta rule forgets selectively (exact overwrite of what is re-keyed). An architecture with both has independent control of the two timescales — which is why this update, not the plain delta rule, is what shipped. And the gate does not cost trainability: extending §12.5’s chunkwise/WY machinery to the -decayed erase product is a core contribution of the Gated DeltaNet paper Yang et al. (2025) , so the gated update trains with the same hardware efficiency.
That shipping lineage is current production history, summarized at architecture level. Kimi Linear Kimi Team (2025) builds its KDA (Kimi Delta Attention) layer as a refinement of exactly this gated update — the scalar replaced by per-channel diagonal gates, a finer-grained forgetting clock — and interleaves KDA with full attention at a 3:1 layer ratio, reporting up to a 75% KV-cache reduction at million-token contexts. As of mid-2026 this family — the gated delta rule adopted as the linear layer of public hybrid stacks, KDA in the Kimi Linear release — is the delta rule’s production form. This book derives the update those systems share; their layer-ratio and gate-granularity choices belong to Chapter 14’s hybrid design space, and the chapter makes no derived claims about KDA beyond the gated update above.
Step back to see the family whole. Chapter 9 proved selective SSMs and masked attention are one object (Theorem 9.5); Chapter 11 added the accumulation face; this chapter added the write-rule axis: accumulate (-write only), erase-and-write (delta), decay-erase-write (gated delta) — each one discretization choice on the same recall flow. Two limits now bracket the design space: the pure-decay limit (, an SSM forgetting on a slow clock) and the pure-write limit (attention-like immediate binding). Pilot B’s two-timescale benchmarks live exactly in that bracket — attention as the fast boundary layer, the decaying state as the slow manifold — and Chapters 14 and 16 build the architectures and the measurement protocol for it.
12.7 What’s next
This chapter closed Chapter 9’s “delta-rule lineage” promise and Chapter 11’s capacity hand-off: the write rule is now an optimizer step, and its stability theory is Chapters 5–6 applied to a new flow.
Two threads leave here open by design. Chapter 13 takes the lineage’s next generalization: RWKV-7’s generalized delta rule (transition rank-one in a learned direction, not the key itself) and xLSTM’s matrix memory with exponential gating — the gate moved inside the nonlinearity, with its own stabilization problem. Chapter 14 mixes these layers with attention into the production hybrids named above, where the layer-ratio and gate-granularity decisions we deferred become the design variables; Chapter 16 then builds the evaluation methodology — including the two-timescale protocol pilot B contributes — that makes the comparisons honest.
12.8 Exercises
Three short problems (solutions inline) and three longer ones (solutions in §12.9).
Exercise 12.1 (short)
With , unit key , and values , : compute the delta-rule state after writing then with , and the additive state for the same writes. Verify the retrievals are and respectively.
Solution
First write: . Second write: , so and : the old binding is gone. Additive: , retrieving — the stale residue of §12.2’s measured demo, by hand.
Exercise 12.2 (short, code)
Run companions/ch12/jax/delta_rule.py. Report the overwrite residuals and the
recall errors, then explain in one sentence why the orthonormal-key
panel shows both rules exact.
Solution
The script prints delta-rule overwrite residual against an additive stale residue of , and mean errors (additive) versus (delta). With orthonormal keys, every cross-term () vanishes, so the additive state already retrieves exactly and the erase factors act as the identity on all stored directions — there is no interference for the delta rule to remove.
Exercise 12.3 (short)
For and , compute Longhorn’s , the product , and the radius . Verify the complement identity and state what it says about where the “stable mass” goes as keys grow.
Solution
; products ; radii . Each pair sums to because exactly (the eigenvalue is positive here). As the write share approaches and the radius approaches : large keys are written harder and contracted faster — the L-stable behavior of Proposition 6.1‘s backward Euler, in optimizer clothing.
Exercise 12.4 (theory) — solution in §12.9
Derive Theorem 12.3: starting from the stationarity equation , obtain the closed form by solving for the post-update prediction first. Where exactly does get used?
Exercise 12.5 (theory) — solution in §12.9
Prove Theorem 12.4: compute the full spectrum of , derive the deviation recurrence from either update, and conclude the stability characterizations for both step-size rules. Explain why starting from makes exactly geometric rather than merely asymptotically so.
Exercise 12.6 (theory) — solution in §12.9
Prove Theorem 12.5 by induction on the chunk position, and count the cost of applying to a state via the WY form versus the materialized product, for chunk size .
12.9 Full solutions to theory exercises
Solution to Exercise 12.4
Right-multiply the stationarity equation by :
a scalar-shaped linear equation for the vector (the matrix unknown has collapsed because only appears). Since the coefficient is strictly positive — this is the only place positivity is needed, and it is what makes the implicit solve nonsingular for every key, including . Solve:
Substitute into the stationarity equation rearranged as :
Solution to Exercise 12.5
Spectrum. For any unit vector : , giving eigenvalue with multiplicity . For : , the single non-unit eigenvalue.
Deviation recurrence. Both updates have the form (Theorem 12.3 for Longhorn). Since ,
The affine parts cancel exactly — no linearization, no remainder.
Characterizations. Deviation components along (in the row space) are multiplied by each step; the component along is multiplied by . Convergence of the corrected direction requires , i.e. . DeltaNet’s free can violate this; Longhorn’s cannot, and directly.
Exact geometry from . Then , whose every row is a multiple of : the deviation starts entirely in the contracted direction, with no component on the eigenvalue- complement. Hence exactly — which is why the measured per-step ratios in §12.4 reproduce to twelve digits rather than only in the limit.
Solution to Exercise 12.6
Induction. Base : the empty product is , with empty factors. Step: assume where the rows of are . Then
The correction is rank one with row direction , so append and
which is the stated recursion, and .
Cost. WY application : one GEMM and one GEMM, total, plus the one-time factor build. The materialized product costs to build and to apply: for the WY route wins by a factor on both counts, and — the practical point — both of its operations are GEMMs, the shape hardware wants.
12.10 Companion code
The companions live in companions/ch12/{jax,torch,julia} and are float64
throughout. The JAX modules are canonical and produce all four figures; the
torch modules mirror the three operator updates with cross-framework parity
pinned to ; the Julia module ports the §12.4 stability analysis to a
third language using only the standard library, pinning the same closed forms
and trajectory ratios.
# JAX (canonical; emits the four figures to public/figures/ch12/)
PYTHONPATH=. python companions/ch12/jax/delta_rule.py
PYTHONPATH=. python companions/ch12/jax/longhorn.py
PYTHONPATH=. python companions/ch12/jax/stability.py
PYTHONPATH=. python companions/ch12/jax/chunkwise.py
PYTHONPATH=. python companions/ch12/jax/gated_delta.py
# Tests: JAX identities (< 1e-12), torch parity (< 1e-9), Julia stability suite
.venv/bin/pytest companions/ch12/jax companions/ch12/torch -q
julia --project=companions/ch12/julia companions/ch12/julia/runtests.jl
delta_rule.py— the explicit step, its two algebraic faces, the fixed point, overwrite-vs-accumulate semantics, and the recall comparison figure (§12.1–12.2).longhorn.py— the implicit step via its closed form, verified against an independent dense solve of the stationarity system, plus the structural identity with the delta rule and the exact geometric error trajectories (§12.3–12.4).stability.py— the closed-form spectral radii, the named boundary, and the Rayleigh-quotient drift guard behind the stability-regions figure (§12.4).chunkwise.py— the WY representation, its two-GEMM application, and the chunkwise≡recurrent certificate (§12.5).gated_delta.py— the gated update, both exact reductions, and the uniform-forgetting law (§12.6). The torch mirror’s test file also documents the buffers-vs-Parameters distinction (a learned rate projection is a Parameter; a fixed rate floor is a buffer).