← AI glossary

AI glossary · Advanced · Language models · Efficiency & infra

State space model

A state space model (SSM) is an AI model architecture that reads long sequential data, such as text or audio, one piece at a time from the start, continually overwriting a fixed-size summary called the 'state' with what it has seen so far. It is drawing attention as a way to replace or complement the Transformer.

About this term
Level
Advanced · Specialist terms that need the inner workings
Added
2026-10-08
In plain words It is like listening to a long meeting and, instead of keeping the full transcript, repeatedly rewriting only the key points on a single sheet of notepaper. Because there is only one sheet, details from long ago can fade. That is both the limit of this analogy and a real weakness of SSMs.

How it works

An SSM updates its internal 'state' each time it receives an input token (a small piece of text). The state is a compressed summary of everything read so far, and its size never changes. The model looks at the new token and the previous state together, updates the state, and then produces output based on that state. Attention in a Transformer looks back over every previous token for each new token, but an SSM only needs to look at one summary, so the amount of computation does not grow much as the text gets longer. Recent SSMs such as Mamba improved performance by choosing what to keep and what to forget based on the input (selective SSM).

The loop an SSM uses to process tokensCurrent token → State update; State update → Fixed-size state; Fixed-size state → Output; Fixed-size state → State update(To the next token)Current tokenState updateChoose what to keepand forgetFixed-size stateSummary so farOutputDifference from TransformersAttention looks back overall previous tokensTo the next token
The loop an SSM uses to process tokens Each time a token comes in, the fixed-size state is updated and used to produce output. The updated state is used again when processing the next token.

Why it matters

In a Transformer, computation and memory (including the KV cache) grow quickly as the input gets longer, which makes very long documents, audio or genomic data costly to handle. An SSM's cost grows only in proportion to input length, which is an advantage for long data. When generating an answer, it only needs to carry a fixed-size state, so inference is fast and uses little memory. That is why there is strong interest in SSMs for services where long context and efficiency matter, and for on-device AI.

Things to know

Because all information is squeezed into one small state, SSMs are widely considered weaker than attention at finding a specific sentence in a long text and copying it exactly. For this reason, 'hybrid' architectures that mix SSM layers and attention layers are now common. The 'state space' in the name comes from a mathematical framework originally used to describe systems in control engineering, but from a user's point of view it is enough to think of it as 'a sequential model that carries a summary.' The idea resembles an RNN, but the difference is that it is designed so training can run quickly in parallel.

Example

Mamba is a well-known SSM-based language model architecture and has since been tested as a Transformer alternative in a number of studies and open-weight models. On the product side, hybrid LLMs that alternate SSM layers and attention layers have appeared, promoting lower memory use and fast responses even with long documents as their advantages.

Related terms