Why use linear attention? Start with how a standard decoder-only Transformer stores history during generation. For the hidden state of token , the attention layer uses three linear projections to produce , and . The query is used only for the current read and is not written to the cache. The new key and value must remain available to every later token. The figure below uses the convention that each token occupies one matrix row: once the old cache has rows, and become row of and , respectively. The KV cache therefore grows linearly with sequence length and creates substantial memory pressure.
Figure 1: A new token produces the current query, key, and value. only performs the read, while and each append one row to the existing cache. With a transposed implementation layout, the same operation appears as appending a column.
Suppose the old cache contains rows. When a new token arrives, the complete update is
The phrase "append one row" is the key to understanding the KV cache. At step , the model computes only the new and instead of recomputing the first rows, but it must append both rows to the cache. When token arrives, its query reads all rows. Consequently, the cache of every layer and head grows as with context length , and the attention read for each new token also grows with . During training or prefill, every query is paired with every key, giving leading compute . FlashAttention reduces the memory traffic and materialization cost of the attention matrix, but it does not remove these token pairs or the growth of the KV cache.
Linear attention changes precisely this storage rule of "add one more K/V row for every token." A separable feature map allows the attention computation to be reassociated, so each new key-value pair can be merged immediately into the same fixed-size matrix state. The next image comes from the KDA paper. For now, ignore the detailed decay and erase gates; the important visual distinction is that the blue state matrix on the left is updated in place into the blue state on the right, rather than extended with another row along a time axis.
Figure 2: cropped from Section 3 of Kimi Linear. The blue matrix is the fixed-size state; orange vectors describe the current token's write and read operations.
A new token no longer appends one row to K and another to V. Instead, the outer product modifies the same state. A query no longer scans all historical rows either; it multiplies the state directly. Normalized variants also maintain a fixed-size accumulation vector, but that vector likewise does not grow with . For fixed channel dimensions, storage and single-step computation no longer depend on the number of previous tokens, so total computation is linear in .
This change is also the source of the tradeoff. A Transformer retains the K/V row of every token and can access a particular historical position precisely. Linear attention makes all history share one finite state and is therefore lossy fixed-state compression. The DeltaNet family usually absorbs into and . The rest of this post uses , , , and the readout . For a chunk of length , uppercase and stack tokens by row.
Pure addition can only accumulate. If the state already records "key A maps to value 2" and later receives "key A now maps to value 8," it superposes the old and new answers instead of replacing the old one. The path from DeltaNet to Gated DeltaNet-2 answers three questions about a fixed state: how to overwrite an old association, how to execute many overwrites in parallel on a GPU, and how finely forgetting, erasing, and writing should be controlled.
Ordinary linear attention removes the growing KV cache, but exposes the first memory-management problem: its state can accumulate associations but cannot replace them. Suppose the state already stores “key A maps to 2,” and later the same key A maps to 8. An additive update superposes both writes. DeltaNet's central claim is: do not write the new value unconditionally; first read the current answer, then write only the error between the new and old answers back to the same key address.
Let be the state matrix. For the current key and target value , the old state's prediction is
The most direct local objective for making this prediction approach is the squared error
This objective does not train the entire network; it explains how the current token edits the fast-weight state. Define . A state element affects the loss only through the term in output dimension , so the matrix gradient is
Starting from , take one gradient step with the token-dependent write strength :
This is the Delta Rule. The residual in parentheses answers “how wrong is the old answer?”, the left factor answers “which address should change?”, and answers “how strong is this edit?” Here is not the optimizer's global learning rate. It is a per-token gate predicted by the slow network, commonly parameterized as . Removing the old read reduces the rule to additive linear attention that writes without erasing.
Expanding the residual makes the erase-then-write structure explicit:
The first term erases the old read along the current key, and the second writes the new value along that same key. For any test direction ,
If , the right-hand side is zero, so this edit leaves that direction unchanged. If in addition , the new read at the current key is
Thus, with a normalized key, has an exact interpolation meaning. Without key normalization, the effective step becomes , so an overly large key norm can cause excessive erasure.
A minimal calculation checks every quantity. Let , , , , and . The old read is , the residual is , and the write-back is
The current-key direction moves one quarter of the way from 2 toward 8, while the orthogonal direction remains 4. The 2021 paper directly tested this overwrite behavior with repeated-assignment tasks. On WikiText-103 small, the additive Linear Transformer obtained test PPL 38.3, the Delta Network 35.5, and the Transformer 34.1. The evidence supports “error-based writing improves over the corresponding additive update,” not “early DeltaNet already surpassed Transformers in general.”
DeltaNet still leaves two independent gaps. First, despite its appealing memory semantics, it must execute sequentially and therefore underutilizes GPUs during training. Second, it edits only the direction hit by the current key; stale content unrelated to that key does not disappear proactively. The first gap leads to Parallel DeltaNet, and the second to Gated DeltaNet.
Parallel DeltaNet does not fix an inadequate memory rule; it fixes the inability to train that same rule efficiently. Computing every token's residual in parallel would be wrong, because residual must read the state after the first edits. If every position reads the chunk-entry state , the Delta Rule's model semantics change. The paper's central claim is therefore precise: keep the token-by-token Delta update exactly unchanged, but rearrange the serial dependence inside a chunk into a few matrix multiplications and one unit-lower-triangular solve.
Index local positions by and define
Here is the erase transition and the second term is the new write. The way to understand the later symbols is not to memorize the paper's final formula, but to ask what remains after composing affine maps. Expanding the first two steps gives
The result naturally separates into “what remains of the entry state after consecutive erasures” and “what remains of the in-chunk writes after later erasures.” Define
For , the empty product is the identity. transports the history entering the chunk, while accumulates in-chunk writes. They are not additional memories; they are the two unavoidable parts of the unrolled recurrence.
This alone is not enough. Explicitly constructing and for every still creates many small matrices. Why look for a WY form? Every is identity minus a rank-one term, and every write has as its left factor. All changes therefore remain in the subspace spanned by the chunk's keys. The natural target is to store only the outer-product coefficients associated with those keys:
The vectors and are not arbitrary auxiliaries. Coefficient matching forces their definitions so that the outer-product form remains valid after step . Suppose . Then
To keep the last term in the form , its right factor must be
or equivalently
The write contribution obeys the analogous recurrence
Substitute and collect the coefficient of the newly introduced :
Therefore
is called a pseudo-value because it is not the raw value. It has already subtracted the old read induced at the current key by earlier effective writes, so it carries both “write new content” and “cancel the old association.” describes how the same edits erase the entry state. Both recurrences use because and are acted on by the same . If two keys are orthogonal, the inner product is zero and edit does not need to correct edit .
A two-step example shows why a pseudo-value may contain negative components. Let , , and . Then let and . The first step gives . Because the two keys coincide,
The effective value at that key becomes , exactly the 50% interpolation between the old and new values. The negative component is not “negative memory”; it is the cancellation required to overwrite the old answer.
At this point the vectors and are still recurrent in . Why does a triangular system appear next? Quantity depends only on earlier positions . Stacking these causal equations by row therefore produces a strictly lower-triangular coefficient matrix. Use the row-stacking convention
where and . Define
Thus only when . The matrix must multiply the Gram matrix on the left because belongs to equation and scales row ; putting it on the right would incorrectly use . Moving the recurrence for to one side and transposing yields
This is exactly row of a matrix equation, so all recurrences become
For , write :
The first row gives ; the second subtracts position 1's influence from position 2; the third subtracts the influences of positions 1 and 2 from position 3. The triangular system introduces no new model computation. It only packages causal recurrences into an object that can be solved in batches. Let
Then
is neither a transpose symbol nor a learned parameter. measures the contribution of raw key/value pair to effective coefficient . The inverse is compact notation: implementations exploit the unit-lower-triangular structure of and use forward substitution rather than a general matrix inverse, leaving most work as matrix multiplication.
The compact factors can now be assembled into the chunk update. Since
we obtain
Define the net update
Here is the effective in-chunk write, while is the old read that those edits must erase from this particular entry state. The exit state and all in-chunk outputs are
reads history from before the chunk. computes causal in-chunk query-key correlations, and multiplying by reads the net edits that have occurred so far. Tokens inside a chunk are therefore processed with large parallel matrix operations; only chunk exit states remain recurrent across chunks. Setting recovers token-by-token recurrence. An excessively large makes the correlations and triangular solve expensive, so chunk size trades off parallelism, the local quadratic term, and hardware utilization.
The complexity follows directly from the shapes. Token-token correlations and the triangular path cost about per chunk, while interaction with the state costs about . Across chunks,
“Parallel” does not imply fewer total FLOPs; the term remains. The main gain is replacing small serial state updates with about recurrent boundaries and mapping the in-chunk work to GPU-friendly GEMMs. The authors report roughly 4–36× speedups for their chunkwise kernel over their recurrent kernel, but this is not an end-to-end speedup over Transformers. Their 1.3B model is still about 19% slower than Transformer++ at 2K and about 28% faster at 16K. Chunkwise computation fits training and long-prompt prefill; during autoregressive decoding, where only one new token arrives, directly maintaining is more natural.
Parallel DeltaNet has now solved “how to execute the Delta Rule efficiently” without changing its memory policy. Only the direction hit by the current key is overwritten; stale content unrelated to that key can still occupy the fixed state indefinitely. That is the problem addressed next.
Parallel DeltaNet makes directional overwriting trainable at high throughput, but it does not answer when an old background should be cleared proactively. The Delta Rule is precise: it edits only the current-key direction. The cost is that when the topic changes, stale content in other directions remains in the limited state. A Mamba2-style scalar decay has the opposite bias: it can quickly shrink all history, but it cannot replace one association according to the old read at its key. Gated DeltaNet's core claim is: let scalar decay perform global clearance and let the Delta Rule perform local correction; these are complementary memory operations, not competing ones.
First decay the old state with a head-level retention rate , then apply the same Delta correction to the decayed state:
Combining the two gives
answers “how much of this head's entire history should remain?”, while answers “how much should the current-key direction be rewritten?” If , every direction orthogonal to is scaled by , while the current-key direction receives the extra factor . This is the exact division of labor between global forgetting and directional erasure.
Why start with a scalar rather than a more expressive vector gate? The scalar is weaker expressively, but it commutes with every matrix:
The cumulative decay can be factored out of the WY/UT rank-one product, preserving almost all of Parallel DeltaNet's chunkwise structure. Replacing it immediately with an arbitrary diagonal matrix would generally make decay and the rank-one edit non-commutative and break that derivation. KDA's main algorithmic task is to handle exactly this difficulty.
The authors use three S-NIAH failure modes to show why the two operations are complementary:
Method
Simple retention S1@8K
Heavy interference S2@4K
Complex value S3@2K
DeltaNet
98.8
18.6
47.0
Mamba2
30.4
56.2
47.6
Gated DeltaNet
91.8
92.2
84.2
The authors point out that DeltaNet is best when a simple association should be retained for a long time without forgetting. Under heavy interference, it collides because it lacks global clearance. Complex values also require precise error-based writing, so decay alone is insufficient. GDN is stronger on average, but the drop on S1 from 98.8 to 91.8 also shows that an incorrect forgetting decision can damage useful memory. The 1.3B/100B-token experiments support that pure GDN is stronger overall than Mamba2 and DeltaNet while having similar training throughput to DeltaNet. Pure GDN still trails attention or hybrid models on real retrieval, so it improves fixed-state management without removing the capacity limit.
GDN's next bottleneck comes directly from its hardware-friendly scalar gate: every key channel within a head must decay at the same rate. It cannot keep some channels long-lived while refreshing others quickly. KDA turns this global forgetting decision into channel-wise forgetting.
Gated DeltaNet can decide when an entire head should forget, but a single forces all key channels in that head to have the same lifetime. One can picture a row of memory slots controlled by one master valve: closing it makes every slot forget quickly, while opening it makes every slot persistent. Kimi Delta Attention (KDA) makes the following claim: give every key/state channel its own long-term retention rate, while constraining the transition to a diagonal-plus-rank-one form that remains efficiently parallelizable.
Let and define a diagonal decay on the key axis:
KDA first decays the old state channel by channel and then performs a Delta correction:
Combining them yields
Two details are easy to misread. First, the quantity promoted to a vector is the long-term decay ; the active edit strength remains scalar. Second, left-multiplies the state, so it controls key/state rows rather than gating individual value dimensions. Setting reduces KDA to Gated DeltaNet.
Why not simply replace GDN's scalar with a vector and stop? In general,
Scalar decay factors out of a product of rank-one transitions, whereas diagonal decay becomes entangled with every erasure. KDA's key algorithmic contribution is not merely predicting a longer gate. It finds a change of variables that absorbs cumulative channel-wise decay into the two sides of the key, returning the recurrence to a generalized rank-one form that Parallel DeltaNet can handle.
Within a chunk, define cumulative retention
and write
Since , substitute this expression into the KDA recurrence and left-multiply by . Define
where multiplication and division are elementwise. The normalized recurrence becomes
What does this transformation accomplish? is the write address with cumulative decay removed, while is the erase/read direction carrying cumulative decay. They are no longer identical, but the transition is still identity minus rank one. Parallel DeltaNet's central machinery can therefore be reused: construct a strictly lower-triangular system from the causal inner products , solve for pseudo-values and erase coefficients, and restore at the chunk boundary. This is an exact reparameterization of the same recurrence, not an approximation.
KDA can also be viewed as a constrained DPLR (Diagonal-Plus-Low-Rank) transition. gives channels distinct lifetimes and the rank-one term edits the current key. KDA does not use two fully free low-rank factors because a general DPLR transition, although more flexible, needs more decay-adjusted correlation matrices, secondary chunking, and matrix multiplications. The authors report that their KDA kernel is about faster than their general-DPLR implementation at 64K. This is a kernel comparison, not the same multiplier for the full model.
Cumulative normalization has a clear cost. If some becomes very small, may overflow at low precision. The constrained DPLR structure reduces the number of paths that require stabilization but does not eliminate the division; practical implementations still need higher-precision accumulation or secondary chunking.
The complete Kimi Linear model is not pure KDA. It uses three KDA layers for every global MLA layer. The authors explicitly acknowledge that a fixed state still struggles with lossless arbitrary long-range retrieval, so KDA cheaply compresses most history while periodic MLA layers retain token-level global access. In the mixture-ratio ablation, pure MLA, 1:1, 3:1, 7:1, and 15:1 obtain validation PPL 5.77, 5.66, 5.65, 5.70, and 5.82. The 3:1 ratio is the best trade-off in that recipe, not a theoretical constant. Speed figures also need separate scopes: KDA-kernel speed, single-request decoding, and system throughput after spending saved KV-cache memory on larger batches are different measurements.
KDA answers “how quickly should different key channels forget?”, but one active Delta edit still has only one : how much old association to erase and how much new value to write remain tied to the same scalar. Gated DeltaNet-2 separates these decisions.
KDA's channel-wise gate controls long-term decay; it does not refine the current active edit. Using the same for both erase and write imposes two constraints. The model cannot erase an old association without writing the entire new value, and it cannot write only selected value channels without accepting the same erasure strength. Gated DeltaNet-2 (GDN2) claims that long-term decay, reading and erasing an old association, and writing a new value are three distinct problems that should be controlled by gates on different axes.
Keep KDA's per-key-channel decay
and define
is the key/erase-side gate: it chooses which key channels participate when forming the old read to be erased. is the value/write-side gate: it chooses which new-value channels become the write target. The complete update has four steps:
In plain language: first decay the old state along the key channels; then use the gated erase key to read the old content that this edit intends to replace; subtract that read from the gated new value to obtain a residual; finally write the residual along the address specified by . Combining the four steps gives
The easiest point to misunderstand is the role of . It does not directly zero selected state rows. It changes how the old read aggregates the key axis. The actual state change remains the rank-one outer product . The write address is still ; GDN2 adds channel selection on the erase/read and value/write sides rather than replacing the rank-one edit with an arbitrary matrix update.
A two-dimensional example makes the axes explicit. Let the decayed state be , with , , , and . Then
The residual is , so
controls how much old content is read from the key axis, determines which targets on the value axis enter the residual, and selects the address receiving that residual. The three roles are not interchangeable.
The reduction relationships expose how the family is nested. If
then and , so GDN2 reduces to KDA. Further setting gives Gated DeltaNet, and setting gives DeltaNet. This proves strict inclusion of the parameterizations; whether training can exploit the added freedom still requires empirical evidence.
Why can two vector gates remain parallelizable? Apply the same cumulative-decay normalization as KDA inside a chunk, defining and . The recurrence becomes
This is still a generalized rank-one recurrence, so Parallel DeltaNet's main chain—causal inner products, a unit-lower-triangular system, pseudo-values, and a chunk update—can be reused. The interference coefficient changes from to , and the write and erase auxiliaries share the same triangular system. The full WY/UT derivation is not repeated here because its computational reason is the same as in Parallel DeltaNet.
The authors' ablation supports a role for both gates:
Variant
Wiki PPL ↓
S3@2K ↑
Multi-key@4K ↑
Real-retrieval avg. ↑
Channel-wise , scalar
16.55
71.4
30.6
28.92
Channel-wise , scalar
16.12
84.6
35.2
29.51
Channel-wise and
15.90
89.8
37.8
29.88
The experiments suggest that key/erase-side selectivity provides the larger gain, with the value/write gate adding further improvement. The paper does not establish that any specific channel has a fixed semantic role. The extra expressivity is not free: on a single H100 with a 1.3B hybrid model, GDN2 is about 4.5% slower than KDA at 2K and 6.2% slower at 16K because vector gates live inside channel reductions and require a gate-aware backward pass and fused kernels. The current evidence is still limited to 1.3B/100B training and synthetic contexts up to 8K. It does not show that fixed states can preserve arbitrarily long histories without loss, nor does it establish final million-token serving latency.
We can now answer the opening question directly. Linear attention replaces a KV cache that grows with the sequence by a fixed-size state, changing history from explicit per-token storage into lossy compression inside a finite matrix. The research line is therefore not merely a search for another linear formula. It asks how a finite state can be edited and forgotten, and how those operations can run efficiently on GPUs.
DeltaNet first fixes the inability of additive updates to replace an old answer: read the value at the current key and write only the residual. Parallel DeltaNet does not change this memory rule. It expands the affine recurrence, matches compact WY coefficients, and stacks causal dependencies into a unit-lower-triangular system so that the same semantics can be trained chunkwise. Gated DeltaNet adds a commuting scalar decay to combine global clearance with directional overwrite. KDA refines long-term decay to the key-channel level and uses cumulative-decay normalization to recover a generalized rank-one structure. GDN2 finally separates the erase/read and value/write sides of the active edit.
The main line can be compressed to
What the authors establish most firmly is the algebraic relationship among the recurrences, Parallel DeltaNet's exact chunkwise equivalence, and kernel or training throughput under specific hardware configurations. Experiments support that finer control uses finite capacity more effectively under heavy interference and repeated overwrites, but they do not show that the capacity limit has disappeared. Kimi Linear still retains one global MLA layer for every three KDA layers, and strong GDN/GDN2 configurations often mix in sliding-window attention. The practical conclusion remains a division of labor: linear states provide cheap compression and most temporal mixing, while attention handles the parts that need precise token-level access.