say hi
COMPANION NOTES · A BRIDGE FROM ATTENTION TO STATE SPACE MODELS

What you already know
about attention, inverted.

You know Transformers cold: softmax attention, the KV cache, quadratic training cost. This page exists to get you fluent in the S4 → Mamba → Mamba-2 family fast, by mapping every idea onto something you already have a slot for. The short version: an SSM is what you get when you replace attention's unbounded, ever-growing memory of every past token with a fixed-size state that gets overwritten as it goes — and the 2024 state space duality result proves this isn't a vague analogy, it's a precise mathematical equivalence at one corner of the design space. Everything downstream — the efficiency wins, the recall losses, why the field ended up building hybrids instead of picking a side — falls out of that one structural choice.

polestaterecallcost
Softmax attentionunbounded — every past K,V kept exactlyperfect, by constructionquadratic in sequence length
Linear attention / hybridsfixed-size matrix state, plus a little real attentionpartial — recovers what the attention layers coverlinear, with a small quadratic slice
Pure SSM (S4, Mamba)fixed-size vector state per layer, constant in context lengthbounded — provably, not just empiricallylinear in sequence length
Bounded vs. unbounded state is the root of every downstream tradeoff: the SSM's constant inference memory and its recall ceiling are two consequences of the same design choice.

Part 0 makes that claim concrete with a worked KV-cache number. Part 2 is the part a Transformer expert will likely find most useful: the exact mapping between an SSM's recurrence and a masked linear-attention layer. The rest works outward from there — lineage, complexity, where each architecture actually wins, and where the field has landed as of mid-2026, which is hybrids, not a winner.

a note on sourcing

Every claim, number, and citation on this page traces back to a single research brief compiled from the primary papers (arXiv IDs given throughout). Where the literature is unsettled or a number comes from a vendor blog post rather than a peer-reviewed benchmark, that is flagged explicitly — most fully in Part 7.

PART 00

Bounded state vs. unbounded state

the one fact that explains everything downstream

Causal softmax attention computes, for each query, a weighted combination over every key and value seen so far, with weights set by a row-wise softmax. That normalisation is the entire story: because the softmax couples each query to the full set of past keys, the model must retain every token's K and V exactly in order to compute future outputs. There is no finite summary you can carry forward instead — hence the KV cache, and hence its size growing linearly with sequence length forever.

An SSM (or any linear-attention variant) makes the opposite bet. It compresses everything seen so far into a fixed-size state — a vector (or small matrix) that gets updated, not appended to, at every step. This is cheap and constant, but it necessarily loses information once the sequence exceeds the state's capacity. There is no way around this: it is the direct cost of the memory being fixed size.

0.1 — The KV cache, worked

The standard formula for a Transformer's KV-cache footprint is \(2 \cdot n_{\text{layers}} \cdot n_{\text{kv heads}} \cdot d_{\text{head}} \cdot \text{seq\_len} \cdot \text{batch} \cdot \text{bytes\_per\_param}\). Plug in a Llama-3-70B-class model — 80 layers, grouped-query attention (GQA) with 8 KV heads, \(d_{\text{head}}=128\), BF16 — and the per-token cost is \(2\cdot80\cdot8\cdot128\cdot2 = 327{,}680\) bytes, about 0.31 MB per token. A single-request 128K context then costs roughly 40–43 GB; the same model at 1M tokens costs roughly 327 GB. Without GQA — plain multi-head attention with 64 KV heads — the per-token cost would be about 2.5 MB and a 128K context would need roughly 320 GB. That ~8× reduction from GQA is what makes 70B-class long-context deployment tractable at all. An 8B model (32 layers, 8 KV heads) needs about 16 GB at 128K.

for comparison — the SSM state

A Mamba layer's recurrent state has shape \(d_{\text{inner}} \times d_{\text{state}}\), where \(d_{\text{inner}} = \text{expansion}\cdot d_{\text{model}}\) (expansion 2) and \(d_{\text{state}} = 16\) for Mamba-1. This is constant per layer, independent of sequence length: the entire "memory of the past" for a Mamba-2.8B model is a few MB, regardless of whether the context is 2K or 1M tokens. That is the whole inference-efficiency story in one number — a few MB, flat, against 40+ GB and climbing.

It is worth being honest about the modern comparison rather than the straw man. FlashAttention does not change attention's \(O(n^2)\) compute; it changes the memory by never materialising the full \(n\times n\) score matrix (tiling plus recomputation), making attention's memory footprint \(O(n)\) too. So the fair statement is: SSM \(O(n)\) memory vs. FlashAttention's \(O(n)\) memory, but attention still pays \(O(n^2)\) compute and still grows a KV cache at inference that an SSM simply does not have.

0.2 — A spectrum, not a dichotomy

