The AI Reader.
The Evidence

Mamba dropped attention to make long sequences cheap. Its authors put some back

Mamba matches a transformer twice its size on short-context reasoning up to 2.8B parameters, and loses to a far smaller one at looking things up in a long context.

Why this matters

Every few months a new design is announced as the end of the transformer, and Mamba is the one that stuck as the reference. If you have seen the claim that attention is on its way out, this is the paper underneath it. A state-space model reads a sequence a different way: instead of comparing every token against every other, it carries one compressed summary forward and updates it as it goes. By the end you will know what that summary is and what the word "selective" adds to it. You will also know exactly which claim the paper proved, at what size it trained, and where the "transformers are finished" reading runs past what the evidence shows.

Background optional reading
01
The paper credited with starting the LLM era never trained a language model: the transformer paper this one replies to, and what attention is.
02
An attention head is a weighted average that computes its own weights: how attention re-reads every earlier token, in worked numbers.
03
A model's accuracy traces a U as the answer moves through a long prompt: what long context costs a transformer, and why the length matters.

The paper people mean by "post-transformer"

A transformer answers each new token by comparing it against every token that came before it. Mamba, a sequence model published in December 2023 by Albert Gu of Carnegie Mellon and Tri Dao of Princeton, answers without looking back at all. It keeps a single fixed-size summary of everything read so far and updates that summary one token at a time, so the work it does per token never grows with how much it has already read.1

The pitch is cost. Because a transformer holds the entire past in reach, its bill grows with the length of the sequence; Mamba's does not. The paper reports four to five times the inference throughput of a transformer its size, and a scaling curve that keeps pace with a strong transformer recipe over the range it tested.1 Two years on, those numbers are what people reach for when they argue attention is finished.

The state that stands in for the past

A state-space model keeps a state: a fixed-size list of numbers that stands in for everything the model has read. At each new token it performs a recurrence, which just means it produces the next state from the previous state and the token in front of it, then reads its answer off that state. In the simplest linear form the update is a weighted mix,

h_t = A\,h_{t-1} + B\,x_t, \qquad y_t = C\,h_t

where x_t is the current token, h_t the state after it, and A, B, C are the fixed sets of weights the model learned.1 Read the two lines plainly: carry a little of the old state, fold in a little of the new token, and let the state be the model's entire memory of the sequence.

Set that beside attention. Attention answers a token by reading every earlier token again. A state-space model answers it by reading one thing: the state. The paper puts the contrast in terms of compression. Attention does not compress the past at all; it keeps every earlier token around and re-reads them, which is why its cost climbs with length. A state-space model compresses hard: everything it will ever know about the past has to fit inside that one fixed state.1 That buys the constant per-token cost. It also makes the state a bottleneck: whatever will not fit in it is lost, and what will not fit turns out to decide how far the model can go.

What "selective" changed

State-space models were not new in 2023. The line Mamba builds on, the S4 family from 2021, already carried a state forward and was strong at very long inputs, solving a 16,000-step benchmark that earlier models failed.2 But S4's update was fixed: the same weights applied to every token, whatever the token was. That constraint had a payoff. When the update never changes, the whole recurrence can be unrolled and computed in one parallel pass, like a convolution, which trains fast. Its price was that a model treating every token identically cannot decide that some tokens matter and others are noise.

Mamba's one real change is to let the update depend on the token in front of it. This is what the paper calls selection: how much of the new token to write into the state, and how much of the old state to keep, is now computed from the token itself. Shrink the state to a single number and the update becomes a plain gate.

h_t = \htmlClass{nb-mc1}{g_t}\,\htmlClass{nb-mc3}{x_t} + \bigl(1 - \htmlClass{nb-mc1}{g_t}\bigr)\,\htmlClass{nb-mc2}{h_{t-1}}
  • g_ta number between 0 and 1 the model computes from the current token.
  • x_tthe current token.
  • h_{t-1}the state carried in from the step before.
The selective update with the state reduced to one number: near 1, the gate overwrites the state with the token; near 0, the token is ignored and the state passes through unchanged.1

That gate is the entire idea at its smallest. The model looks at each token and chooses whether to remember it. Making the update depend on the token breaks the convolution trick S4 relied on, so Mamba has to run as a true step-by-step recurrence. Much of the paper's engineering goes into keeping that recurrence fast, by holding the state in the GPU's quickest memory rather than writing it out and back.1 The payoff shows on a task built to need selection: copy only the tokens that were marked and skip the rest. The fixed S4 scored 18.3 percent; selective Mamba scored 99.8.1 Choosing what to keep is what closed that gap.

The 2.8B behind the headline

The line everyone quotes is that Mamba "matches Transformers twice its size." The largest language model the paper actually trained was 2.8 billion parameters; the "3B" of the abstract is that same model rounded up. The "twice its size" claim rests on one comparison: zero-shot common-sense reasoning. Across six tasks, Mamba-2.8B averaged 63.3 against 59.1 for a same-size Pythia transformer. It also came in ahead of the 61.7 scored by a Pythia nearly two and a half times larger.1 On perplexity, a standard score for how well a model predicts the next token where lower is better, Mamba's curve tracked a strong transformer recipe over the sizes tested. Those are real results, and they are short-context results at small-to-mid scale.

