TL;DR
A semiseparable matrix is a square matrix with zeros above the diagonal, where every block sitting below the diagonal has low rank. That low-rank rule means the whole matrix can be described by a few small vectors and matrices, instead of every entry.
The payoff is speed. Multiplying a vector by a semiseparable matrix can be done as a running recurrence in time proportional to the length, not the square of it. This is why the structure matters for sequence models: a state space model is exactly a semiseparable matrix acting on a sequence.
Where you'll see it: in the structured form of state space models such as Mamba-2, in fast solvers for certain integral equations, and in the recurrence that computes a running weighted sum.
Intuition
Low rank below the diagonal
Think of a lower triangular matrix as a table of influences: entry says how much input at time affects output at time , for . For a generic lower triangular matrix, there is no shortcut. Every entry is a separate number, and storing or multiplying it costs about work for a length- sequence.
A semiseparable matrix adds one rule: any rectangular block that lies on or below the diagonal must have low rank. Low rank means the block is secretly built from only a few independent patterns. Intuitively, the influence of the early past on the late future flows through a narrow channel, a state of bounded size, so you never need to remember the full history entry by entry.
That narrow channel is the hidden state of a recurrence. Once you see the matrix as "a small memory passed forward through time", you have the algorithm too: carry the state, update it, read out the output.
- a = 0.9
- a = 0.5
The math
Definition
A lower triangular matrix is -semiseparable if every submatrix that lies on or below the diagonal has rank at most . The number is the order of .
A submatrix is any choice of rows and columns, kept in their original order. The condition covers all of them, including the large block in the bottom-left corner. Entries on the diagonal and above the diagonal are either zero or set by the triangular rule.
The SSS representation
The definition says what the matrix looks like, not how to store it. The useful form is the sequentially semiseparable (SSS) representation. Pick vectors and matrices , and write
Here is the entry in row and column , is an input vector, is an output vector, and the product of matrices carries the state from time forward to time . The empty product for is the identity, so .
Two facts make this useful.
- Every SSS matrix is -semiseparable. Any block below the diagonal factors as a product of an -column matrix and an -row matrix, so its rank is at most .
- Every -semiseparable matrix has an SSS form. The converse holds, so the two descriptions are equivalent. The SSS form also compresses the parameters: the naive count is about , but it can be reduced to about .
Because of the SSS form, multiplying becomes a recurrence on an -dimensional state:
Each step costs about operations, so the total cost is linear in .
The scalar case: 1-semiseparable matrices
Set . Then each and is a number, and they can be pulled out as diagonal scalings. What remains is a lower triangular matrix with entries , where is the product and . For length 3 this is
Multiplying this matrix by is the scalar recurrence with . This is the cumulative product-sum, the simplest case of a state space model. The causal mask in linear attention is also a 1-semiseparable matrix.
Why the rank condition is the right one
A rank bound on every lower block is a statement about information flow. If the lower-left block has rank , the future depends on the past through numbers. Rank counts how many independent directions the block can move in, which is exactly the size of the state the recurrence must carry. This is the connection the Mamba-2 paper builds on: state space models are semiseparable matrices, so their hidden state size is the semiseparable order.
Worked examples
Take and , and the 3 by 3 matrix
- Check the rank condition on the lower block made of rows 2 and 3 and columns 1 and 2: it is .
- Its determinant is , so its rank is 1, which is at most .
- Multiply by directly: , , .
- Run the recurrence with : , then .
Interpretation: both routes give the same answer, but the recurrence uses two multiplications and two additions, while the dense product uses six multiplications by nonzero entries. The gap grows with length.
Let for every step, so on and below the diagonal. Use length and input , a single spike at the start.
- Multiplying by picks out the first column of : .
- Run the recurrence to confirm: , , , .
- Each step multiplies the old state by , so the spike fades geometrically.
Interpretation: the matrix encodes a memory that forgets at a fixed rate. Changing to a value nearer shortens the memory. A state space model learns these decay rates, and a selective model lets them depend on the input.
Tradeoffs and failure modes
Semiseparable structure is a bet that the influence of the past can be summarised by a small state. When that bet holds, you get linear-time computation. When it does not, the structure is a poor fit.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Long sequence, information decays with distance | Structure fits; linear cost pays off | Use a semiseparable or state space model |
| Every token must be compared with every other token, arbitrary pattern | Low-rank blocks cannot capture it; the state is too small | Dense attention, accepting quadratic cost |
| Need to store the full matrix for a dense solve | Storage is quadratic and the structure is ignored | Exploit the rank structure directly with a structured solver |
| Recurrence is computed one step at a time on a GPU | Sequential steps underuse parallel hardware | Use the chunked or block decomposition, which trades a little memory for parallelism |
| Numerical errors accumulate over very long products | Repeated multiplication by can drift | Keep the decay factors well inside the unit circle, or normalise the state |
The rank condition is exact, but the parameters that realise it are usually learned or chosen. A matrix that is semiseparable in principle can still be hard to use if its state is too small for the task.
History
Semiseparable and quasiseparable matrices were studied in numerical linear algebra and in systems theory during the late twentieth century, where they give fast algorithms for certain structured linear systems. The Mamba-2 paper calls these rank-structured matrices and notes that several related definitions exist (quasiseparable and other semiseparable variants).
For most of that time the connection to sequence models was not part of the picture. Recurrent and state space models were treated as signal-processing tools. Dao and Gu (2024), in the Mamba-2 paper, showed that a state space model is exactly a semiseparable matrix acting on a sequence. That equivalence gave a new block decomposition of the matrix, which yields a fast algorithm that mixes the linear recurrence with a quadratic form.
Check yourself
QuestionIn one sentence, what does the semiseparable condition require of the blocks below the diagonal?Show answer
Every submatrix on or below the diagonal has rank at most , where is the order. Equivalently, the influence of the past on the future passes through a state of at most dimensions.
QuestionFor , , compute the product with using the matrix from the first worked example.Show answer
Rows of are , and . So , , and . The recurrence agrees: , , .
QuestionWhy does a rank- bound give an algorithm that runs in time linear in the length, not quadratic?Show answer
The rank bound lets the matrix factor into an SSS form with -dimensional state. Multiplying by the matrix then becomes a recurrence that carries an -vector from one step to the next. Each step costs about operations, so the total is about , linear in for fixed . A dense product costs about .
QuestionA state space model has state size and sequence length . Roughly how many multiplications does the recurrence need, compared with the dense product?Show answer
The recurrence needs about multiplications for the matrix-vector step, ignoring constants. The dense product needs about . The ratio is , so the recurrence is about four times cheaper here, and the gap widens as grows.
QuestionGive one reason the 1-semiseparable case is more than a special case of little interest.Show answer
It is exactly the scalar recurrence , which is the core operation of many sequence models and of the causal mask in linear attention. Any fast algorithm for this recurrence is also a fast algorithm for the structured matrix, which is why the Mamba-2 paper treats it as the building block of its main algorithm.
Sources
- Dao and Gu (2024), Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality (the Mamba-2 paper): https://arxiv.org/abs/2405.21060
- Gu and Dao (2023), Mamba: Linear-Time Sequence Modeling with Selective State Spaces: https://arxiv.org/abs/2312.00752
- Rank (linear algebra) (Wikipedia): https://en.wikipedia.org/wiki/Rank_(linear_algebra)