The 2024 "state space duality" result (Mamba-2; Dao & Gu; arXiv:2405.21060) is the mathematical spine that turns "attention vs. SSM" from a rivalry into a spectrum. It proves that SSMs and a specific class of causal linear attention are two views of the same structured-matrix object — full derivation in Part 2. That means softmax attention (unbounded state) and a pure SSM (fixed state) are two poles of one design space, with linear attention and hybrid architectures occupying the territory in between. Reading the rest of the field through that lens — rather than as "old RNNs vs. new Transformers" — is the single most useful reframe this page can offer a Transformer-fluent reader.

PART 01

Six years, eight papers

HiPPO to Mamba-3, plus the linear-attention family that grew up alongside it

The lineage from a memory-compression theorem to production hybrid models runs about six years. Each step below either made the previous idea cheaper to compute or fixed a capability gap the previous step exposed.

1.1 — The SSM line

HiPPO (Gu, Dao, Ermon, Rudra, Ré, 2020; arXiv:2008.07669, NeurIPS 2020) frames memory as online function approximation: keep the coefficients of the optimal polynomial projection of the signal seen so far, weighted by a measure that says how much each past timestep matters. The HiPPO-LegS (scaled Legendre) measure weights all history uniformly and gives timescale robustness, \(O(1)\) updates, and bounded gradients; it set a then-SOTA 98.3% on permuted-MNIST. Downstream, the HiPPO-LegS matrix becomes the initialisation that lets later SSMs actually capture long-range dependencies instead of behaving like a generic, forgetful linear RNN.

LSSL (Gu, Johnson, Goel, Saab, Dao, Rudra, Ré, 2021; arXiv:2110.13985, NeurIPS 2021) introduced the three views of a linear SSM — recurrent, convolutional, continuous-time — as one trainable layer, but was impractically expensive because it materialised powers of the state matrix (\(\approx O(N^2L)\) work), which directly motivated S4.

S4 (Gu, Goel, Ré, 2021/2022; arXiv:2111.00396, ICLR 2022) made the SSM convolution kernel cheap: it parameterises \(A\) in Diagonal-Plus-Low-Rank form, evaluates the kernel's truncated generating function on roots of unity (a Cauchy-kernel multiply, Woodbury handling the low-rank correction), and applies an inverse FFT — \(\tilde O(N+L)\) instead of \(\approx O(N^2L)\). S4 was the first model to beat chance on Long Range Arena's Path-X (length 16,384) and averaged 80.48% on LRA against under 60% for every Transformer variant at the time.

DSS / S4D (Gupta, Gu, Berant, 2022, arXiv:2203.14343; Gu, Gupta, Goel, Ré, 2022, arXiv:2206.11893 — both NeurIPS 2022) showed the low-rank term can be dropped entirely: a purely diagonal complex \(A\) nearly matches S4 (DSS: 81.88 LRA avg; S4D: ~85%), and with diagonal \(A\) the kernel is just a Vandermonde product computable in a couple of lines.

H3 (Dao, Fu, Saab, Thomas, Rudra, Ré, 2022; arXiv:2212.14052, ICLR 2023) diagnosed why SSMs underperformed on language: they couldn't remember tokens across the whole sequence or compare the current token to earlier ones — the two things attention does natively. H3 stacks a shift SSM (state literally stores the previous token) with a diagonal SSM plus gating, replacing almost all attention in a GPT-style model; scaled to 2.7B on the Pile it beat Transformers on a majority of SuperGLUE tasks and generated up to 2.4× faster.

Mamba (Gu & Dao, 2023; arXiv:2312.00752) is the pivot: make \(B\), \(C\), and the step size \(\Delta\) functions of the input (the resulting layer, S6, is "selective S4"). This gives content-based reasoning — attention's default, not an SSM's — and directly targets the recall gap H3 identified. The cost: selectivity kills the fixed convolution kernel, so training instead uses a hardware-aware parallel scan (SRAM-resident, FlashAttention-style kernel fusion). Reported: ~5× higher inference throughput than Transformers, linear scaling to million-length sequences, Mamba-3B matching Transformers twice its size, and induction-head generalisation to sequences of length \(2^{20}\approx1\)M.

Mamba-2 / SSD (Dao & Gu, 2024; arXiv:2405.21060, ICML 2024) — "Transformers are SSMs" — proves SSMs and a class of attention variants are connected through structured semiseparable-matrix decompositions (the full mechanics are Part 2's subject). Practically, this "state space duality" lets Mamba-2's core layer run as a chunkwise, matmul-heavy algorithm — tensor-core/TPU-friendly — making it 2–8× faster than Mamba-1's selective scan while staying competitive with Transformers, with a larger state (\(d_{\text{state}}\) 64–256 vs. Mamba-1's 16).

Mamba-3 (Lahoti, Li, Chen, Wang, Bick, Kolter, Dao, Gu, 2026; arXiv:2603.15569) advances the SSD line with exponential-trapezoidal discretisation, complex-valued state transitions, and a multi-input-multi-output (MIMO) formulation. Note this is a very recent 2026 preprint — cite it as such.

1.2 — The linear-attention / RNN-revival neighbours

