Pack the suitcase — a memory that never grows
Here's a state space model reading a sentence, one word at a time. Its entire memory is the 8 slots below — that's it, forever, whether the text is 10 words or 10 million. Each incoming word updates the slots (a weighted blend of "keep what's there" and "write something new"), then vanishes. Step through and watch old contents fade as new ones move in. Nothing is ever re-read.
The slot dynamics are a real linear recurrence h ← A·h + B·x running live (A decays, B writes), with the decay rate shown per slot — a faithful miniature of the S4/Mamba state update, minus the dimensions.
Selectivity — the doorman that made Mamba work
Early SSMs treated every word identically — same decay, same write strength. Mamba's breakthrough: the update amounts depend on the input. Important word? Open the gates, write hard, hold long. Filler word? Barely touch the state. Watch the same sentence pass through both: the fixed SSM lets "the" and "very" overwrite the crucial name; selective Mamba slams the gate on filler and the name survives 40 words of noise.
Both runs use the same recurrence; only the gate policy differs (fixed constants vs input-dependent). The "name signal strength" trace is measured from the actual state vector each step.
The memory bill — constant vs a cache that eats the GPU
Now the economics. A transformer generating with a long context must hold KV entries for every past token — memory grows linearly, and per-token compute grows with it. Mamba holds the suitcase — a flat line. Drag the context length from a tweet to a codebase and watch the two curves and the serving arithmetic (how many concurrent users fit on one 80GB GPU) diverge.
KV math: 2 × layers(60) × kv-heads(8) × head-dim(128) × 2 bytes per token ≈ 0.25 MB/token (7B-class, GQA). Mamba state: layers × d_state × d_model × 2 bytes, fixed. Real numbers vary by model; the shapes don't.
The recall test — what a suitcase cannot do
The honest weakness, measurable in one game: needle-in-a-haystack. Hide a random passcode early in a long text, ask for it verbatim at the end. The transformer flips back to the exact page — perfect recall at any distance (it kept everything). The suitcase must have decided, hundreds of words ago, that a random string was worth keeping — with no idea it would be asked. Run the test at growing distances and watch the two curves separate.
Simulation encodes the structural fact (finite state must lossily compress arbitrary content); the curve shape matches published associative-recall benchmarks where attention dominates pure SSMs.
The hybrid — a few librarians among the travelers
The 2024-26 answer isn't either/or. Production models (Jamba, Zamba, Nemotron-H and friends) stack mostly Mamba layers with a few attention layers sprinkled in — travelers for speed, a couple of librarians for exact recall. Design your own stack below: choose the attention ratio, then read all three meters — recall, memory bill, throughput. Find your own sweet spot; the published ones cluster around 1:7.
Meters computed from the component models: recall follows a saturating curve in attention ratio (a few librarians catch most lookups); memory and throughput are weighted blends of the two layer types' costs at 256k context.