The authors are the ones who say so.

The authors on their own scale
"our empirical evaluation is limited to small model sizes, below the threshold of most strong open source LLMs ... It remains to assess whether Mamba still compares favorably at these larger sizes."1 Gu and Dao, Mamba, §5

The categories most in question at this point, long-context retrieval and in-context learning at frontier scale, were not run at language-model scale. The throughput headline needs the same care. The four-to-five-times figure is generation throughput on one GPU, and it comes from a specific advantage: with no stored past to hold, Mamba runs far larger batches than a transformer of the same size can. In training, its scan only overtakes a fast attention implementation once the sequence passes roughly 2,000 tokens.1 The win is real and it is specific: long-sequence, large-batch generation, not a blanket speedup.

Where the successor story breaks

Because everything a fixed state knows must fit inside it, a state-space model struggles with any task that needs the exact earlier text: copying a long string, or looking a specific entry up in a long context. A group at Harvard proved the limit and then measured it. Transformers learn to copy with about a hundred times fewer training examples than the best state-space model. On a phone-book lookup, even a 410-million parameter transformer beats a 2.8-billion parameter Mamba once the book is long enough.3 The detail that matters most: this held even though those Mamba models had slightly lower perplexity. "Matches on perplexity" and "matches on the thing you would use it for" are different claims, and Mamba's headline was the first kind.

A year on, Gu and Dao's follow-up sped up the layer and then put attention back in. A model with about a tenth of its layers being attention beat both a pure state-space model and a strong transformer. They credit the gain to attention's knack for retrieving an earlier token instead of forcing everything through the compressed state.4 Industry landed in the same place. Jamba, billed as the first production-grade hybrid, interleaves attention and Mamba layers, and its makers state plainly that state-space models like Mamba "still lag behind the performance of comparably sized Transformer language models."5

Falcon Mamba, a 7-billion parameter model with no attention at all, reports beating Mistral 7B and Llama 3.1 8B on standard leaderboards.6 A pure state-space model really can be competitive at that size, and this is the honest high-water mark for one. But 7B is well short of frontier scale, and those leaderboards are the short-context reasoning tasks where state-space models were always competitive. The result does not test the copying and retrieval gap, and it does not close it.

Mamba showed that a fixed-state model can match a same-size transformer on short-context reasoning up to 2.8B, and generate long sequences more cheaply. It did not show that a pure state-space model matches transformers on retrieval, at long context, or at frontier scale, and its own authors keep some attention for the tasks where the fixed state falls short. Two years after the paper, a technical explainer from IBM records the plain state of things. Transformers "have remained the dominant mode of LLM," and "still outpace both Mamba and Mamba-2 on tasks requiring in-context learning ..., copying, or long-context reasoning." It points to hybrids, its own production models among them, as the way to pair Mamba's efficiency with attention's recall.7

The takeaway

Mamba's real result is narrow and solid. A model that carries a fixed compressed state forward, and chooses per token what to keep in it, can match a same-size transformer on short-context reasoning up to 2.8B parameters. It can also generate long sequences more cheaply, because it never re-reads the past. Its limit is that same fact seen from the other side. What does not fit in the fixed state, the exact wording of a long passage or a lookup buried deep in a long context, is what it loses. There, a small transformer beats a much larger Mamba. That is why Mamba's own authors, and the production models that followed, added a little attention back rather than take it all out. The transformer is not finished. What the paper showed is smaller and more useful than that. Attention is one way to read a sequence, not the only one, and giving up the re-read buys cheap generation at the cost of the exact recall the re-read was there to provide.

Go deeper optional reading
01
Repeat After Me: Transformers are Better than State Space Models at Copying: the proof and the measurements behind the retrieval gap.
02
Transformers are SSMs (Mamba-2): the authors' follow-up, where a hybrid with about a tenth attention wins.
03
Falcon Mamba: The First Competitive Attention-free 7B Language Model: how far a pure state-space model has actually scaled.

Sources

  1. Gu & Dao · Mamba: Linear-Time Sequence Modeling with Selective State Spaces (2023)
  2. Gu, Goel & Ré · Efficiently Modeling Long Sequences with Structured State Spaces (S4, ICLR 2022)
  3. Jelassi, Brandfonbrener, Kakade & Malach · Repeat After Me: Transformers are Better than State Space Models at Copying (ICML 2024)
  4. Dao & Gu · Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality (Mamba-2, ICML 2024)
  5. Lieber et al. · Jamba: A Hybrid Transformer-Mamba Language Model (2024)
  6. Zuo et al. · Falcon Mamba: The First Competitive Attention-free 7B Language Model (2024)
  7. IBM Think (Dave Bergmann) · What Is A Mamba Model?