A Transformer-fluent reader should situate the SSM line alongside a parallel family that reaches similar territory from the attention side rather than the recurrence side.

workvenue / yearthe one idea
Linear Transformers ("Transformers are RNNs")Katharopoulos, Vyas, Pappas, Fleuret — ICML 2020kernel feature map \(\varphi\) turns attention into \(\varphi(Q)(\varphi(K)^\top V)\): an RNN with matrix-valued state, \(O(n)\) inference. Conceptual parent of the SSM-attention duality.
PerformerChoromanski et al., 2020random-feature (FAVOR+) approximation of the softmax kernel.
RWKVPeng et al. — EMNLP 2023attention-free RNN with time-mixing / channel-mixing; RWKV-7 "Goose" shipped late 2024, G1 variant early 2026.
RetNetSun et al., 2023"retention": a fixed per-head exponential decay, with parallel, recurrent, and chunkwise computation forms.
GLA (Gated Linear Attention)Yang, Wang, Shen, Panda, Kim — ICML 2024, arXiv:2312.06635data-dependent diagonal gating on linear attention; ships with FlashLinearAttention, faster than FlashAttention-2 even at 1K length.
DeltaNet / Gated DeltaNetYang, Wang, Zhang, Shen, Kim — NeurIPS 2024; Yang, Kautz, Hatamizadeh, arXiv:2412.06464delta-rule update (subtract the old value before writing the new one) to sharpen memory; Gated DeltaNet adds Mamba-2-style decay.
xLSTMBeck et al., 2024revives the LSTM with exponential gating and matrix-valued memory.
BasedArora et al. — ICML 2024, arXiv:2402.18668Taylor-feature linear attention plus sliding-window attention, letting you dial the state size and traverse the recall/throughput Pareto frontier; 24× the generation throughput of FlashAttention-2 at 1.3B while recovering much of attention's recall.
PART 02

The mapping: ODE to attention

the part a Transformer expert will find most illuminating

This is the section worth slowing down for. The underlying object of an SSM is a continuous linear time-invariant system,

\[ \dot x(t) = Ax(t) + Bu(t), \qquad y(t) = Cx(t) + Du(t) \] (1)

with hidden state \(x\in\mathbb{R}^N\), input \(u\), output \(y\). To run this on discrete tokens it must be discretised with a step size \(\Delta\). Zero-order hold (ZOH) gives \(\bar A=\exp(\Delta A)\), \(\bar B=(\Delta A)^{-1}(\exp(\Delta A)-I)\Delta B\); the bilinear (Tustin) transform gives the rational approximation \(\bar A=(I-\Delta A/2)^{-1}(I+\Delta A/2)\). Semantically, \(\Delta\) is the resolution at which the continuous system is sampled: a large \(\Delta\) weights the current input heavily (a focus/reset), a small \(\Delta\) persists old state and mostly ignores the current input. In Mamba, \(\Delta\) is input-dependent — exactly the selective "how much do I care about this token" gate.

2.1 — Three views of the same operator

  • Recurrent (\(O(1)\) per step, \(O(1)\) state): \(x_k=\bar A x_{k-1}+\bar B u_k\), \(y_k=Cx_k\). This is how you run inference — constant memory, no KV cache.
  • Convolutional (parallel over the sequence, for training): unrolling with a zero initial state gives \(y=\mathcal K * u\), where \(\mathcal K=(C\bar B,\ C\bar A\bar B,\ C\bar A^2\bar B,\dots,C\bar A^{L-1}\bar B)\) is the SSM convolution kernel. Because \(\mathcal K\) is fixed for a non-selective SSM, it can be precomputed and applied with an FFT in \(O(L\log L)\) — this is the S4 training path.
  • Matrix / attention-like (the Mamba-2 view): stack the recurrence into \(y=Mx\), where \(M\) is an \(L\times L\) lower-triangular semiseparable matrix with \(M_{ij}=C_i(\bar A_i\cdots \bar A_{j+1})B_j\). This is the SSD view, and it is where the attention connection lives.
the precise duality

Causal linear attention computes \(S_t=S_{t-1}+k_tv_t^\top\), \(y_t=q_tS_t\) — a matrix-valued state accumulating outer products. Add a scalar decay \(\gamma\) (\(S_t=\gamma S_{t-1}+k_tv_t^\top\)) and you have RetNet-style retention. This is exactly a scalar-structured SSM with \(A_t=\gamma I\), \(B_t=k_t\), \(C_t=q_t\). The \(L\times L\) mixing matrix is 1-semiseparable: every submatrix strictly below the diagonal has rank 1, and its entries are cumulative products of the decays. Setting \(\gamma_t = 1\) recovers vanilla causal linear attention (Katharopoulos et al.).

Softmax attention breaks this. The row-wise softmax nonlinearity means the \((i,j)\) weight depends on all keys in that row, so the transformation cannot be written as a fixed-size linear recurrence — there is no finite state \(S_t\) you can carry forward. That is the precise sense in which softmax attention "needs" an unbounded state: it is a structural fact about the nonlinearity, not an implementation detail.

