↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Block 1 of 12 recorded 12 heads · 64-D r, k̃, v · no softmax · one 64 × 64 state per head, no KV cache
Loading recorded time mix…

What linear attention is

Softmax attention keeps every earlier key and value and compares the new query with all of them, so each new token costs more than the last and the KV cache grows without end. Linear attention drops the softmax. Without it the weighted sum can be regrouped: instead of storing the keys and values, the model stores their running sum of outer products, a fixed-size state, and reads it with the query:

That is a recurrent network: constant memory and constant time per token. Katharopoulos et al. made the connection explicit in 2020. This page records RWKV-7 0.1B, whose time-mixing blocks are a refined version of it: blocks 1, 4, 8 and 12 of 12 are recorded, each with 12 heads that keep one state each, no softmax and no KV cache, on the MHA tab's three prompts.

Receptance, key and value

The Time-mix input strips are each token's vector after the block's norm. The r · k̃ · v bank stands where the Q · K · V bank stands on the other tabs. RWKV's receptance plays the query's part; is the key the token writes into the state, and its value. Each block also computes, from the same input, the decay , a removal key and a rate , which the next section uses.

The row popup shows, beside the model's real mixing weights, the column : what plain linear attention, the formula above, would weigh with no decay and no erasing.

Decay and the delta rule

Plain linear attention never forgets: every token stays in the sum with full weight, and similar keys pile their values on top of each other. RWKV-7 changes the update in two ways:

The decay shrinks each of the 64 key channels of the state at every token, by an amount the token chooses; RWKV-7 bounds it to the range (0.545, 1). The delta rule then erases, before writing, a fraction of what the state holds along the unit direction , so a new key can overwrite what an earlier, similar key stored rather than add to it. The w and δ boxes on the head card open both, channel by channel, for the selected token. Schlag et al. showed that linear attention is a fast-weight memory of limited capacity and proposed this kind of error-correcting write for it; RWKV-7 generalises the write with vector-valued decay and rates.

The token-mixing matrix

Unrolling the recurrence shows what each output takes from each earlier value. With ,

The head card draws as Token mixing A, a causal matrix like an attention map, computed from the recorded quantities; the recording checks it against the recurrence itself. Unlike softmax weights, a row of need not sum to 1 and can be negative, because the delta rule subtracts. The matrix is a way of looking at the model: RWKV-7 never builds it, and runs the recurrence instead.

The state and the output

The State S panel shows a head's whole memory after the last token: numbers, however long the text. Everything the head can recall about the prompt is in there, which is the trade linear attention makes: fixed cost per token, but a fixed-size memory that has to choose what to keep.

The head output is not used directly. Each head's output goes through a GroupNorm, gets a bonus term for the current token's own value, with a learned , is multiplied by a gate and projected by into the Output strips. The toolbar shows the model's next-token prediction: “ to” for Coreference, “ fox” for Repeated phrase and “ Mary” for Two names.

Where it came from

Katharopoulos et al. (2020) wrote attention with a kernel feature map and showed the result is an RNN. Schlag et al. (2021) connected it to fast-weight programmers of the 1990s and brought in the delta rule. RWKV (2023) added a learned time decay and trained the recurrence like a Transformer, in parallel. DeltaNet was made fast to train by Yang et al. (2024), and Gated DeltaNet combined the delta rule with a decay gate. RWKV-7 (2025) generalises the delta rule with vector-valued gating and in-context learning rates. The Transformer Explainer's RWKV-7 tab shows the whole model, and its Kimi K3 tab another delta-rule layer; the Mamba tabs show state-space models, a related way of keeping a fixed-size state.

Papers

  1. Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François Fleuret · ICML 2020 Linear attention: a kernel feature map instead of the softmax, and the recurrent form with a fixed-size state.
  2. RWKV-7 "Goose" with Expressive Dynamic State Evolution Bo Peng et al. · arXiv 2025 The architecture this page records: a generalised delta rule with vector-valued decay and in-context learning rates.
  3. Linear Transformers Are Secretly Fast Weight Programmers Imanol Schlag, Kazuki Irie, Jürgen Schmidhuber · ICML 2021 Linear attention as a fast-weight memory, and the delta-rule update that lets it overwrite.
  4. RWKV: Reinventing RNNs for the Transformer Era Bo Peng et al. · Findings of EMNLP 2023 The first RWKV: a linear-attention RNN with time decay, trained in parallel like a Transformer.
  5. Parallelizing Linear Transformers with the Delta Rule over Sequence Length Songlin Yang, Bailin Wang, Yu Zhang, Yikang Shen, Yoon Kim · NeurIPS 2024 A parallel training algorithm that made delta-rule linear attention (DeltaNet) practical at scale.
  6. Gated Delta Networks: Improving Mamba2 with Delta Rule Songlin Yang, Jan Kautz, Ali Hatamizadeh · ICLR 2025 Combines the delta rule with a decay gate, the same two ingredients as RWKV-7.

See also