Choose useful history
Attention is a sequence-mixing operation: it scores which earlier pieces are relevant to the current piece and combines information from them.
Architecture and execution lineage, 2024-2026
A fixed-size sequence memory compresses earlier tokens into one bounded matrix of numbers. Mamba-2, Gated DeltaNet (GDN), Kimi Delta Attention (KDA), and Gated DeltaNet-2 (GDN2) progressively refine how that matrix is edited. ReplaySSM is a 2026 inference method that runs existing Mamba-2 and GDN recurrences with a different storage schedule. Here decoding means producing output tokens step by step; ReplaySSM speeds that execution without introducing another trained memory rule.
01 / Start with the job
A model reads a sequence one token at a time. At each position, one internal layer must combine the current token with useful information from earlier positions before the model predicts what comes next.
A transformer is a neural-network design built from repeated processing blocks; each block contains layers such as attention and feed-forward computation. Learned parameters are the numbers adjusted during training. A latent representation is an internal numeric description rather than readable text. To decode means to turn an internal representation into an output such as the next-token probabilities.
Attention is a sequence-mixing operation: it scores which earlier pieces are relevant to the current piece and combines information from them.
A recurrence updates one summary at every token. A model built around such repeated state updates is a recurrent neural network (RNN).
Keeping every earlier item preserves detail, but storage and comparison work grow as the sequence grows. Compressing history controls cost, but makes editing and retrieval harder.
A recurrent state is the carried summary. A state-space model (SSM) updates that hidden state from an input and reads an output from it. Structured state space duality (SSD) is Mamba-2's bridge showing that a restricted SSM can also be viewed as a structured form of masked attention and computed efficiently in chunks.
The desired answer is the newest association, room 47. A useful memory update should revise Ada without needlessly damaging Bo or other stored information.
Interpretive teaching example. The papers evaluate related associative-recall and retrieval behavior, but do not use this exact token stream.
02 / Two storage strategies
The architectural choice is easiest to see as a storage decision. Full causal attention retains past key-value pairs. Recurrent linear attention folds each new pair into a bounded matrix.
Each earlier token keeps a key and value. The current query scores all available keys, then forms a weighted mixture of their values.
Each pair updates one state matrix. A query reads the matrix directly; earlier keys and values are no longer individually available.
Many associations must share the same finite matrix. Similar keys can interfere, and obsolete associations can remain unless the update rule knows what to remove.
Sources: Mamba-2 Sections 2.2 and 4.2; GDN2 Introduction and Section 2. The complexity statements describe scaling in sequence length T.
03 / The bridge
Mamba-2 begins from the ordinary selective state-space view: update a hidden state from the current input, then read an output. SSD restricts the state transition enough to reveal an equivalent structured-attention view and a hardware-friendly chunk algorithm.
Equation continues horizontally.
Ada example: the input containing the new room fact changes the carried hidden state; a later query token reads an answer from it.
Visual mapping: the previous-state, current-input, and output roles become the matrix, write pair, and read vector in the next card.
Source: Mamba-2 Section 2.1, Equations (2a) and (2b). Original Mamba-2 notation.
Equation continues horizontally.
Ada example: the fact's key-value outer product enters the running sum; the later Ada query reads from the sum.
Visual mapping: the center matrix below is the running `cumsum(K^T V)` state, and Q is the blue read vector.
Source: Mamba-2 Section 4.2, Equation (14). Original Mamba-2 notation.
More of the memory diagram is to the right.
Visual legend: blue marks key/query directions, green marks persistent state, and amber marks values and outputs. The write uses both 𝒌t and 𝒗t; the read uses both 𝐒t and 𝒒t.
Source: GDN2 Section 2.1, Equation (1), using its key-by-value state orientation.
Equation continues horizontally.
Ada example: the new Ada-room pair is added to the same matrix that already contains the old pair, which can leave stale content.
Visual mapping: 𝒌 and 𝒗 enter the green matrix together; 𝒒 enters through the separate blue read path and produces 𝒐.
Source: GDN2 Section 2.1, Equation (1). This paper's shared comparison orientation is used from here onward.
This page uses the GDN2 paper's orientation: 𝐒 is key-channels by value-channels, a write is 𝒌𝒗T, and a read is 𝐒T𝒒. The original GDN paper stores the transpose, so it writes 𝒗𝒌T and reads 𝐒𝒒. Mamba-2's earlier symbols play corresponding roles: hidden state h becomes matrix 𝐒, B is key-like, input x is value-like, and C is query-like.
04 / The edit problem
With additive memory, a repeated key adds another value instead of explicitly replacing the old association. The delta rule asks the memory what it currently predicts for the key, subtracts that prediction from the target, and writes only the remaining error.
Equation continues horizontally.
Ada example: if the state already predicts room 31 for Ada, the update writes the difference between room 47 and that old prediction instead of blindly adding 47.
Visual mapping: the GDN and KDA ladder branches show beta controlling both the red erase and amber write portions of this residual update.
Source: GDN2 Section 2.2, Equation (5), restating the DeltaNet update in the page's shared orientation.
05 / Four memory rules
The models differ less in what they store than in how precisely they can modify the same bounded state. The selected branch changes the update, gate granularity, and remaining limitation together.
Remaining issue: forgetting is global within a head, and the write does not subtract what the key already retrieves.
Remaining issue: every channel decays together, and the same scalar beta controls both active erase and write strength.
Remaining issue: beta is still one scalar tied across the active key-side erase and value-side write.
Tradeoff: finer control adds projections and a modest constant kernel cost; it does not remove finite-state capacity limits.
Mamba-2 selected: scalar decay and additive write.
Sources: GDN2 Section 2, Equations (4), (6), and (7), plus Section 3.1, Equation (10). KDA's branch is equivalent to the original Kimi Linear Equation (1), transcribed into GDN2's shared comparison orientation.
Equation continues horizontally.
Ada example: all earlier facts fade by the same alpha before room 47 is added.
Visual mapping: the Mamba-2 branch shows one amber scalar spanning all four decay channels.
Source: GDN2 Section 2.2, Equation (4), a restatement of Mamba-2 up to parameterization.
Equation continues horizontally.
Ada example: GDN first fades the state, removes the value currently associated with Ada's key direction, and writes toward room 47.
Visual mapping: the GDN branch shows one decay scalar plus one beta scalar shared by red erase and amber write.
Source: GDN2 Section 2.2, Equation (6), transposed from the original GDN paper's Equation (10).
Equation continues horizontally.
Ada example: some key features can retain old facts while others fade faster before Ada's association is corrected.
Visual mapping: the KDA branch shows four violet decay cells but one scalar beta spanning erase and write.
Source: GDN2 Section 2.2, Equation (7). Equivalent original formulation: Kimi Linear Section 3, Equation (1).
06 / GDN2 under a microscope
GDN2 keeps KDA's channel-wise decay but replaces the single beta with two learned vectors. The erase vector lives on key channels; the write vector lives on value channels.
More of the update flow is to the right.
Formal symbol map: 𝐃 and 𝐒t-1 jointly produce decayed state; 𝒃 and 𝒌 jointly produce 𝒆; 𝐰 and 𝒗 jointly produce 𝒛; decayed state and 𝒆 jointly produce 𝒓; 𝒛, 𝒓, and 𝒌 jointly update 𝐒; 𝐒 and 𝒒 jointly produce 𝒐. The blue curved key path supplies the write direction independently of the erase path.
Sources: GDN2 Section 2.1, Equation (1), and Section 3.1, Equations (8)-(9). Diagram topology follows the decomposed recurrence; spacing and colors are explanatory.
Equation continues horizontally.
Ada example: the erase vector chooses which Ada-like key features inspect old state, while the write vector independently chooses which new value features enter.
Visual mapping: red nodes form 𝒆 and 𝒓; amber nodes form 𝒛; both converge on the green updated state.
Source: GDN2 Section 3.1, Equations (8) and (9).
Equation continues horizontally.
Ada example: GDN2 need not use one beta value for both removing the old association and committing the new value.
Visual mapping: the ladder's GDN2 branch shows independent violet cells on decay, erase, and write rows.
Source: GDN2 Section 3.1, Equation (10), named Gated Delta Rule-2.
Equation continues horizontally.
Ada example: the representation of the correction token determines how strongly each feature erases, writes, and decays.
Visual mapping: the lab displays the resulting gate values, not the learned projection matrices that produced them.
Source: GDN2 Section 3.1, Equations (11) and (12).
07 / Hypothetical matrix lab
This two-key-channel by two-value-channel example uses unit-length keys, invented teaching values, and invented gate values. It calculates the recurrences exactly, but it is not a trained model run or paper measurement.
rows = key channels; columns = value channels
after decay; before erase and write
query output:
Unrelated-key probe after Ada's revision:
Equations implemented: GDN2 paper Eqs. (4), (6), (7), and (10). Inputs and gates are invented for explanation. Runtime values are checked against independently precomputed fixtures; a mismatch raises a browser error.
08 / Same rule, two execution views
The recurrence describes token-by-token behavior. The papers also derive algebraically equivalent chunkwise algorithms so training can use dense matrix multiplications instead of a slow serial loop. Standard autoregressive decoding still advances causally, one accepted token at a time, but the next section shows that the state need not be stored after every step.
More of the execution comparison is to the right.
Dense operations handle tokens within each chunk. A compact state summarizes one chunk for the next.
The fixed state is updated recurrently. No history-sized KV cache is required for these layers.
Conceptual summary from Mamba-2 Section 6, GDN Section 3.3, Kimi Linear Section 3.1, and GDN2 Section 3.3. WY/UT derivations and kernel details are intentionally excluded.
SSD sits inside a block with input projections, short convolution, normalization, an output gate, a residual path, and model heads.
The paper evaluates pure recurrent stacks and hybrids that add sliding-window attention or Mamba-2 layers.
KDA is the recurrent mechanism. Kimi Linear is the larger hybrid architecture, alternating three KDA layers with one Multi-Head Latent Attention (MLA) layer.
The paper evaluates a recurrent-only stack and a hybrid that pairs GDN2 with sliding-window attention (SWA) and multilayer perceptrons.
Sources: Mamba-2 Section 7 and Figure 6; GDN Section 3.4; Kimi Linear Sections 1 and 5.2; GDN2 Sections 3.4-3.5.
09 / Same rule, a different storage schedule
A recurrence specifies the answer a layer must compute. It does not require the implementation to materialize and save the entire new state matrix after every token. ReplaySSM exploits that freedom during inference.
High-bandwidth memory (HBM) is the GPU's large external memory. A kernel is memory-bound when moving numbers to and from HBM, rather than arithmetic, limits its speed. A recurrent layer normally loads and stores a large state matrix each token.
A buffer temporarily holds recent state-building inputs. A flush folds those inputs into one new checkpoint state, writes that matrix once, and clears the buffer.
Speculative decoding proposes several future tokens with a cheap draft path, then verifies them with the main model. A ring buffer stores entries in reusable circular slots, so rejected drafts can be discarded by moving a pointer instead of copying matrices.
Move the token step. This diagram counts full-state HBM operations; it does not estimate wall-clock speed.
Load the previous matrix, update it, read the output, then write the full matrix back.
For Mamba-2, load one checkpoint plus recent inputs and use the output-only route. Save a full state only when the standard-decoding buffer fills.
Token 1 is retained as a small input record beside checkpoint S0. ReplaySSM computes o1 without storing S1.
Source-derived Mamba-2 teaching schedule from ReplaySSM Sections 3-5. GDN follows the same checkpoint cadence but reconstructs state rather than using this output-only route. The four-slot capacity is illustrative; the post reports best standard-decoding buffers of 8 for Nemotron-3 and 16 for Qwen3.5 in its tested settings. Speculative decoding uses a separate early-flush schedule explained below.
For the post's Mamba-2 recurrence, transposed into this page's key-by-value state orientation, let a decay old state, Delta scale a new write, and c combine that write scale with all later decays.
This route produces both the current state and output. ReplaySSM uses it when a flush must create the next checkpoint.
This route forms each key-query similarity first and mixes values directly. It returns the same output without constructing the full new matrix on ordinary Mamba-2 steps.
The post stores values by keys, the transpose of this page's comparison convention:
Here the post defines s to include Delta and subsequent decay. Transposing the state gives the two route cards above; the computation is unchanged.
Source: ReplaySSM Sections 3 and 5.1. The post's equations are unnumbered, so this section does not invent equation IDs or add them to the numbered paper ledger.
With 4-byte state entries, loading and storing a d by n state costs a dominant 8dn bytes per head. ReplaySSM still loads the checkpoint but avoids its store on most steps, leaving 4dn plus smaller input-buffer traffic.
The ring pointer advances past accepted drafts and ignores rejected entries. No full state snapshot is restored for each rejected token.
In the post's speculative schedule, a window of T drafts flushes early when h + 2T > L, preserving room for the next full window. This is not the four-token standard schedule above.
Both avoid a separate full-state write for every draft, but GDN does not use Mamba-2's simple output-only path.
The authors demonstrate ReplaySSM for Mamba-2 and Gated DeltaNet in a public vLLM research fork. They list GDN2 support as future work; the post does not evaluate Kimi Delta Attention. ReplaySSM changes inference execution, not model weights, training, memory quality, or benchmark accuracy.
All values below are author-reported in the June 2026 post, not independently replicated here.
End-to-end per-step speedup is baseline step time divided by ReplaySSM step time for the whole model. Above 1 means ReplaySSM is faster.
Throughput speedup is ReplaySSM output tokens per second divided by ordinary non-speculative decoding throughput.
Request capacity compares the maximum concurrent requests supported by ReplaySSM and the baseline speculative path at the same memory budget.
Across evaluated Nemotron-3 Mamba-2 and Qwen3.5 GDN models from 4B to 550B.
Large NVFP4 models on B300, using model multi-token-prediction drafters and a four-token speculative window.
Versus the baseline speculative path under a fixed HBM budget.
Source: ReplaySSM Section 6 and Figures 6-11. Standard tests use H100 or B300, FP32 SSM states, BF16 or NVFP4 models, CUDA Graph, and buffers of 8 or 16. Speculative throughput uses GSM8K prompts, temperature 0, window 4, and sweeps serving batch size up to 512. These measurements isolate serving efficiency, not model quality.
10 / What the GDN2 paper measures
GDN2 compares recurrent-only versions of these rules at 1.3B parameters, trained with the same recipe on 100B FineWeb-Edu tokens. FineWeb-Edu is a filtered educational web-text corpus. These are author-reported preprint results, not independent replication.
Average accuracy is the percentage correct averaged over LAMBADA next-word accuracy and eight listed common-sense reasoning tasks. Higher is better.
Multi-key needle-in-a-haystack from RULER tests whether a model retrieves a requested association among distractors. Retrieval accuracy is percent correct; higher is better.
The recall average is mean accuracy over six extraction and question-answering tasks listed in GDN2 Table 4. It is not an average of the neighboring synthetic columns.
Matched recurrent-only models, percent accuracy.
Source: GDN2 Table 2. Axis is truncated to the displayed 0-60 range through proportional bar lengths; read exact labels.
MK-NIAH-1, recurrent-only, percent accuracy.
Source: GDN2 Table 3. Axis uses a displayed 0-40 range; exact values are printed.
GDN2 recurrent-only gate-structure ablation. The parameter count is held fixed while one gate is averaged across channels.
More table columns are to the right.
| Variant | Channel-wise erase | Channel-wise write | Recall average |
|---|---|---|---|
| write-only channel structure | no | yes | 28.92 |
| erase-only channel structure | yes | no | 29.51 |
| full GDN2 | yes | yes | 29.88 |
Sources: GDN2 Table 5 for ablation values; Table 4 for the six-task recall-average definition. The erase-only variant recovers more of the full result than write-only at this scale.
The Kimi Linear paper's 48B-total / 3B-active hybrid is not on the matched charts above. At 1M context it reports a measured 2.3x batch-one decoding speed over MLA. It also estimates an up-to-6.3x larger-batch decoding speedup from reduced memory use, with associated time-per-output-token values of 1.84 ms versus 11.48 ms. The former is an author-reported measurement; the latter is a theoretical estimate in the paper.
11 / Limits
More precise gates improve editing, but a fixed matrix still compresses an unbounded stream. Information can collide or disappear.
Needle tasks isolate memory behavior. Better scores do not by themselves establish reasoning, factuality, or robust long-document understanding.
The model must learn good decay, erase, and write values from data. Extra control only helps when those predictions are useful.
ReplaySSM can delay state materialization and verify a drafted window in parallel, but accepted outputs still depend on earlier accepted tokens. It does not make future tokens independent.
Kimi Linear and GDN2 hybrids retain attention layers because direct local or global token access complements compressed memory.
The May 2026 study is controlled at 1.3B parameters and 100B tokens. Larger-scale, independent replication remains open.
The model lineage gives fixed-size memory finer control over what fades, erases, and writes; ReplaySSM shows that the same recurrence can be served by briefly retaining inputs and materializing state only when needed.
12 / Primary sources
This explainer teaches the recurrent memory-update lineage and ReplaySSM's decoding idea. It intentionally excludes the full semiseparable-matrix proof, continuous-time discretization, WY/UT derivations, gate-aware backward pass, full Triton kernel listings, Mamba-1, Mamba-3, and exhaustive benchmarks.