Practically, this duality (SSD; Mamba-2, arXiv:2405.21060) lets Mamba-2's layer be computed with a chunkwise algorithm that is matmul-heavy — split the sequence into chunks, compute intra-chunk contributions as ordinary matrix multiplies, and pass state between chunks with a scan. That's the concrete engineering payoff of the theorem: a tensor-core/TPU-friendly kernel, not just a nice diagram.

An SSM is a linear recurrence with a fixed-size state; unrolled, it is a convolution trainable in parallel; and in the Mamba-2 special case, it is a masked-attention-like matrix. Selectivity — making the recurrence input-dependent — is what kills the convolutional view while adding the content-selectivity attention has by default.
PART 03

Complexity and memory, worked

the real numbers, not the straw-man comparison

Complexity is genuinely better for SSMs, but FlashAttention and GQA narrow the practical gap enough that the comparison needs care, or an expert reader will (correctly) discount it.

axisTransformer (softmax attention)S4 (non-selective SSM)Mamba / Mamba-2 (selective SSM)
Training compute\(O(n^2 d)\)\(O(n\log n)\) via FFT conv (parallel)\(O(n)\) via parallel associative scan
Training memory\(O(n^2)\) naive; \(O(n)\) with FlashAttention (IO-aware; compute stays \(O(n^2)\))\(O(n+N)\)\(O(n)\)
Inference per token\(O(nd)\), grows with context (attends to all past K,V)\(O(Nd)\) constant\(O(Nd)\) constant
Inference state / memoryKV cache grows linearly with sequence lengthConstant (state size \(N\) per channel)Constant (\(d_{\text{model}}\cdot d_{\text{state}}\cdot\text{expansion}\) per layer)
Parallel over sequence in trainingYesYes (FFT)Yes (associative / prefix scan)

3.1 — KV cache, worked

Restating Part 0's number with the full formula in view: \(2\cdot n_{\text{layers}}\cdot n_{\text{kv heads}}\cdot d_{\text{head}}\cdot \text{seq\_len}\cdot\text{batch}\cdot\text{bytes\_per\_param}\). For a Llama-3-70B-class model (80 layers, GQA with 8 KV heads, \(d_{\text{head}}=128\), BF16): per-token cost \(2\cdot80\cdot8\cdot128\cdot2=327{,}680\) bytes ≈ 0.31 MB/token, so a single-request 128K context costs ≈ 40–43 GB (1M tokens ≈ 327 GB). Without GQA — MHA with 64 KV heads — per-token cost is ≈ 2.5 MB and a 128K context needs ≈ 320 GB: the ~8× GQA reduction is what makes 70B long-context deployment tractable at all. An 8B model (32 layers, 8 KV heads) needs ≈ 16 GB at 128K.

FlashAttention does not change attention's \(O(n^2)\) compute; it changes the memory by never materialising the \(n\times n\) score matrix (tiling plus recomputation), making attention memory \(O(n)\). So the fair modern comparison is: SSM \(O(n)\) memory vs. FlashAttention \(O(n)\) memory, but attention still pays \(O(n^2)\) compute and still grows a KV cache at inference. MQA (1 KV head) and GQA (a few KV heads) reduce the KV cache by the head-sharing factor — 8× for Llama-3 — which is why a naive "70B attention needs 320 GB" claim is a straw man: the honest number is ~40 GB, still large, still growing with context, but not catastrophic.

3.2 — SSM state, worked

A Mamba layer's recurrent state has shape \(d_{\text{inner}}\times d_{\text{state}}\), where \(d_{\text{inner}}=\text{expansion}\cdot d_{\text{model}}\) (expansion 2) and \(d_{\text{state}}=16\) (Mamba-1). This is a constant per layer, independent of sequence length — the entire memory of the past for a Mamba-2.8B model is a few MB regardless of whether the context is 2K or 1M tokens.

how the parallel scan recovers training parallelism

Once \(\Delta\), \(B\), and \(C\) become input-dependent, the FFT-convolution path is gone — there is no longer a single fixed kernel to convolve with. Mamba instead computes the selective recurrence with a Blelloch-style work-efficient parallel prefix scan: \(O(n)\) work, \(O(\log n)\) depth, using an associative combine operator over \((\bar A,\bar Bu)\) pairs, run in SRAM with kernel fusion in the spirit of FlashAttention (writing only outputs to HBM). This is exactly what recovers training parallelism after selectivity kills the convolution — worth checking against the SSD chunkwise algorithm of Part 2, which is Mamba-2's answer to the same problem via a different route.

PART 04

Where each architecture wins

recall is the Achilles' heel, and it's provable, not incidental

4.1 — The recall / copying ceiling

Repeat After Me (Jelassi, Brandfonbrener, Kakade, Malach, 2024; arXiv:2402.01032, ICML) theoretically proves a two-layer Transformer can copy strings of length exponential in its size, while any "generalized SSM" with a fixed-size latent state is fundamentally limited by that fixed size. Empirically, pretrained Transformer LLMs dramatically outperform SSMs at copying and retrieving information from context.

