Mamba and state-space models were supposed to replace transformers. What actually happened, and why?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
They did not replace transformers, they got absorbed into hybrids. The reason is the cleanest illustration of the central tradeoff in sequence modelling, which is why the question is asked.
Full worked answer with diagram
They did not replace transformers, they got absorbed into hybrids. The reason is the cleanest illustration of the central tradeoff in sequence modelling, which is why the question is asked.
Mechanism: an SSM or linear-attention layer carries a fixed-size recurrent state. Per-token inference is O(1) in time and memory regardless of position, with no KV cache growing with n. Mamba's specific contribution (S6) was making the state transition input-dependent, which earlier SSMs lacked, while keeping a parallel scan so training still parallelises across the sequence.
The catch is information-theoretic and no amount of engineering fixes it. A fixed-size state cannot losslessly retain an arbitrarily long prefix. A transformer's KV cache is a lossless, growing record, which is precisely why it can quote an exact string from 100k tokens back. An SSM must decide at write time what to keep, before it knows what will be asked. So SSMs are competitive on language-modelling perplexity and aggregation, and measurably weaker on exact recall, copying, and in-context retrieval. Multi-query associative recall probes showed this early and clearly. That weakness is fatal for the thing people most want long context for.
Hence hybrids, which is where the field actually landed: keep a small fraction of full-attention layers, from roughly 1 in 4 down to around 1 in 10 or fewer in shipped models like Jamba, Zamba, Nemotron-H, Qwen3-Next and Kimi Linear, for exact retrieval, and make everything else linear or SSM. You get near-flat memory growth in context length and much better long-context throughput at close to transformer quality. The structure mirrors hybrid local/global attention, and for the same reason: a few exact layers plus many cheap ones.
Going further: follow-up territory
Practical caveats in 2026: kernel and serving support is thinner than for attention; prefix caching semantics differ, because you are caching a recurrent state that is not sliceable or reusable the way a KV cache is, which matters a lot for agent workloads; and the best-controlled public comparison (NVIDIA's 2024 study training transformer, Mamba-2 and hybrid models at 8B on identical data) favoured the hybrid, but nothing equivalent exists at frontier scale, so architecture choice remains partly conviction plus your own ablations.
Worth sketching. Put the fixed state and the growing cache side by side and the hybrid draws itself as the obvious consequence.
flowchart LR
A["SSM layer: fixed-size recurrent state"] --> B["O(1) per token, nothing grows with n"]
A --> C["must decide what to keep at write time,<br/>before it knows the question"]
D["attention layer: KV cache"] --> E["lossless growing record,<br/>can quote a string from 100k back"]
D --> F["memory grows linearly with n"]
C --> HY["hybrid: 1 attention layer<br/>in every 4 to 10 or so"]
E --> HY
HY --> R["near-flat memory growth,<br/>exact retrieval preserved"]
What a good answer covers
- They did not replace transformers, they got absorbed into hybrids
- The reason is the cleanest illustration of the central tradeoff in sequence modelling, which is why the…
- Mechanism: an SSM or linear-attention layer carries a fixed-size recurrent state
- Per-token inference is O(1) in time and memory regardless of position, with no KV cache growing with n
- Mamba's specific contribution (S6) was making the state transition input-dependent, which earlier SSMs…
In the glossary: Mamba / SSM · KV cache · Attention · Prefix caching
Interviewer follow-ups to expect
Why does prefix caching get harder with a recurrent state than with a KV cache?
For an agent doing long tool-use trajectories, would you take a hybrid or a pure transformer?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep