AppsGuidesAI DictionarySmall FixesOn RecordAboutFollow the lab

State space models (Mamba)

Also called mamba, ssm

State space models like Mamba read text while keeping a running summary, instead of looking back over every earlier word, so long inputs stay cheap.

In plain words

Most chatbots are built on the transformer. To write each new word, a transformer looks back over every earlier word. That is powerful, but the longer the text, the more looking back it does and the more memory it needs.

A state space model, or SSM, works more like a person taking notes. It reads one word at a time and keeps a fixed-size running summary, called its state. Each new word updates the notes. Writing the next word only needs the notes, not the whole text, so cost grows in a straight line with length.

Older SSMs updated their notes the same way for every word, which made them weak at language. Mamba, from 2023, added the key trick: it decides, word by word, what to keep and what to forget.

The trade-off is that a fixed-size summary cannot hold every detail. So many newer models are hybrids: mostly Mamba-style layers, with a few attention layers mixed in.

Everyday example

Keeping score at a cricket match

You arrive late to a match and ask what happened. One friend replays every ball from the start. Another just says: "India 186 for 4, 12 overs left, the new batter looks shaky." The second friend kept a running summary and updated it each ball. That is an SSM. It is quick, but ask about the 37th ball and the summary may not have it.

Where the example breaks: Your friend chooses what matters using common sense. Mamba learns what to keep from patterns in training text, so it can drop a detail that later turns out to matter.

Go deeper

How it actually works

State space models come from fields like control theory, where a small set of numbers tracks a system as it changes over time. AI researchers adapted them for long sequences of tokens, audio or DNA.

  1. A state that updates

    At each token, the model updates its state, a fixed-size vector, from the old state and the new input, then produces an output. It is a cousin of the recurrent neural network, but built so training can run in parallel on GPUs.

  2. S4 made it practical

    In 2021, a Stanford team's S4 model showed SSMs could track very long patterns efficiently, setting records on a benchmark of long-sequence tasks. But it treated every input the same way, which hurt on language.

  3. Mamba makes it selective

    Mamba (Albert Gu and Tri Dao, December 2023) lets the update rules depend on the current token, so the model can choose to hold on to a name or let filler words fade. A hardware-aware algorithm keeps it fast.

  4. Hybrids in practice

    Exact recall over long inputs is where attention shines and a compressed state struggles. So builders mix the two: AI21's Jamba (2024), IBM's Granite 4.0 (2025) and NVIDIA's Nemotron 3 (2025) all combine Mamba layers with transformer layers.

Mamba paper
"Mamba: Linear-Time Sequence Modeling with Selective State Spaces", Albert Gu (Carnegie Mellon) and Tri Dao (Princeton), December 2023
Claimed gains
About 5 times the text-generation throughput of similar transformers, and a 3 billion parameter Mamba matching transformers twice its size
Mamba-2
May 2024: showed SSMs and attention are closely related, with a core layer 2 to 8 times faster
Hybrid example
IBM's hybrid Granite 4.0 models use nine Mamba-2 layers for every transformer block, and IBM says it needs over 70% less memory on long inputs

As of November 2026, the makers of the biggest chatbots have not said they use Mamba, while several open model families use Mamba hybrids.

Questions people ask

Is Mamba better than a transformer?

It is cheaper on long inputs and was competitive with similar-size transformers in its paper. But a 2024 study found transformers far better at copying and retrieving exact text from earlier in the input. That is why many recent models mix both rather than pick one.

What is a hybrid Mamba-transformer model?

A model that stacks both kinds of layer. Most layers are Mamba-style, which keep memory use low on long inputs. A few are attention layers, which are good at looking up exact details. IBM's hybrid Granite 4.0 models, for example, use nine Mamba-2 layers for every transformer block.

Is a state space model the same as an RNN?

They are close relatives. Both carry a running state from token to token. SSMs come with maths that lets them be trained in parallel, like a transformer, and then run step by step, like an RNN, which older RNNs could not do well.

Do ChatGPT, Claude or Gemini use Mamba?

Their makers have not said they do. The public Mamba models are mostly open-weight, such as AI21's Jamba, IBM's Granite 4.0 and NVIDIA's Nemotron 3 family, which mix Mamba and transformer layers.

Was this clear?

1 is confusing, 5 is crystal clear. One tap, no account needed.

Spotted something wrong, or know a better example? Suggest a change

Further reading