Based (Arora et al., 2024; arXiv:2402.18668) and Zoology (Arora et al., 2023; arXiv:2312.04927) establish the MQAR (Multi-Query Associative Recall) benchmark and show a clean state-size ↔ recall Pareto tradeoff: efficient models with a fixed recurrent state (H3, Mamba, RWKV) struggle at recall precisely because the state is fixed, while full softmax attention achieves near-perfect MQAR at any configuration. Recall on real-world language data tracks this synthetic tradeoff.

the result to internalise

The Illusion of State in State-Space Models (Merrill, Petty, Sabharwal, 2024; arXiv:2404.08819, ICML) shows that despite their RNN-like appearance, S4/Mamba-style SSMs cannot express computation outside \(\mathsf{TC}^0\) — the same circuit class that already bounds Transformers. So SSMs cannot solve inherently sequential state-tracking problems (permutation composition / S₅ word problems), and in a single forward pass "cannot accurately track chess moves with certain notation, evaluate code, or track entities in a long narrative." SSMs are not the stateful escape hatch they look like — they are not more expressive for state tracking than Transformers, only differently constrained.

4.2 — Expressivity, the more nuanced picture

The Expressive Capacity of State Space Models (Sarrof, Veitsman, Hahn, 2024; arXiv:2405.17394, NeurIPS) finds SSMs and Transformers have overlapping but distinct strengths: on star-free state tracking, SSMs "implement straightforward and exact solutions to problems that transformers struggle to represent exactly," and can model bounded hierarchical structure with optimal memory without simulating a stack — but the paper identifies a design choice in current SSMs that limits their expressive power, and neither family reaches the \(\mathsf{NC}^1\)-complete "hard state tracking" simple RNNs can express. Chain-of-thought / intermediate-token generation is the known lever to lift both families' limits, trading serial compute steps for missing circuit depth.

4.3 — The Long Range Arena reality check

easy to miss, worth flagging

On Long Range Arena, S4 averaged ~80–86% and was the first to crack Path-X (later versions reach 96.4%); S5, Mega, and gated-linear-RNN variants (HGRN2, 87.66) sit in the same band. Plain Mamba does not do well on LRA in independent runs — one replication reports Mamba ~66.6% average, failing Path-X at 67.3%, and Griffin similarly at ~62.5%. So LRA's synthetic long-range skill does not transfer cleanly from S4 to Mamba — a genuinely surprising result given that both are "SSMs," and one that's easy to bury.

On modern needle-in-a-haystack / RULER-style evaluations, NVIDIA's controlled study found pure Mamba/Mamba-2 lag Transformers on long-context reasoning and on tasks needing copying or in-context learning (5-shot MMLU, phonebook lookup), while the hybrid matched or beat the Transformer across 23 long-context tasks — see the anchor study below.

4.4 — Scaling laws and the empirical anchor

Mamba's own paper reports its models sit on or above the Transformer++ (Llama-architecture) perplexity-vs-compute curve at matched compute up to ~1.3–3B parameters. The most rigorous controlled comparison is NVIDIA's:

An Empirical Study of Mamba-based Language Models — arXiv:2406.07887

At 8B parameters on identical data up to 3.5T tokens, pure Mamba/Mamba-2 match or exceed Transformers on many commonsense tasks (WinoGrande, PIQA, HellaSwag, ARC-Easy, ARC-Challenge) but fall short on copying, in-context learning, and long context. The 8B Mamba-2-Hybrid exceeds the 8B Transformer on all 12 standard tasks (+2.65 pts average) and is projected up to 8× faster at token generation, with +3.5 pts specifically on 5-shot MMLU. The study also notes pure Mamba-1 with a large state ran ~3× slower than Mamba-2.

PART 05

Hybrids: the pragmatic present

a small, nonzero fraction of attention beats both pure architectures — every time

The consistent finding across labs: interleaving a small fraction of attention layers into an SSM backbone beats both pure architectures in every controlled comparison at ≥8B scale.

Jamba — AI21, Lieber et al., 2024, arXiv:2403.19887

First production-scale hybrid Transformer-Mamba-MoE. Ratio 1:7 attention:Mamba, MoE every other layer (16 experts, top-2), 52B total / 12B active, 256K context (trainable to 1M) — structurally 4 blocks of 8 layers, i.e. 56 Mamba + 8 attention layers. Headline efficiency claim: at 256K context, Jamba's attention KV cache is 4 GB vs. 32 GB for Mixtral and 128 GB for Llama-2-70B — a direct consequence of trading 7 of every 8 attention layers for Mamba. It delivers 3× the throughput of Mixtral-8x7B at long context and fits 256K context on a single 80GB GPU with 8-bit weights. Jamba-1.5 (arXiv:2408.12570) scaled to 94B active / 398B total across 72 layers with an effective 256K RULER context and ~10× KV-cache reduction, introducing ExpertsInt8 quantization to fit Jamba-1.5-Large on 8×80GB GPUs at 256K.

