Definition
State space duality (SSD) is the theoretical framework introduced with Mamba-2 that proves a deep equivalence between certain state-space models and a form of masked attention. It shows that the same sequence transformation can be computed two ways: as a linear-time recurrence that carries a fixed-size state, or as a quadratic-time attention-like matrix multiplication. The two are not approximations of each other; they are exactly the same operation expressed through different algebra. For anyone watching the architecture race between transformers and recurrent models, SSD is the result that showed the two camps had been climbing the same mountain from different sides.
The structured-matrix bridge
The connection runs through structured matrices. Any sequence model can be described by the matrix that maps its inputs to its outputs; the question is what structure that matrix has. A state-space model whose state transition is a scalar times the identity turns out to be equivalent to masked self-attention using a special structured mask (a 1-semiseparable matrix) that encodes the temporal decay of information. That matrix view is what reveals the duality: the recurrence and the attention computation are two factorizations of one structured matrix. Evaluate it row by row and you get a recurrence with a fixed-size state; evaluate it as a full matrix product and you get something shaped exactly like attention. This unifies two research lineages, state-space models and linear attention, that had developed largely in parallel.
Why it is useful
The practical payoff is speed and flexibility. Because the dual form is a structured matrix multiplication, Mamba-2 can route its work onto the highly optimized matrix-multiply hardware, tensor cores, that modern GPUs are built around, rather than relying solely on a custom scan kernel the way the original Mamba did. Implementers can also choose the linear recurrence for cheap long-context inference or the quadratic form for efficient parallel training, picking whichever is faster for a given sequence length and batch size. In practice, efficient implementations work blockwise: attention-style computation within chunks, recurrence between chunks, getting the best of both regimes.
What it means downstream
SSD also transfers a decade of attention engineering across the bridge. Tricks developed for transformers, tensor-parallel sharding, head structures, kernel fusion patterns, gain state-space counterparts almost for free once the two are recognized as the same computation, which accelerated the maturation of Mamba-style models considerably. The framework likewise clarifies trade-offs: the constant-size state that makes recurrence cheap is also a compression bottleneck, which is why hybrid stacks interleave a few full-attention layers among SSD layers for tasks that need precise long-range recall.
Why a self-hoster should care
For local AI, the recurrent side of the duality is the attractive one. A transformer's KV cache grows with every token of context, devouring VRAM on long documents; an SSD-style layer carries a fixed-size state no matter how long the input runs. Models built on this family promise long-context inference at flat memory cost, exactly the constraint that bites hardest on a single consumer GPU. State space duality ties together several entries in this glossary: see selective state space for the mechanism that made these models competitive, and gated linear attention for the neighbouring family the same theory illuminates.
The honest caveat is that theory equalizes computation, not capability. SSD says the recurrent and attention forms compute the same function for this model family; it does not say such models match full transformers on every task, and empirically the fixed-size state still trades away some precise recall. That is why the near-term winners are hybrids, and why the practical advice for a self-hoster is unchanged by the elegance of the math: benchmark on your own workload, at your own context lengths, on your own hardware, and let the duality explain the results rather than predict them.
In Simple Terms
State space duality (SSD) is the theoretical framework introduced with Mamba-2 that proves a deep equivalence between certain state-space models and a form of masked…
