IN THIS BREAKDOWN · 10 SECTIONS
You can read 24% of this breakdown.
The paper in one minute
Transformers dominate sequence modeling, but attention compares every token with every other one. Training cost grows with the square of the sequence length, and generation needs a KV cache that grows with every token. Many linear-time alternatives exist, and structured state space models (SSMs) such as S4 were the strongest of them: a hidden state is updated at each step as h = Ā·h + B̄·x, and output as y = C·h. They excelled at long continuous signals like audio but lagged on text.
Albert Gu at CMU and Tri Dao at Princeton pinned the weakness on one property. Earlier SSMs are linear time-invariant: the same Δ, A, B and C apply at every position. That lets them run as one long convolution, which is fast, but it also means they cannot decide, based on content, to keep one token and ignore the next. Two synthetic tasks make the point: selective copying (remember the colored tokens scattered among noise) and induction heads (after "Harry Potter ... Harry", predict "Potter").
Mamba's fix, the selection mechanism, makes Δ, B and C functions of the current input. A large Δ lets the input in and largely resets the state; a tiny Δ lets the state pass through unchanged. With N=1 this reduces exactly to a gated RNN. The cost is losing the convolution form, so the authors wrote a hardware-aware scan: load the parameters into fast on-chip SRAM, discretize and run the recurrence there with a parallel scan, write only outputs back to GPU memory, and recompute intermediate states in the backward pass. The Mamba block merges the SSM layer with a gated MLP-like structure and is stacked with no attention at all.
Mamba solved both synthetic tasks, extrapolating induction heads from 256 to a million tokens. On language, it matched a modern Transformer recipe in scaling studies up to 1.3B parameters and beat same-size open models at 2.8B. It also set best results on DNA and audio modeling.
Research notes: the problem, approach and results
six-task zero-shot average, Mamba-2.8B against Pythia-2.8B, both trained on 300B Pile tokens
perplexity of a 350M model with no selective parameters against selective Δ, B and C (Table 7)
inference throughput over a Transformer of similar size, from larger batches without a KV cache
Transformers' attention costs grow with the square of sequence length in training and need a KV cache that grows linearly at inference. Linear-time alternatives (linear attention, long convolutions, earlier state space models) had not matched attention on language, because their fixed dynamics cannot decide what to keep based on content.
Make the state space model's step size Δ and its B and C maps functions of the current input, so it can let a token in and reset, or ignore it. That breaks the fast convolution form, so compute the recurrence with a parallel scan that keeps the expanded state in GPU SRAM and recomputes it in the backward pass. Stack one simple block, with no attention or MLP.
On the Pile, Mamba matched a strong Transformer recipe in scaling up to 1.3B parameters. Mamba-2.8B averaged 63.3 on six zero-shot tasks against 59.1 for Pythia-2.8B and 61.7 for Pythia-6.9B, with 4 to 5 times the inference throughput of a same-size Transformer. It also led on DNA and audio benchmarks.
Why it matters to an FDE
You will meet Mamba-style layers inside production models rather than as standalone Mamba checkpoints: several current open models mix linear-time layers with a few attention layers. Knowing what they buy and give up helps when sizing serving or choosing a model.
No KV cache means bigger batches. A Transformer's memory per sequence grows with context length; an SSM's state is fixed. For long contexts and high concurrency, that is the difference between a handful of sequences per GPU and thousands, and it is where the paper's throughput gain comes from.
Long inputs get cheaper. Linear-time training and constant-time generation steps matter for long logs, genomic data, audio and long documents.
Exact recall is the weak spot. A fixed-size state must compress the past. Later work found Transformers better than state space models at copying long strings from context. If the task is "find the exact clause in this 200-page contract", check recall before switching.
Tooling maturity varies. Serving engines, quantization and fine-tuning recipes are most mature for Transformers; the authors list these "downstream affordances" as an open question.
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 99 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦1 results table
- ?5 interview questions with answers
- 03Key takeaways
The selection mechanism, the scan, the block, the results and misreadings to avoid
Free account - 04How it works
Discretization, the selection mechanism, the hardware-aware scan and the block design
Premium - 05The numbers that matter
Synthetic tasks, language scaling and zero-shot results, DNA, audio, speed and ablations
Premium - 06Try it yourself
Verify Theorem 1, watch selection filter noise, and compare inference memory with a KV cache
Premium - 07Where it breaks
Scale limits, recall from a fixed state, benchmark scope and inconsistencies
Premium - 08Using it on a deployment
When state space or hybrid models fit a customer's workload
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