Samba (Microsoft, Ren et al., 2024; arXiv:2406.07522, ICLR 2025) — layer-wise Mamba + sliding-window attention; Samba-3.8B trained on 3.2T tokens, extrapolates to 256K context with perfect passkey recall, and improves next-token prediction up to 1M context — 3.73× higher throughput than a GQA Transformer at 128K-prompt processing, 3.64× speedup generating 64K tokens with unlimited streaming.

Zamba / Zamba2 (Zyphra, Glorioso et al., 2024; arXiv:2405.16712, arXiv:2411.15242) — Mamba backbone with a single globally-shared attention block (Zamba2: two alternating shared blocks with LoRA adapters) to minimise parameters; 7B, trained on ~1T tokens. Its efficiency claim is qualitative — "faster at inference, less memory for long-sequence generation" — rather than a single headline multiplier.

Griffin / Hawk / RecurrentGemma (DeepMind, De et al., 2024; arXiv:2402.19427; RecurrentGemma arXiv:2404.07839). Hawk is a pure gated-linear-recurrence RNN (RG-LRU); Griffin mixes RG-LRU with local (sliding-window) attention. Hawk-3B beat the reported Mamba-3B on downstream tasks with half the training tokens; Griffin matched Llama-2 with ~6× fewer training tokens and extrapolates far beyond its training length. RecurrentGemma (2B/9B) is the productised, fixed-state version. The paper is candid that Hawk/Griffin still underperform Transformers on copying / exact retrieval.

NVIDIA's controlled hybrid recipe — arXiv:2406.07887

Verbatim: "Out of 56 total layers, the hybrid model has 4 (7.1%) self-attention layers, 24 (42.9%) Mamba-2 layers, and 28 (50%) MLP layers," with attention layers evenly distributed. A 130M-scale sweep showed validation loss is minimised at a small nonzero attention fraction, and that attention layers specifically supply the copying/ICL capability the SSM lacks.

5.1 — The 2025–2026 production roster

NVIDIA Nemotron-H (arXiv:2504.03624, 8B and 56B/47B hybrids) — "up to 3× faster at inference" than Qwen-2.5/Llama-3.1 at matched accuracy, with Nemotron-H-56B-Base outperforming Llama-3.1-70B on 16 of 17 tasks; a MiniPuzzle prune/distill produced the 47B. Nemotron Nano 2 (arXiv:2508.14444, 9B/12B hybrid reasoning model) builds on the same "replace most attention with Mamba-2" recipe. The Nemotron 3 family (Dec 2025; arXiv:2512.20856 / arXiv:2512.20848; Ultra arXiv:2606.15007) scales the hybrid Mamba-Transformer MoE to Super/Ultra sizes with up to ~6× throughput over comparable Transformer MoEs and 1M context — these are 2026 preprints, cite them as such.

IBM Granite 4.0 (Oct 2025) interleaves Mamba-2 and Transformer at a ~9:1 ratio, removes positional encodings, trains on samples up to 512K tokens, and IBM reports >70% memory reduction for long-context and multi-session inference. IBM Bamba-9B (built with Dao/Gu) reports ~2× throughput over comparable Transformers and outperforms Olmo-7B trained on identical data.

Pure SSMs still ship, but in niches: Mistral Codestral Mamba (7.3B pure Mamba-2 for code, 256K context, Apache 2.0, reportedly beating CodeLlama-34B on code) and Falcon Mamba 7B (TII, Zuo et al., arXiv:2410.05355; trained on 5.8T tokens, the "first competitive attention-free 7B," surpassing Mistral-7B/Llama-3.1-8B/Falcon-2-11B and on par with Gemma-7B on the Open LLM Leaderboard, LLM-Leaderboard-v1 avg ≈ 64.1). No frontier lab ships a pure SSM as its flagship; the frontier trend is hybrid.

5.2 — "Attention = retrieval, SSM = compression"?

partially supported — check the ablation, not the slogan

Falcon Mamba and NVIDIA both frame it as "the general sequence-to-sequence mapping capabilities of SSMs and the fast retrieval properties of attention layers," and NVIDIA's ablations — attention layers specifically recover copying/ICL/phonebook performance — are the best direct evidence. It aligns with retrieval-head and attention-sink analyses in the Transformer literature showing a small number of attention heads do most in-context retrieval, consistent with why only ~7% attention suffices. But this remains an intuition supported by ablation, not a proven mechanistic decomposition — worth holding lightly.

PART 06

Engineering notes

block structure, kernels, distillation, and what serving an SSM actually feels like

6.1 — Block structure

