Why new sequence models are showing up now
Teams keep running into the same friction with transformers: attention is powerful, but it gets expensive as sequences grow. If you double the context window, you don’t just pay a little more; you often pay a lot more in memory bandwidth, latency, and GPU RAM. That cost shows up in product settings like long-document chat, code navigation, log analysis, and any workflow where “just increase the context” becomes the default request.
At the same time, deployment constraints have tightened. Serving models in real time, streaming token-by-token, or running on smaller GPUs rewards methods with predictable, hardware-friendly access patterns. That combination—longer contexts plus stricter inference budgets—is why alternatives like modern neural state space models have moved from theory to practical engineering discussion.
State space models in plain machine-learning terms
You can think of a state space model as a recurrent system with three parts: a “state” vector that carries information forward, an “update” rule that takes the current input token and the previous state to produce the next state, and a “readout” that turns the state into an output representation. In other words, it’s closer in spirit to an RNN than to attention, but modern SSMs make that recurrence stable, parallelizable, and easy to train.
Instead of explicitly comparing every token to every other token, an SSM processes the sequence in order, continually compressing what it has seen into the state. Long-range effects come from how the update mixes old state with new input, not from a lookup over all past tokens. The practical trade-off is immediate: the model doesn’t get random access to the full history, so it can be harder to “pinpoint” a specific earlier detail, but it can stream with predictable memory use and low per-token overhead.
How modern neural SSMs actually run on text
In a text model, each token is still embedded into a vector, then fed through a stack of blocks. In an SSM block, the core computation is a repeated state update: a learned linear “mixing” of the previous state plus a learned projection of the current token features. What changed in modern neural SSMs is implementation: during training, you don’t have to step token-by-token in Python. The update can be expressed as a fast parallel scan (or as a convolution-like operation for certain parameterizations), which maps cleanly to GPU kernels and keeps memory access mostly sequential.
At inference, the picture is simpler: you cache only the current state per layer and update it once per generated token. Some recent variants add input-dependent gating so the update can “pay more attention” to certain tokens without materializing a full attention matrix. The constraint is real: because everything is funneled through the state, retrieving a precise earlier detail can be harder than with explicit attention-based lookup.
Transformer attention: the mechanism you’re comparing against

You’ve likely used attention without thinking about it: each new token builds a weighted mix of earlier token representations, where the weights come from similarity scores between a “query” (what this position wants) and “keys” (what past positions offer). The mixed result (the attention “value” sum) becomes the context-aware representation that the next layers and the output head consume.
The key property is random access. If a specific earlier token strongly matches the query, attention can pull it forward directly, even if it occurred thousands of tokens ago. The cost is that, for a full sequence, you’re forming and reading a large matrix of pairwise interactions. Even with optimizations and chunking, that pattern tends to stress GPU memory and bandwidth, and caching keys/values per layer grows with context length during generation.
The real differences: memory, compute, and access patterns
If you’ve ever profiled a long-context transformer, the bottleneck often looks less like “not enough math” and more like “too much movement.” Attention creates a workload where each token needs to read from many earlier positions, and during generation you typically cache keys and values for every past token in every layer. That cache grows linearly with context length, and the work to use it is effectively a big gather-and-weight operation with unfriendly memory access. It’s why doubling context can feel like blowing up latency and GPU RAM, even when the model size stays fixed.
An SSM flips that: it spends compute on updating a compact state and keeps memory traffic mostly sequential. At inference you cache only the per-layer state, so memory is effectively constant with respect to context length, and per-token latency is more predictable. The trade-off is access patterns: attention is like searchable memory where you can fetch a specific detail when the query matches, while an SSM is like a running summary that has to have encoded that detail in its state. If the state is too small or the task needs precise retrieval, quality can drop or you pay by increasing state size and depth.
What each model is good at in practice

If you’re building something like long-log triage, long-document ingestion, continuous monitoring, or any “read forever, keep a working memory” pipeline, SSM-style blocks tend to fit the operational shape. You can stream tokens with stable per-token memory, keep latency smoother as context grows, and avoid carrying an ever-expanding key/value cache. That makes them attractive when you’re boxed in by GPU RAM, need predictable throughput, or want to run longer contexts without redesigning the whole serving stack. The catch is practical: if your application depends on exact detail recall (a specific variable name from 40k tokens ago, a clause in a contract, a line number in a diff), an SSM has to have compressed that detail into state, and it doesn’t always.
Attention-heavy transformers still shine when the task is “find and reuse something specific from earlier,” especially with tool-like behaviors: targeted question answering over a document, code assistance that copies identifiers consistently, or multi-hop reasoning that benefits from explicit token-to-token links. You pay for that capability with higher memory bandwidth demands and a KV cache that grows with context length, which can force shorter windows, slower generation, or more aggressive batching compromises in production.
Choosing between them without overthinking it
A practical way to choose is to start from your bottleneck. If you’re serving with tight GPU RAM, need stable token-by-token latency, or expect very long or streaming inputs, an SSM-style backbone is often the safer engineering default because state caching stays constant with context length. If your quality failures look like “it forgot one specific earlier detail” or you rely on copying exact strings, attention is still the more reliable mechanism because it can directly retrieve past tokens.
The real constraint is that SSM gains aren’t free: you may need larger state, more layers, or hybrid blocks to match attention-heavy quality on retrieval-like tasks. When in doubt, benchmark on your longest realistic inputs and measure end-to-end throughput, not just training loss.