In December 2023, Albert Gu and Tri Dao released Mamba.
It is a neural network layer for processing sequences. When it reads a piece of text, Mamba moves forward one token at a time, carrying only a fixed-size “state”; at each step, it folds the new content into that state. It uses no attention, and however long the sequence, every step costs the same.
The paper's abstract confidently claimed inference throughput 5× that of Transformers, with computation that scales linearly in sequence length, and said a 3B-parameter Mamba outperforms Transformers of the same size and matches Transformers twice its size. Mamba abstract
On Hacker News, one commenter wrote that if there was really no catch, this was a groundbreaking paper. Hacker News, 2023-12-04 A little over a week later, another explainer posted there was titled “Guide to the Mamba architecture that claims to be a replacement for Transformers.” Hacker News, 2023-12-15
Our note at the time was subtitled “Who is the Successor,” and its closing line added one more flourish: “the beginning of a new era of papers!”
More than two years have passed since then. In March 2026 came Mamba-3, again advised by the same two researchers. Its section on retrieval reads, “Because of the natural retrieval-based weaknesses of fixed state-size, we predict that linear layers will be predominantly used in hybrid architectures that mitigate this downside with quadratic self-attention layers.” Mamba-3 §4.1
So how did the promised successor end up moving in with attention?
This article asks what exactly Mamba's fixed-size memory can't remember. Once we know the answer, we'll look at where Mamba has gone over these two years.
Over these two-plus years, the research side has been asking what a fixed-size state lacks and how much attention it takes to make up for it.
On the product side, the answers have been shipping one after another.
Two Ways to Remember: The Whole Phone Book, or One Notebook
First, a metaphor to tell the two approaches apart.
Suppose someone reads out a long list of “name: phone number” entries, and when they're done, you have to give the number of anyone on it.
Attention copies down the entire phone book. Every time you hear an entry, you add another page at the back; when asked, you flip through from front to back looking for the name. Every entry is still there and you can always look back, but the book keeps getting thicker, and each search takes longer. This ever-thicker book is the KV cache.
(The metaphor needs a small correction. An attention layer stores the key and value that each layer computes for each position, which are already internal representations of the model. Even when the information is there, the model still has to learn how to look it up.)
Mamba carries only a notebook with a fixed number of pages. Every time you hear an entry, you fold it into your notes, erasing some of the old ones when you have to. The notebook is always the same thickness and always as quick to flip through; the price is that once there's a lot of content, something is bound to blur.
So how thick does this phone book get? We worked it out once in “From 512 to a Million Tokens”: for a model with 32 layers, 8 KV heads per layer, 128 dimensions per head, and 2 bytes per number, the KV cache for a million tokens is about 122.1 GiB, before counting the model weights.
Keep the same 32 layers, but what if only 1 in every 4 layers keeps attention and the other 24 are replaced with state layers like Mamba-2's? The state size follows the settings of NVIDIA's 8B hybrid model, with an inner width of 8,192 per layer and a state dimension of 128.
| Tokens | Full attention | 3:1 hybrid | State only |
|---|---|---|---|
| 4,000 | 0.49 GiB | 0.17 GiB | 64 MiB |
| 128,000 | 15.62 GiB | 3.95 GiB | 64 MiB |
| 1,000,000 | 122.07 GiB | 30.56 GiB | 64 MiB |
Each column tells its own story:
- Full attention keeps growing with length; a million tokens take 122 GiB.
- Pure state: however long the input, the model's SSM state stays at 64 MiB (there's also a small fixed-size convolution buffer, not counted here). This was Mamba's original promise.
- 3:1 hybrid comes to about a quarter of full attention. As the length grows, those 48 MiB of state become negligible.
Let's also work out the crossover point. Full attention needs 128 KiB per token, so 64 MiB holds the KV for only 512 tokens. For contexts shorter than 512, the fixed state actually takes up more space; by 4,000 tokens, full attention is already nearly 8 times larger. (This counts only the memory a single sequence has to carry, not the computation, and the model is just a teaching configuration chosen for this article.)
Judging by memory alone, it looks as if we could just switch everything to Mamba.
But can that notebook really remember the entire phone book?
Mamba Can't Remember Phone Numbers
In March 2024, AI21 Labs released Jamba, a 52B model that mixes Mamba with attention. On Hacker News, someone asked: now that we have Mamba, why include attention layers at all?
The reply was short, saying “Mamba is bad with long context. It doesn't remember phone numbers.” Hacker News, 2024-03-28
The quip had a source. In February of the same year, Jelassi et al. at Harvard published “Repeat After Me,” whose title states outright that Transformers are better than state space models at copying.
Read the three panels as training efficiency, copying-length generalization and phonebook lookup; the rightmost x-axis counts entries.
The theory is easy to follow. To copy a string of random characters exactly, you first have to store the whole string; for a string whose every position is drawn uniformly from characters and whose length is , the information content is bits. The paper proves that whenever the state has fewer than bits, the probability of failing to copy the whole string exactly exceeds one half.
This lower bound is actually very loose, though. In the authors' own example, 1,000 32-bit floating-point numbers carry enough information to store 2,000 tokens from a 50,000-token vocabulary. The trouble shows up in the experiments, where the state clearly has room, yet the model doesn't learn to store things in it. In experiments with about 160 million parameters, trained from scratch to copy random strings of up to 300 characters, Transformers needed roughly one hundredth as many examples as Mamba; trained only on strings of up to 50 characters, Mamba quickly got everything wrong on longer strings.
The best-known result is the phone-book test. The authors compared off-the-shelf pretrained models, pitting Pythia, built on the Transformer architecture, against Mamba, also trained on the Pile with the same tokenizer. The prompt contains a randomly generated phone book and then asks for someone's number. At around 70 entries, the smallest Pythia, 410M, already beats the largest Mamba, 2.8B. And at the same size, Mamba's perplexity is even a bit lower than Pythia's.
A good perplexity is no guarantee that a model can copy.
The paper has one more comparison. In both versions the task is “given a key, find what comes after it.” If the key comes at the very end, so that the model only learns what to look for after reading the whole passage, Mamba does poorly; if the key comes at the very beginning, so that the model knows from the start what to keep an eye on, Mamba actually does very well.
When the question shows up decides whether the notebook is enough.
In Bigger Models
This weakness shows up in larger models too, just in a different form.
The Jamba paper ran an ablation at 1.3B parameters trained on 250B tokens. Pure Mamba did fine on perplexity and general benchmarks, but on IMDB movie-review sentiment classification it scored only 48.8, against 84.1 for pure attention and 90.9 for the hybrid. Only when the authors looked at the outputs did they find that pure Mamba often didn't follow the format of the few-shot examples, writing “Very Good,” “Funny,” or even “3/10” where it should have written Positive or Negative. Jamba §6.2
Some of these answers may have had the right sentiment; they just weren't written in the Positive/Negative format the evaluation required.
Three months later, NVIDIA ran a bigger comparison, training 8B-parameter Mamba, Mamba-2, and Transformer models with the same data and the same hyperparameters. All three were trained to 1.1T tokens; the 3.5T-token group compared only Mamba-2 and the Transformer. The author list also included Albert Gu and Tri Dao. An Empirical Study of Mamba-based Language Models
At 1.1T tokens, both Mambas scored only 28 to 29 on MMLU 5-shot, close to random guessing among four options, while the Transformer scored 46.28. When the authors switched to a cloze format that doesn't list the options, the three models scored about the same. They argued that the knowledge had largely been learned and that the models were stuck on the format of “understanding the options and answering with a single letter.” Trained to 3.5T tokens, Mamba-2's 48.7 was only 1.37 points behind the Transformer's 50.07.
Read across a row from Standard to Cloze: changing the answer format changes the gap.
The phone book was another matter: that gap didn't close. The Transformer got almost everything right within its pretraining length of 4,096, while both Mambas started answering wrong at around 500 tokens; even Mamba-2 trained to 3.5T tokens still couldn't answer accurately beyond 1,000 tokens.
The authors took one more look and found that the wrong numbers often had several digits right. They call this fuzzy memory. Every entry was folded into the state, just not precisely enough, so it came back out distorted.
Just Keep a Few Attention Layers
If the problem is “needing to flip back through the phone book,” then leave it a phone book.
Jamba's approach is to put 1 attention layer in every 8 and use Mamba for the other 7. In the 1.3B ablations, hybrids at 1:3 and 1:7 worked almost equally well, and both beat pure attention and pure Mamba; the 1:7 hybrid (three attention layers in the whole model) fixed the IMDB format problem. In the hybrid's attention layers, the authors also found attention heads that specialize in looking back at the examples' labels.
Mamba's original authors tried it too. The May 2024 Mamba-2 paper has an often-skipped table that varies the number of attention layers in a 350M-parameter, 48-layer model trained on 7B tokens of the Pile.
| Attention layers | Perplexity |
|---|---|
| 0 (pure Mamba-2) | 8.60 |
| 1 | 8.38 |
| 3 | 8.29 |
| 6 | 8.26 |
| 11 | 8.30 |
| 24 | 8.50 |
| Pure Transformer++ | 8.68 |
Adding just 1 attention layer drops perplexity from 8.60 to 8.38; 6 layers out of 48 (12.5%) is best. The authors conjecture that the fixed state keeps organizing the preceding text while attention keeps open a path for looking back token by token, which lines up neatly with the phone-book metaphor.
NVIDIA's comparison study swept the ratio as well, finding that in a small 130-million-parameter, 24-layer model, validation loss was lowest with about 8% attention. The final 8B hybrid has 56 layers, with 24 Mamba-2, 4 attention, and 28 MLP layers; after training on 3.5T tokens, it beat a Transformer trained under the same conditions on all 12 standard benchmarks, by 2.65 points on average. It could answer phone-book queries beyond its pretraining length, and it was clearly better on synthetic tasks of the needle-in-a-haystack kind.
The report also records the hybrid's weaknesses, noting that after extension to 16K and 32K contexts it actually lost to the Transformer on multi-document QA and was more sensitive to prompt format.
In a July 2025 blog post, Albert Gu summed up these two years of experience in one sentence, noting that across language modeling experiments from dozens of research groups, the hybrid ratio with the best perplexity falls roughly between 3:1 and 10:1, SSM to attention. This compares model quality only, without factoring in compute cost. He also compared Transformers to databases, which store every piece of history, and SSMs to brains, which compress it. On the Tradeoffs of SSMs and Transformers
Rewriting the Notebook's Rules
Hybrid architectures settled “whether to keep a phone book.” Another line of research asks whether the notebook itself could be written more cleverly.
Mamba-2: Relatives After All
The Mamba-2 paper is titled “Transformers are SSMs.” Tri Dao and Albert Gu proved that when the state transition is simplified to a scalar times the identity matrix (they call this kind of layer SSD), an SSM applied to an entire input of length can be written as a single matrix multiplication:
Treat as attention's query, as the key, and as the value, and this is attention with the softmax removed and a special mask added. Each entry of is the product of all the decay coefficients between two positions, so the farther apart they are, the deeper the discount, and how much each step discounts is decided by the input.
In other words, under this condition, the step-by-step recurrence and this masked attention are two algorithms for the same SSD operation. Computing the full matrix directly costs quadratic time; the actual algorithm splits the sequence into chunks, using matrix multiplication within each chunk and passing only the state between chunks.
This brings two practical benefits. First, the GPU's tensor cores come into play: in the paper's core-operation benchmarks, it runs 2 to 8 times faster than Mamba's scan. Second, the state dimension can grow from 16 to 64 or 256, so the notebook gets thicker. On a synthetic task similar to the phone book, the larger the state, the more accurate the answers.
The price is a little expressive power. Tri Dao states bluntly on his blog that at the same state size, Mamba-2 isn't necessarily better than Mamba-1. Tri Dao, Mamba-2 Part I
When an Entry Is Wrong, How Do You Fix It?
With the state viewed as a matrix, writing means adding “key × value” to it, and looking something up means multiplying it by the key. Let's go back to the phone book and look at the situation most likely to trip up a notebook, in which the same person changes numbers.
Ming's extension was originally 101 and later changed to 330; in between, Hua's extension, 205, was also recorded. To keep the arithmetic simple, we use just one head, each value is a single number, the two names' keys are perpendicular and of length 1, and every write strength is 1. Each of the four rules records the entries once:
- Just add: the most basic linear attention. The old and new numbers pile on top of each other, and the lookup returns 431, which is nobody's number.
- Discount: take 20% off the whole book. This is Mamba-2's approach. The old number fades a little but is still mixed in; Hua's number never changed, yet it gets marked down too.
- Erase: erase first, then write. This is the delta rule. Before writing, it uses the key to read out the old value and wipe it out, then writes the new one. Ming's entry is corrected, and Hua's isn't touched at all.
- Both: combine the two, and you get the December 2024 Gated DeltaNet. Ming's entry is corrected; whether everything else fades along with it is up to the decay coefficient, and when the topic changes, it can clear out the whole book in one go.
In this example the keys happen to be perpendicular, which is the ideal case. Real models' keys interfere with one another, but the division of labor is the same, with decay handling broad forgetting and the delta rule handling precise edits. In their 1.3B experiments, the Gated DeltaNet authors also found that these two mechanisms each have their strengths on different tasks.
In October 2025, Moonshot AI's Kimi Linear went a step further, splitting the decay coefficient from a single number into one per channel so that every column of the notebook gets its own rate of forgetting. They call it KDA (Kimi Delta Attention).
From Mamba's selectivity, Mamba-2's scalar decay, and Gated DeltaNet's erase-then-write to KDA's per-channel forgetting, the names have kept changing, and each generation has absorbed ideas from other lines of research; the delta rule, for example, originally came from earlier work on linear attention. The thread of letting the model decide for itself what to remember and what to forget, though, has never been broken.
Mamba-3: The Original Authors' Answer
Mamba-3, from March 2026, can be read as the original authors' response to these two years.
Even its opening strikes a different tone. Back then, Mamba talked about becoming the backbone of general sequence models; the first paragraph of Mamba-3 talks about inference cost, then points out directly that layers like Mamba-2 and Gated DeltaNet have already been built into large-scale hybrid models from Kimi, NVIDIA, Tencent Hunyuan, and Qwen.
It draws three changes out of the old principles of state space models:
- More expressive discretization: the recurrence draws on the inputs of two adjacent tokens at once; add learnable biases on and , and the short convolution that almost every linear model includes can be removed.
- Complex states: letting the state “rotate” is equivalent to a rotary positional embedding (RoPE) whose angles are decided by the input. Mamba-3 can solve parity (in a string of 0s and 1s, is the number of 1s odd or even?), which Mamba-2 can't.
- Multi-input, multi-output (MIMO): during decoding, the GPU spends most of its time waiting on memory, so each step does a bit more computation, buying better quality at almost the same latency.
In experiments at 1.5B parameters and 100B tokens, its average score is 0.6 points above Gated DeltaNet's, and the MIMO version adds another 1.2 points. In a separate set of 440M state-size experiments, the MIMO version reaches the same perplexity as Mamba-2 with only half the state.
On retrieval, though, pure Mamba-3 still trails the Transformer. On SWDE, which extracts information from semi-structured web pages (in a cloze version truncated to 2K tokens), the Transformer scores 48.9, Mamba-3 28.5, and the MIMO version 36.3. Only the hybrid version, with 5 linear layers to 1 attention layer, climbs to 58.5. The line quoted at the start, “linear layers will be predominantly used in hybrid architectures,” comes from this very section.
Start with the SWDE column and compare the Pure and Hybrid groups on the left.
When it came out, some headlines said Mamba-3 was 7 times faster than Transformers. We went through the paper, and the closest match for that number is the 16K-token column of Table 7, where at batch size 128 the total time for prefill plus decoding is about 141 seconds for Mamba-3 and about 977 seconds for Llama-3.2-1B on vLLM. That compares different models on different inference systems; on top of that, the Llama cell ran out of memory and was estimated by measuring at batch size 16 and multiplying by 8. When the sequence is as short as 512 tokens, the two differ by only 0.06 seconds.
The “roughly seven times” comparison uses the far-right Prefill+Dec column, together with the batch and extrapolation conditions stated above.
In 2026, How Many Layers Are Mamba's?
That's where we'll leave the research thread for now. Next, let's count how many such layers actually go into products.
Below are several open-weight models. We read their configuration files on Hugging Face directly and counted, among the layers responsible for “sequence mixing,” how many are linear recurrent layers and how many are attention. Per-token layers such as MLP and MoE aren't counted.
config.json, read on 2026-11-12.| Model | Released | Linear layer | Linear : attention layers |
|---|---|---|---|
| Jamba-v0.1 | 2024-03 | Mamba | 28 : 4 |
| Qwen3-Next-80B-A3B | 2025-09 | Gated DeltaNet | 36 : 12 |
| Granite-4.0-H-Small | 2025-10 | Mamba-2 | 36 : 4 |
| Kimi-Linear-48B-A3B | 2025-10 | KDA | 20 : 7 |
| Qwen3.5-397B-A17B | 2026-02 | Gated DeltaNet | 45 : 15 |
| Nemotron 3 Super | 2026-03 | Mamba-2 | 40 : 8 |
| Kimi K3 | 2026-07 | KDA | 69 : 24 |
| MiniMax-M2 | 2025-10 | None | 0 : 62 |
| DeepSeek-V4-Pro | 2026-04 | None | 0 : 61 |
Reading the table:
- Hybrid ratios run from about 3:1 to 9:1. Qwen and Kimi keep roughly 1 attention layer in every 4; NVIDIA's Nemotron 3 Super is at 5:1; IBM's Granite 4.0 is the most aggressive, at 9:1. That's close to the 3:1 to 10:1 range Albert Gu described.
- The layers that carry the Mamba name are mainly at NVIDIA, IBM, and AI21. Qwen and Kimi use Gated DeltaNet and KDA; the names have changed, but the lineage connects, and the subtitle of the Gated DeltaNet paper is literally “Improving Mamba2 with Delta Rule.”
- The scale has reached the trillion-parameter range. Kimi K3 is a 2.8T-parameter MoE with 69 KDA layers out of 93, and this version of Qwen3.5 is also 397B. Kimi K3 model card
We should also be clear about what this table can't show. It lists only open-weight models; what architectures the closed models from OpenAI, Anthropic, and Google use is unknown to outsiders. And the table counts only layers; the bulk of the parameters and computation usually sits in the MoE layers.
For Granite 4.0, IBM claims that, compared with conventional transformer-based models, it “can offer over 70% reduction in RAM needed to handle long inputs and multiple concurrent batches.” IBM, 2025-10-02 That points the same way as our estimate above. The announcement doesn't specify which baseline it compares against, though, so how much you'd actually save still has to be measured on your own workloads.
Some Took a Different Road
The last two rows of the table were included on purpose.
On October 29, 2025, MiniMax's M2 pretraining lead published a post titled “Why Did M2 End Up as a Full Attention Model?” MiniMax, 2025-10-29
Their earlier MiniMax-Text-01 used a hybrid architecture with linear attention. According to the post, the hybrid model tied full attention on common benchmarks like MMLU, BBH, MATH, and LongBench, but once scaled up, it fell clearly behind on complex multi-hop reasoning. They built dedicated proxy metrics and iterated until it “seemed” to match full attention, but they weren't sure that would still hold at even larger scales. They also tried converting the model into a sliding-window hybrid during continued training, and performance degraded as the context grew, which the author called “unacceptable in agentic scenarios.” The infrastructure hadn't caught up either. Many linear architectures are limited by memory bandwidth even during training, the state is more sensitive to low precision, and prefix caching and speculative decoding both have to be redesigned.
The post states its conclusion right at the start: “We are always working on it.” They haven't given up; they just don't think it's ready yet.
The next day, Moonshot AI released Kimi Linear, claiming that, under fair comparisons, it beat full attention across the board for the first time. In the same week, the two teams made different choices under the conditions of their own models and systems. Kimi Linear's baselines were trained by the authors themselves, at a scale of 48B total parameters and 1.4T tokens, and one commentary pointed out that the report lacked a well-tuned full-attention baseline. The Kaitchup, 2025-10-31 Nine months later, Moonshot AI kept the KDA hybrid architecture in Kimi K3, scaling it up to 2.8T; how its quality compares with a full-attention model of the same scale will still take paired experiments to say for sure.
Another road comes from DeepSeek. DeepSeek-V4, from April 2026, also supports a million tokens, but it relies on Compressed Sparse Attention (CSA) and Heavily Compressed Attention (HCA), two compressed forms of attention. The names roughly describe the approach, with the former compressing the KV along the sequence and then attending to only part of it, and the latter compressing much harder but attending to all of it. The official model card says that at a million tokens, V4-Pro needs 27% of the previous-generation V3.2's per-token inference compute, and 10% of its KV cache. DeepSeek-V4 model card
To return to the phone-book metaphor, the Mamba line chose to switch to a notebook with a fixed number of pages, while DeepSeek chose to print the phone book in tiny type and add an index. Both roads are tackling a phone book that keeps getting thicker and slower to search.
So, Where Did Mamba Go?
Back to the title. The answer depends on which Mamba you're looking for.
- The pure SSM that was going to replace the Transformer: among the public models listed in this article, every one that uses the Mamba line is a hybrid. Exact lookback is a weakness that pure SSMs have never fully overcome, visible all the way from the 2024 phone-book test to Mamba-3's retrieval evaluations, and the original authors themselves expect the layer to be used mainly in hybrid architectures.
- The layers from the Mamba and Mamba-2 generations: they live in hybrid models from AI21, NVIDIA, and IBM, and make up the majority there. In Nemotron 3 Super, 40 of the 48 sequence-mixing layers are Mamba-2; in Granite 4.0, it's nine layers out of every ten.
- The idea of letting the model decide what to remember and what to forget: it has been carried on by descendants that absorbed the delta rule, named Gated DeltaNet and KDA, which have moved into the flagship models of Qwen and Kimi, where they take up roughly three of every four layers.
Plenty of questions are still open. The multi-hop reasoning gap that MiniMax described still lacks independent evaluation on public large hybrid models, and the data gathered for this article doesn't yet include a complete paired comparison of how much trillion-parameter hybrids differ from full-attention models of the same scale. Whether the infrastructure needs another round of rewriting for recurrent layers is a question each company answers differently. DeepSeek keeps attention and only compresses it, yet it also supports a million tokens; whether long context has to be solved by replacing attention layers is still unsettled.
That quip from 2024 still hasn't entirely gone stale:
Hey, Mamba! Repeat after me!
And Mamba says: No.