A Transformer layer alternates multi-head attention and a separate FFN, each with its own residual and norm. A Mamba block is homogeneous: an input projection expanding by 2×, a short causal Conv1d (mixing adjacent tokens before the SSM), the selective SSM, a gating branch (SiLU), and an output projection — MLP-style gating and sequence mixing fused into one block, stacked N times with no attention/FFN alternation. Mamba-2 simplifies further (parallel parameter projections, an added normalisation before the output projection, larger SSM heads) to keep the layer matmul-dominant. Typical hyperparameters: expansion factor 2, \(d_{\text{state}}\) 16 (Mamba-1) or 64–256 (Mamba-2).

6.2 — Kernels

Mamba-1 ships selective_scan_cuda — a fused CUDA kernel doing discretisation and scan in SRAM, writing only outputs to HBM (FlashAttention-style IO-awareness). Mamba-2's SSD chunkwise-parallel algorithm splits the sequence into chunks, computing intra-chunk contributions as matmuls and inter-chunk state passing as a scan — why Mamba-2 is more tensor-core/TPU-friendly (GEMM-dominated) and 2–8× faster. The community FlashLinearAttention library (Yang & Zhang) provides Triton kernels for GLA/DeltaNet/etc.

6.3 — Distillation: you can convert a Transformer into an SSM

MOHAWK — Bick, Li, Xing, Kolter, Gu, 2024, arXiv:2408.10189, NeurIPS

Distills a pretrained Transformer (Phi-1.5) into a Mamba-2-based "Phi-Mamba" in three stages — match the mixing matrix, then per-layer hidden states, then end-to-end logits — using only 3B tokens (<1% of from-scratch training). Phi-Mamba (62.6 avg on the reported suite) beats all prior open non-Transformer models at its size.

Mamba in the Llama (Wang et al., 2024) reuses attention projection weights to initialise SSM parameters and distills with ~20B tokens, keeping a quarter of the original attention layers for a strong hybrid. This "quadratic-to-subquadratic" distillation is now a standard route for producing SSMs/hybrids from Llama/Qwen/Ministral backbones — cheaper than training from scratch, and a good sign that the two architecture families are not as far apart, mechanistically, as they look.

6.4 — Inference serving

No KV cache means SSM memory per request is constant in context length, so you can hold much larger batches and get higher throughput on long-context / streaming workloads — the core serving win, and it makes memory-bound decode less punishing.

the acknowledged downside

No cheap prefix reuse. Transformers cache prompt K,V so a shared system prompt is computed once and reused across requests; an SSM's compressed recurrent state is not obviously composable/reusable the same way, so prompt-caching and some speculative-decoding tricks that assume a KV cache don't transfer directly (though the recurrent state can be snapshotted/checkpointed, which some serving stacks exploit as "state caching").

Quantisation / precision. SSM recurrent states are precision-sensitive — Hunyuan-TurboS and others keep Mamba states in FP32 at the kernel level for long-context generation quality, and Jamba's ExpertsInt8 quantises experts while being careful around state precision.

PART 07

Taking stock

the 2026 bottom line, and what would change it

Restated plainly: frame the field as a spectrum, not a rivalry. Softmax attention (unbounded state, perfect recall, quadratic) sits at one pole, pure SSM (fixed state, lossy recall, linear) at the other, with linear attention and hybrids occupying the space between — and the SSD result (arXiv:2405.21060) is the mathematical spine that makes this a spectrum rather than a dichotomy, not just a rhetorical convenience.

The field converged on hybrids, not pure SSMs. Pure SSMs live in niches — code, streaming, ultra-long-context. As of mid-2026, no frontier flagship model is a pure SSM.

That conclusion rests on real evidence, not vibes: the NVIDIA 8B study (arXiv:2406.07887) is the cleanest controlled comparison and directly supports "hybrid wins, ~7% attention is enough," and it pairs with Jamba's 1:7 and Granite's 9:1 to show the attention ratio is a settled design region across independent labs, not a single lucky guess.

7.1 — What would change this

Two concrete results would move the needle. If a pure-SSM model demonstrated Transformer-level 5-shot MMLU and passed RULER at ≥256K context without any attention layers, the "you need attention for recall" conclusion would weaken materially. If a controlled ≥70B comparison — none exists yet; rigorous baselines top out at ~8B in the NVIDIA study and ~34B in Falcon-H1 — showed the optimal attention fraction rising with scale, the "~7% attention" rule of thumb would need revision upward.

7.2 — Caveats

overstated 2023–2024 claims, later tempered

Mamba's "5× throughput" and "matches Transformers twice its size" held at small scale, but the NVIDIA 8B study exposed pure Mamba's clear deficits on recall/ICL/long-context at scale — the community narrative shifted from "Mamba replaces Transformers" (late 2023) to "hybrids are the practical answer" (2024–2026). "SSMs are long-range champions" also does not transfer from S4 to Mamba: S4 excels on LRA while plain Mamba scores ~66% and fails Path-X (see Part 4.3).

"linear time" is about sequence length, not a free lunch

SSM cost is still \(O(\text{seq}\cdot d\cdot N)\): the state \(N\) and the per-step \(d\) work are real costs, and Mamba-1's large-state variants were ~3× slower than Mamba-2 in the NVIDIA study.

expressivity results are about a single forward pass

The \(\mathsf{TC}^0\) ceiling (Merrill et al.) applies without chain-of-thought; intermediate-token generation can lift it, and it applies to Transformers too — so it is a shared limitation, not a Transformer advantage over SSMs.

some numbers are vendor-sourced

E.g. "Codestral Mamba beats CodeLlama-34B" and specific throughput multipliers from lab blog posts — treat these as vendor claims pending independent replication. The KV-cache GB figures in this page are computed from the standard formula and scale with precision: FP8 halves and INT4 quarters every number quoted here.

no controlled frontier-scale comparison exists

As of mid-2026, no controlled ≥70B architecture comparison exists; rigorous head-to-heads top out at ~8B (NVIDIA) and ~34B (Falcon-H1), so any claim about hybrid behaviour at frontier scale is extrapolation, not measurement. Mamba-3 (arXiv:2603.15569) and the Nemotron 3 family (arXiv:2512.20856 / arXiv:2606.15007) are 2026 preprints postdating most peer review — cite them as such.

an author-list correction worth getting right

Two easy-to-conflate details: S4 is Gu, Goel, Ré (no Gupta); S4D is Gu, Gupta, Goel, Ré (Gupta before Goel).

PART 08

References

every arXiv-numbered work cited above
#workarXiv
1Gu, Dao — Mamba: Linear-Time Sequence Modeling with Selective State Spaces2312.00752
2Dao, Gu — Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality (Mamba-2 / SSD)2405.21060
3Lahoti, Li, Chen, Wang, Bick, Kolter, Dao, Gu — Mamba-3: Improved Sequence Modeling using State Space Principles2603.15569
4Gu, Dao, Ermon, Rudra, Ré — HiPPO: Recurrent Memory with Optimal Polynomial Projections2008.07669
5Gu, Johnson, Goel, Saab, Dao, Rudra, Ré — Combining Recurrent, Convolutional, and Continuous-time Models with Linear State Space Layers (LSSL)2110.13985
6Gu, Goel, Ré — Efficiently Modeling Long Sequences with Structured State Spaces (S4)2111.00396
7Gupta, Gu, Berant — Diagonal State Spaces are as Effective as Structured State Spaces (DSS)2203.14343
8Gu, Gupta, Goel, Ré — On the Parameterization and Initialization of Diagonal State Space Models (S4D)2206.11893
9Dao, Fu, Saab, Thomas, Rudra, Ré — Hungry Hungry Hippos: Towards Language Modeling with State Space Models (H3)2212.14052
10Choromanski et al. — Rethinking Attention with Performers2009.14794
11Yang, Wang, Shen, Panda, Kim — Gated Linear Attention Transformers with Hardware-Efficient Training (GLA)2312.06635
12Yang, Kautz, Hatamizadeh — Gated Delta Networks: Improving Mamba2 with Delta Rule2412.06464
13Arora et al. — Simple Linear Attention Language Models Balance the Recall-Throughput Tradeoff (Based)2402.18668
14Jelassi, Brandfonbrener, Kakade, Malach — Repeat After Me: Transformers are Better than State Space Models at Copying2402.01032
15Arora et al. — Zoology: Measuring and Improving Recall in Efficient Language Models (MQAR)2312.04927
16Merrill, Petty, Sabharwal — The Illusion of State in State-Space Models2404.08819
17Sarrof, Veitsman, Hahn — The Expressive Capacity of State Space Models: A Formal Language Perspective2405.17394
18Lieber et al. (AI21) — Jamba: A Hybrid Transformer-Mamba Language Model2403.19887
19AI21 — Jamba-1.5: Hybrid Transformer-Mamba Models at Scale2408.12570
20Ren et al. (Microsoft) — Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling2406.07522
21Glorioso et al. (Zyphra) — Zamba: A Compact 7B SSM Hybrid Model2405.16712
22Zyphra — Zamba2 Technical Report2411.15242
23De et al. (DeepMind) — Griffin: Mixing Gated Linear Recurrences with Local Attention for Efficient Language Models (Hawk/Griffin)2402.19427
24DeepMind — RecurrentGemma: Moving Past Transformers for Efficient Open Language Models2404.07839
25Waleffe et al. (NVIDIA) — An Empirical Study of Mamba-based Language Models2406.07887
26NVIDIA — Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models2504.03624
27NVIDIA — NVIDIA Nemotron Nano 2: An Accurate and Efficient Hybrid Mamba-Transformer Reasoning Model2508.14444
28NVIDIA — Nemotron 3 (family report)2512.20856
29NVIDIA — Nemotron 3 (companion report)2512.20848
30NVIDIA — Nemotron 3 Ultra2606.15007
31Zuo et al. (TII) — Falcon Mamba: The First Competitive Attention-free 7B Language Model2410.05355

Written August 2026, from a single sourced research brief — corrections welcome — l@muehrke.de