These notes develop the mathematics of structured state space models, from the linear ordinary differential equation underlying S4 to the three modifications that define Mamba-3. The organising observation is that this entire line of work answers one question repeatedly: how should we parameterise a linear dynamical system so that it is expressive enough to memorise long contexts, parallel enough to train efficiently, and cheap enough to run token by token? Every design decision we will meet is a trade among these three requirements, and we will try to name, at each step, which of the three is being bought and which is being paid.
Fig. 0 — The HiPPO-LegS recurrence, run live on the closed-form matrix of §2 (nothing here is trained or approximated beyond the discretisation itself). The teal curve reconstructs the entire input history from the N numbers of the state. Reducing N to 4 leaves only the coarse trend; raising it to 64 recovers recent detail. The reconstruction error is reported in the panel, and in §2 we verify that the state coincides with the exact L²-projection coefficients.
This figure states the thesis of the field. Softmax attention retains every token and pays quadratically in sequence length; the system above retains a fixed N-vector and pays a constant per token. The interesting question is therefore what that vector should contain — and everything from HiPPO's Legendre coefficients (§2) to Mamba-3's rotating complex pairs (§10) can be read as a successive refinement of the answer.
Every figure in these notes computes its own numbers in the browser, from the same formulas stated in the text — the HiPPO matrix, the S4 diagonalisation, the semiseparable mask, the arithmetic-intensity model. Several figures are constructed to fail visibly under the reader's control, because two of the decisive events in this history were numerical failures rather than modelling ones, and a failure one can reproduce is more instructive than a failure one is told about.
Where a claim rests on a specific numbered result, that result is cited. Where a paper's stated motivation and its released model differ, the difference is recorded rather than smoothed over; this happens more than once.
We begin by fixing the object of study. Throughout these notes, the base object is a linear time-invariant (LTI) system mapping a scalar input \(u(t)\in\mathbb{R}\) to a scalar output \(y(t)\in\mathbb{R}\) through a hidden state \(x(t)\in\mathbb{R}^N\):
with \(A\in\mathbb{R}^{N\times N}\), \(B\in\mathbb{R}^{N\times1}\), \(C\in\mathbb{R}^{1\times N}\), \(D\in\mathbb{R}\). A model with \(H\) channels runs \(H\) independent copies of (1). This is the single-input single-output (SISO) convention adopted by S4 and Mamba. We flag it now because it becomes load-bearing later: Mamba-2 widens the head dimension in §7, and Mamba-3 abandons SISO deliberately in §11.
Equation (1) admits an explicit solution. Introduce the integrating factor \(z(t)=e^{-At}x(t)\); then \(\dot z = e^{-At}(\dot x - Ax) = e^{-At}Bu(t)\), and integrating from \(0\) to \(t\) yields
With \(D=0\) and \(x(0)=0\) the input–output map is therefore a convolution, \(y = h * u\), with impulse response \(h(t)=Ce^{At}B\); equivalently, the transfer function is \(H(s)=C(sI-A)^{-1}B+D\).
A single linear system is simultaneously a recurrence in \(x\) and a convolution on \(u\). These are not two approximations of one another; they are two algorithms for the same operator.
The consequence for machine learning is immediate. Training favours the convolutional view, because a convolution parallelises over the sequence; generation favours the recurrent view, because a recurrence costs constant work per token. Every architecture in these notes exploits one view or the other, and the central technical difficulty — first encountered in §6 — is that input-dependent parameters destroy the convolutional view, so that something must be constructed to replace it.
To make the equivalence concrete, consider \(N=2\) with a complex-conjugate eigenvalue pair \(\lambda = \sigma \pm i\omega\). The impulse response is then a decaying sinusoid, and the recurrence and the convolution must produce identical output — a claim the figure below verifies numerically, printing the maximum disagreement between the two computations.
Fig. 0.2 — Setting \(\omega=0\) reduces the kernel to pure decay: a low-pass filter with no record of when anything occurred. A nonzero \(\omega\) makes the system ring, which is the only mechanism by which a linear recurrence can encode phase. This observation returns in §8–§10: rotation is precisely the capability Mamba-2 gives up and Mamba-3 restores.
import numpy as np
# The two views, on the same discretised (Abar, Bbar, Cbar).
def by_recurrence(Ab, Bb, Cb, u):
x = np.zeros(Ab.shape[0], dtype=Ab.dtype)
y = np.empty(len(u), dtype=Ab.dtype)
for k, uk in enumerate(u):
x = Ab @ x + Bb * uk # O(N^2) per token, O(N) state
y[k] = Cb @ x
return y
def by_convolution(Ab, Bb, Cb, u):
# Krylov sequence K_k = Cbar Abar^k Bbar -- the impulse response.
K, p = [], Bb.copy()
for _ in range(len(u)):
K.append(Cb @ p); p = Ab @ p
# The same operator, now parallel over the sequence: one FFT pair.
n = 1 << (2 * len(u) - 1).bit_length()
return np.fft.ifft(np.fft.fft(np.array(K), n) *
np.fft.fft(u, n))[:len(u)]
# The two agree to machine epsilon. This agreement is the licence to
# train with one algorithm and infer with the other.
Data arrives in discrete samples, so equation (1) must be replaced by a recurrence \(x_k = \bar A x_{k-1} + \bar B u_k\). There is more than one way to perform this replacement, and the choice governs stability, accuracy, and — less obviously — the entire notion of gating in recurrent networks. We treat the standard schemes first and then derive the gating identity, which will serve as the conceptual seed of §6.
Write the ODE in integral form on \([t_{k-1},t_k]\) and approximate \(\int Ax(s)\,ds\) by a convex combination of the endpoint values, with weight \(\alpha\in[0,1]\):
Solving for \(x_k\) gives the generalised bilinear transform (GBT) family:
The cases \(\alpha=0\), \(\alpha=1\), and \(\alpha=\tfrac12\) recover forward Euler, backward Euler, and the bilinear (Tustin) transform respectively; the last preserves stability for every step size and is the scheme S4 adopts. (HiPPO App. B.3; LSSL eq. 3; S4 eq. 3.)
If we instead assume \(u\) piecewise constant on each interval of length \(\Delta\), the variation-of-constants integral requires no approximation at all — it evaluates exactly to
This zero-order hold (ZOH) is the scheme used by S4D and S5. We note for later that Mamba-3 Prop. 5 extends (3) to the time-varying setting by the naive substitution \(A\to A_t\), \(B\to B_t\), \(\Delta\to\Delta_t\) — a step that Mamba-1 had assumed without proof.
Fig. 1.2 — Increasing Δ past \(2/|A|\) drives forward Euler's \(\bar A\) outside the unit disc: the red trace diverges while the remaining schemes stay contracting. This is the practical content of the statement that the bilinear transform preserves stability. Note also that every scheme drives \(\bar A\to I\) as \(\Delta\to0\); this innocuous-looking limit is precisely the regime in which the LSSL algorithm of §3 fails.
We now come to the result that ties classical recurrent networks to state space models. It is short enough to state and prove completely.
A gated recurrence \(x_k=(1-\sigma(z))x_{k-1}+\sigma(z)u_k\) is exactly the \(\mathrm{GBT}(\alpha{=}1)\) discretisation of \(\dot x = -x + u\) with step size \(\Delta=\exp(z)\).
Backward Euler applied to \(\dot x=-x+u\) gives \(x_k-x_{k-1}=\Delta(-x_k+u_k)\), that is, \(x_k = \frac{1}{1+\Delta}x_{k-1} + \frac{\Delta}{1+\Delta}u_k\). Substituting \(\Delta=e^{z}\),
\[ \frac{\Delta}{1+\Delta}=\frac{e^z}{1+e^z}=\sigma(z), \qquad \frac{1}{1+\Delta}=1-\sigma(z). \qquad\square \]
The sigmoid gate of an LSTM, GRU or QRNN is thus not merely analogous to a step size; it is one, and the sigmoid's functional form is derived rather than posited. The figure below evaluates both sides of the identity at the reader's choice of \(z\); they agree to the last representable digit.
Fig. 1.3 — Large \(z\) corresponds to a large step: rapid forgetting and strong uptake of the current input, i.e. an open gate. Small \(z\) corresponds to a small step: near-perfect retention with little uptake, i.e. a closed gate. Making \(z\) a function of the input is exactly the move Mamba makes; §6 consists of this identity plus data dependence.
With \(x_{-1}=0\), unrolling the discrete recurrence yields
The sequence \(\mathcal{K}_L\) is a Krylov sequence. Computed naively it costs \(O(N^2L)\) time and \(O(NL)\) space, whereas the sizes of the input and output alone impose only an \(\Omega(N+L)\) lower bound. Closing this gap is the computational programme of the next three sections: LSSL attempts it and fails on numerical grounds (§3), and S4 completes it (§4).
Before computing with (1) efficiently, we must ask what the matrix \(A\) ought to be. The question is not academic: an arbitrary \(A\) yields a model with no useful memory properties, and the gap is large in practice — LSSL §5.4 reports 62% accuracy on permuted MNIST with a random \(A\) against 98.76% with the HiPPO initialisation. The matrix is the memory mechanism.
HiPPO poses the question in a form that admits a principled answer: what should the state \(x(t)\in\mathbb{R}^N\) be, if it is to be the optimal running compression of the input history \(u_{\le t}\)?
Fix a time-varying probability measure \(\mu^{(t)}\) supported on \((-\infty,t]\) with density \(\omega(t,\cdot)\), and an \(N\)-dimensional space \(\mathcal{G}\) of polynomials of degree \(<N\). Define two maps:
Set \(\mathrm{hippo} := \mathrm{coef}_t\circ\mathrm{proj}_t\). The central claim is that \(x(t)\) then satisfies a linear ODE \(\dot x = A(t)x + B(t)u\) with structured, closed-form \(A(t)\) — proved case by case in HiPPO, and for arbitrary measures in LSSL Thm. 1. It is worth understanding why such a closure can exist at all.
With \(x_n(t)=\int_0^t u(Y)\,p_n(t,Y)\,\omega(t,Y)\,dY\), differentiate under the integral sign:
\[ \dot x_n(t) = \underbrace{u(t)p_n(t,t)\omega(t,t)}_{\to\,B(t)u(t)} + \int_0^t u\,\big(\partial_t p_n\big)\,\omega\,dY + \int_0^t u\,p_n\,\big(\partial_t\omega\big)\,dY . \]
The boundary term at \(Y=t\) supplies \(B(t)u(t)\). The middle term closes because \(\partial_t p_n\) is a polynomial of degree \(\le n-1\), hence expressible as a finite linear combination of \(p_0,\dots,p_{n-1}\) — equivalently, of \(x_0,\dots,x_{n-1}\). The final term closes whenever \(\partial_t\omega\) can be re-expressed through \(\omega\).
The result is a linear ODE, and — the point we wish to emphasise — the triangular structure of \(A\) is a direct consequence of \(\deg(\partial_t p_n)<n\). The shape of the matrix is not a design choice but a fact about differentiating orthogonal polynomials.
The instance used throughout S4 and Mamba is the scaled Legendre measure, \(\omega^{(t)}=\tfrac1t\mathbb{I}_{[0,t]}\), whose window grows with \(t\) rather than sliding along it:
with \(n,k\) indexed from \(0\). The sign of \(A\) is essential — the system evolves under \(-A\), whose spectrum we compute momentarily to be strictly negative. The derivation rests on the Legendre identity \((x+1)P_n'(x)=nP_n+(2n-1)P_{n-1}+(2n-3)P_{n-2}+\cdots\) (HiPPO eq. 8); the \(\tfrac1t\) prefactor is the trace of the measure's rescaling.
HiPPO eq. (30) provides a factorisation that repays close attention: \(A = D\,M\,D^{-1}\) with \(D=\mathrm{diag}\big[(2n+1)^{1/2}\big]\) and
Thus \(A\) is diagonally similar to a lower-triangular integer matrix with diagonal \(1,2,\dots,N\), whence \(\mathrm{spec}(A)=\{1,\dots,N\}\) and \(\mathrm{spec}(-A)=\{-1,\dots,-N\}\): strictly stable, with distinct real eigenvalues. This single observation is used twice in what follows — once in HiPPO's gradient-norm argument, and once in §4, where it guarantees that a diagonalisation of \(A\) exists and where we will measure how badly conditioned that diagonalisation is.
Fig. 2.3 — The residual view provides the check: \(A - DMD^{-1}\) vanishes to floating-point accuracy at every \(N\), so the factorisation is exact, and the spectrum lies on the integers \(1..N\) without drift. Observe how strongly non-normal \(A\) is — all mass below the diagonal, none above. §4 is devoted to the price of this asymmetry.
import numpy as np
def legs(N):
"""HiPPO-LegS (A, B) from the closed form, 0-indexed."""
n = np.arange(N)
s = np.sqrt(2 * n + 1) # (2n+1)^(1/2)
A = np.tril(np.outer(s, s), -1) + np.diag(n + 1)
return A, s
# The eq.(30) factorisation A = D M D^-1, M integer lower-triangular.
def legs_integer_form(N):
n = np.arange(N)
M = np.tril(np.broadcast_to(2 * n + 1, (N, N)), -1) + np.diag(n + 1)
D = np.diag(np.sqrt(2 * n + 1))
return M, D
A, B = legs(64)
M, D = legs_integer_form(64)
assert np.allclose(A, D @ M @ np.linalg.inv(D)) # exact
assert np.allclose(np.sort(np.linalg.eigvals(A).real),
np.arange(1, 65)) # spec(A) = {1..N}
| property | statement | significance |
|---|---|---|
| Timescale equivariance (Prop. 3) | if \(h(t)=f(\alpha t)\) then \(\mathrm{hippo}(h)(t)=\mathrm{hippo}(f)(\alpha t)\) | LegS carries no timescale hyperparameter, and its discrete recurrence is invariant to \(\Delta\) |
| Gradient norm (Prop. 5) | \(\|\partial c(t_1)/\partial f(t_0)\| = \Theta(1/t_1)\) | gradients decay polynomially in time, not exponentially |
| Approximation (Prop. 6) | \(O(tL/\sqrt N)\) for \(L\)-Lipschitz \(f\); \(O(t^kN^{-k+1/2})\) for \(k\)-times differentiable \(f\) | smoothness of the input buys a substantially better rate in \(N\) |
| Cost (Prop. 4) | \(O(N)\) per step under any GBT | the triangular-plus-rank structure is what makes each step affordable |
Compare HiPPO-LegT (translated Legendre, fixed window \(\theta\)), which recovers the Legendre Memory Unit exactly and inherits its window hyperparameter: 98.0% at \(\theta{=}200\) but 91.75% at \(\theta{=}20\) on the same task. It is the scaled measure that renders the memory horizon-free.
This also explains a feature of Fig. 0: the reconstruction window there grows with the history rather than sliding over it. That behaviour is not a rendering choice — it is the LegS measure itself.
LSSL contributes three things: it names equation (1) as a first-class sequence-to-sequence layer; it formalises the observation that this layer is simultaneously recurrent, convolutional and continuous-time; and it generalises HiPPO to arbitrary measures. It also supplies what is, in our view, the most instructive negative result in the lineage, and we will spend some care on it, because its failure mode dictated the design of S4.
One might object at the outset that a stack of linear layers is too weak a model class. LSSL disposes of this objection:
Infinitely deep stacked LSSL layers of order \(N{=}1\) with position-wise nonlinearities approximate any nonlinear ODE \(\dot x = -x + f(t,x)\).
The proof applies Picard iteration to the exponential-adjusted system \(z(t)=e^{-At}x(t)\): the iterates \(\dot x^{(\ell)} = Ax^{(\ell)} + f(t,x^{(\ell-1)})\) converge to the solution, with each iterate realised by one linear layer plus a position-wise nonlinearity.
Combined with §1.3, this yields a picture worth pausing on: a deep gated linear RNN and a deep linear SSM approximate the same continuous dynamics by two orthogonal devices — Picard iteration in depth, discretisation in time. The linearity of each individual SSM layer is therefore not a modelling limitation; the nonlinearity lives between the layers, and depth performs the fixed-point iteration.
Both computational views are expensive for a generic dense \(A\): the recurrence requires the powers \(\bar A^k\), and the convolution requires the Krylov sequence \(\mathcal{K}_L\). LSSL's response is to exploit the structure that §2 showed HiPPO matrices to possess.
Thm. 1 (informal). For an arbitrary measure \(\omega\), \(\mathrm{hippo}(\omega)\) has the form \(\dot x = Ax+Bu\) for a low-recurrence-width (LRW) state matrix \(A\).
Cor. 4.1. For the classical orthogonal polynomials (Jacobi — hence Legendre and Chebyshev — and Laguerre), \(\mathrm{hippo}(\omega)\) is 3-quasiseparable.
Def. 4 (after Eidelman–Gohberg). \(R\in\mathbb{R}^{N\times N}\) is \((p,q)\)-quasiseparable if every submatrix lying strictly above the diagonal has rank \(\le p\) and every submatrix strictly below has rank \(\le q\); \(q\)-quasiseparable abbreviates \((q,q)\).
LRW matrices admit \(\tilde O(N)\) matrix–vector multiplication, which settles the recurrent view. For the convolutional view, LSSL Thm. 2 asserts that \(\mathcal{K}_L(A,B,C)\) can be computed in \(\tilde O(N+L)\) time and space at logarithmic depth for any \(k\)-quasiseparable \(A\) with constant \(k\), by a divide-and-conquer recursion over matrices of polynomials that exploits the relation between (4) and the power series \(C(I-Ax)^{-1}B\).
The theorem, however, carries a qualification: the operation count is stated in an exact arithmetic model, without accounting for bit complexity or numerical stability. That qualification turns out to contain the entire outcome.
LSSL §6 records that a follow-up investigation found the Thm. 2 algorithm numerically unstable and therefore unusable in practice; S4 App. B.2 identifies the mechanism. The algorithm computes, as intermediates, the characteristic polynomial \(p(x)\) of \(\bar A\) and its inverse modulo \(x^L\). Now recall from Fig. 1.2 that discretisation drives \(\bar A \to I\) as \(\Delta\to0\). In that regime \(p(x)=(1-x)^N\), whose coefficients reach \(\binom{N}{N/2}\), and \((1-x)^{-N}=\sum_k\binom{N+k-1}{k}x^k\) is larger still: at \(L=N-1\) the leading coefficient is \(\binom{2(N-1)}{N-1}\).
These are exponentially large intermediates inside a double-precision pipeline. The conclusion to retain: arithmetic complexity was never the binding constraint; conditioning was.
Fig. 3.2 — At the \(N=64\) that S4 in fact ships, the larger intermediate is already \(6.0\times10^{36}\): representable, but combined additively with quantities of order one, so that relative precision — not the exponent — is what is destroyed. Hard overflow arrives only near \(N=516\); the algorithm was unusable long before. A quiet loss of precision is a worse failure mode than a crash, because nothing announces it.
S4 retains HiPPO's matrix and replaces the algorithm that computes \(\mathcal{K}_L\). The construction has three ingredients — a normal-plus-low-rank decomposition, the Woodbury identity, and fast Cauchy-kernel evaluation — and its reliability derives from the fact that each ingredient is an object with a long history in numerical linear algebra. We develop the three steps in order, beginning with the question the reader should already be asking.
Conjugation is an equivalence on SSMs: \((A,B,C)\sim(V^{-1}AV,\,V^{-1}B,\,CV)\) compute the same operator (S4 Lemma 3.1), and conjugation commutes with discretisation. Were \(A\) diagonal, \(\mathcal{K}_L\) would reduce to a Vandermonde product costing \(O((N+L)\log^2(N+L))\). And by §2.3 the spectrum of \(A\) is distinct and real, so \(A\) certainly is diagonalisable. The obstruction is quantitative rather than structural:
The HiPPO matrix is diagonalised by \(V_{ij}=\binom{i+j}{i-j}\). In particular \(V_{3i,i}=\binom{4i}{2i}\approx 2^{4i}\), so \(V\) has entries of magnitude up to \(2^{4N/3}\).
For \(N=64\) this is of order \(2^{85}\). The change of basis is therefore exact over \(\mathbb{R}\) and unusable in floating point: the product \(CV\) cannot be computed to any useful accuracy. Rather than take this on authority, the figure below constructs \(V\), performs the conjugation in float64, and reports the residual as a function of \(N\).
Fig. 4.1 — In exact arithmetic \(V^{-1}MV = \mathrm{diag}(1..N)\). The measured off-diagonal residual is \(\sim\!10^{-13}\) at \(N=6\), \(\sim\!10^{-3}\) at \(N=16\), and \(\sim\!10^{5}\) at \(N=24\) — four orders of magnitude above the largest true eigenvalue. The two error curves are worth reading separately: the eigenvalues outlast the basis (still accurate to \(10^{-6}\) at \(N=16\), where the off-diagonal has already reached \(10^{-3}\)), but beyond \(N\approx20\) even the diagonal drifts by order one. The theorem is true; no computer can use it.
The lesson is that only conjugations by well-conditioned \(V\) are admissible, the ideal case being unitary \(V\) — which, by the spectral theorem, requires \(A\) to be normal. HiPPO-LegS is far from normal (Fig. 2.3 makes this visible), and its non-normality is precisely why its \(V\) is so ill-behaved. The resolution is that normality fails only by a low-rank correction:
All HiPPO matrices admit a normal-plus-low-rank (NPLR) representation \(A = V\Lambda V^* - PQ^\top = V\big(\Lambda-(V^*P)(V^*Q)^*\big)V^*\) for unitary \(V\), diagonal \(\Lambda\), and \(P,Q\in\mathbb{R}^{N\times r}\) with \(r=1\) or \(2\). Equation (5) is NPLR with \(r=1\).
Add the rank-1 matrix with entries \(\tfrac12(2n+1)^{1/2}(2k+1)^{1/2}\) to \(-A\). A direct check of (5) shows the result equals \(-\tfrac12 I + S\) with \(S\) skew-symmetric. Skew-symmetric matrices are normal with purely imaginary spectrum, so a single unitary diagonalises the corrected matrix; numerically, every eigenvalue of the corrected matrix has real part exactly \(-\tfrac12\), for every \(N\) we test.
Absorbing the unitary \(V\), we may and do assume for the remainder of this section that \(A=\Lambda-PQ^*\) is diagonal plus low-rank (DPLR) over \(\mathbb{C}\). \(\square\)
DPLR alone does not suffice: the powers of a DPLR matrix are not DPLR. Its inverse, however, is — by the Woodbury identity below. The strategy of S4 is therefore a reduction: convert the powers appearing in \(\mathcal{K}_L\) into a single inverse. We carry this out in three steps.
Define the truncated generating function of the kernel,
Since \((I-\bar A z)\sum_{i=0}^{L-1}(\bar A z)^i = I-(\bar A z)^L\), we obtain the exact identity
Evaluating (6) at the \(L\)-th roots of unity \(\Omega=\{e^{-2\pi ik/L}\}\) yields precisely the DFT of \(\mathcal{K}_L\), so a single inverse FFT recovers the kernel in \(O(L\log L)\) (S4 Lemma C.2). The correction factor \((I-\bar A^L)^*\) need never be computed: S4 simply learns \(\tilde C\) as the parameter in place of \(\bar C\).
The reduction announced above is complete at this line: powers of \(\bar A\) have become one resolvent, \((I-\bar A z)^{-1}\).
\((A+UV^*)^{-1} = A^{-1}-A^{-1}U(I_p+V^*A^{-1}U)^{-1}V^*A^{-1}\)
Unwinding the bilinear discretisation (S4 Lemma C.4) gives \(\bar C^*(I-\bar A z)^{-1}\bar B = \tfrac{2}{1+z}\,C^*\big(\tfrac{2}{\Delta}\tfrac{1-z}{1+z}-A\big)^{-1}B\). Writing \(A=\Lambda-PQ^*\) and introducing the diagonal resolvent \(R(z) := \big(\omega(z)-\Lambda\big)^{-1}\) with \(\omega(z):=\tfrac{2}{\Delta}\tfrac{1-z}{1+z}\), Woodbury yields (S4 Lemma C.3)
For \(r=1\) the correction factor \((1+Q^*R(z)P)\) is a scalar: an \(N\times N\) inverse has been exchanged for an \(r\times r\) inverse together with diagonal resolvents.
One detail deserves emphasis. The evaluation nodes are \(\omega(z)\), not \(z\): the bilinear transform maps the unit circle onto the imaginary axis — which is exactly where the spectrum of the skew-symmetric normal part of §4.1 lies. The geometry is not accidental, and the next figure displays it.
Fig. 4.3 — Left: the map. Each root of unity lands on the imaginary axis; the measured \(\max|\mathrm{Re}\,\omega|\) sits at float64 noise. Right: the matrix \(M_{ij}=1/(\omega_i-\lambda_j)\) to which every surviving term reduces. Decreasing Δ concentrates the nodes toward the origin, adjacent to the eigenvalues — and near-collision of nodes with poles is a situation Cauchy-structured algorithms handle gracefully where polynomial bases do not.
Every surviving term in §4.3 has the form \(\sum_j \frac{c_j}{\omega_i-\lambda_j}\), evaluated at all query points \(\omega_i\): a Cauchy matrix–vector product with \(M_{ij}=1/(\omega_i-\lambda_j)\). The complexity of this primitive is classical:
Prop. 5. A Cauchy kernel requires \(O(M+N)\) space and \(O(MN)\) operations naively; \(O((M+N)\log^2(M+N))\) in exact arithmetic; and \(O\!\big((M+N)\log(M+N)\log\tfrac1\varepsilon\big)\) numerically to precision \(\varepsilon\).
Thm. 2 (recurrence). One recurrence step costs \(O(N)\): \(\bar A=\tilde A_1\tilde A_0\) with both factors DPLR, and DPLR matrices admit \(O(N)\) matvec.
Thm. 3 (convolution). \(\mathcal{K}_L\) reduces to four Cauchy multiplies: \(\tilde O(N+L)\) time, \(O(N+L)\) space.
The numerically stable route (Pan, arXiv:1506.02285) converts between Cauchy and Vandermonde structure and applies the Fast Multipole Method to a hierarchically semiseparable approximation. Cauchy matrices are among the most thoroughly analysed objects in numerical linear algebra, and this — rather than any single trick — is the substantive reason S4's algorithm merits trust where LSSL's did not. Against LSSL, the measured improvement is 30× in speed and 400× in memory at width 512.
The released S4 implementation uses the naive \(O(NL)\) Cauchy sum via
pykeops: at \(N\approx64\) the asymptotics do not yet bind, and the FMM has
no GPU implementation. The fast algorithm is an asymptotic guarantee, not the executed
code path. Separately, a later correction (SaShiMi, arXiv:2202.09729) replaces
\(\Lambda-PQ^*\) by \(\Lambda-PP^*\) to prevent eigenvalues from drifting into the right
half-plane during training.
The apparatus of §4 is intricate, and within roughly a year most of it had been retired. Three independent observations account for this, and we state them in logical rather than chronological order.
S4 §4.4 reports that random NPLR matrices perform poorly. Placed next to observation (2), the inference is forced: the benefit resided in the HiPPO initialisation, not in the NPLR parameterisation. The algebra of §4 was the price of computing with one specific, well-chosen matrix; once a diagonal matrix may be chosen directly, that price need no longer be paid.
From this point on we take \(A\) diagonal, discretised by ZOH, equation (3). The stage is now set for the modification that genuinely breaks the convolutional view.
| model | transition | heads | training path | what was given up |
|---|---|---|---|---|
| S4 | HiPPO, DPLR, bilinear | SISO, \(P{=}1\) | Cauchy + FFT | — |
| DSS / S4D | diagonal complex, ZOH | SISO | Vandermonde kernel | the exact HiPPO interpretation |
| S5 | diagonal complex, ZOH | MIMO | parallel scan | per-channel state capacity |
| LRU | diagonal, learned radius/phase | MIMO | parallel scan | the continuous-time interpretation |
S4 is linear time-invariant: \(A,B,C,\Delta\) are fixed across the sequence. Time invariance is exactly what licences the convolutional view — and it entails a limitation worth stating plainly: the model cannot decide, on the basis of content, what to retain. Every token passes through the same filter, whether it carries the answer or a comma.
Mamba removes this limitation by making the step size and the input/output maps functions of the current token:
while \(A\in\mathbb{R}^{D\times N}\) remains a fixed real negative diagonal, parameterised as \(-\exp(A_{\log})\) so that it cannot cross into instability during training.
\(\Delta_t\) is per-channel, whereas \(B_t\) and \(C_t\) are shared across all \(D\) channels, and the head dimension is \(P{=}1\): one independent SSM per channel. Mamba-2 Prop. 7.2 later names this configuration the multi-value-attention / multi-input-SSM pattern and finds it, by ablation, the best of the head structures (§7.5). The choice is not incidental, and §11 will depend on it.
The recurrence becomes linear time-varying (LTV):
Because \(\bar A_t\) depends on \(t\), the kernel of equation (4) ceases to exist as a fixed filter: an LTV system has no impulse response to convolve with. The model is strictly more expressive, and the FFT-based training path is lost.
Everything Mamba-2 and Mamba-3 contribute computationally can be read as a response to this single fact.
Section 1.3 already supplies the reading of \(\Delta_t\): it is the step size, hence the gate. A large \(\Delta_t\) yields rapid forgetting and strong uptake of \(x_t\) — an open gate; a small \(\Delta_t\) yields near-perfect retention with negligible uptake — a closed gate. Mamba is thus a principled generalisation of LSTM gating, constructed on the HiPPO/SSM foundation, rather than an ad hoc nonlinear recurrence. The figure below isolates the mechanism.
Fig. 6.1 — The gate here is prescribed by hand rather than learned; the figure demonstrates the mechanism, not a benchmark. The LTI trace must pick one timescale for the entire stream: fast enough to absorb a marked token is fast enough to absorb the noise that follows it. The selective trace closes on noise, so a marked value survives an arbitrary gap. The signal-to-noise ratio in the state, reported below the figure, is computed exactly by exploiting linearity: the response to marked tokens and to noise can be separated and measured independently.
Although (7) is no longer a convolution, it remains affine in \(h\), and affine recurrences parallelise. Define, on pairs (transition, increment), the composition
\[ \big((a_3,b_3)\circ(a_2,b_2)\big)\circ(a_1,b_1) = (a_3a_2a_1,\ a_3a_2b_1+a_3b_2+b_3) = (a_3,b_3)\circ\big((a_2,b_2)\circ(a_1,b_1)\big) . \]
Associativity is all that a Blelloch scan requires, so the recurrence can be evaluated in \(O(\log L)\) depth — while still performing \(O(NL)\) total work per channel. The scan purchases parallel depth, not an asymptotic saving; the distinction matters when comparing against the \(O(TN^2)\) matmul form of §7.
Fig. 6.2 — The up-sweep accumulates partial compositions; the down-sweep distributes prefixes back down the tree. Sixteen tokens complete in eight sweep rounds against sixteen sequential steps, and the general ratio is \(2\log_2 L\) to \(L\). One subtlety is worth recording: this monoid is non-commutative, so the down-sweep must compose the incoming prefix before the left-subtree reduction — the order that is immaterial in the familiar sum-scan. The readout verifies the result against the sequential recurrence.
A final component of Mamba-1 is easily misread as an implementation detail. Materialising \(h_t\in\mathbb{R}^{N}\) across batch, channels and time would saturate HBM bandwidth; Mamba therefore fuses the scan into a single kernel that keeps the recurrence in SRAM, writes only \(y_t\) back, and recomputes intermediates in the backward pass — the FlashAttention discipline applied to a scan.
This is an I/O-aware rather than FLOP-aware optimisation, and it should be counted as a genuine co-contribution of the paper. The same style of reasoning returns in §11, where Mamba-3 addresses arithmetic intensity directly.
We now change viewpoint: rather than treating (7) as a process in time, we write the entire input–output map as one matrix. Unrolling and vectorising over \(t\), with \(A^\times_{t:s}:=\prod_{i=s}^{t}A_i\),
Def. 3.1. A lower-triangular \(M\) is \(N\)-semiseparable if
every submatrix contained in the lower-triangular portion (on or below the diagonal) has
rank at most \(N\).
Def. 3.2. \(M\) has an \(N\)-sequentially-semiseparable (SSS)
representation if \(M_{ji}=C_j^\top A_j\cdots A_{i+1}B_i\).
This is not the LSSL notion of §3.2, and the reader consulting both papers should keep the definitions apart. LSSL's \((p,q)\)-quasiseparability bounds submatrices strictly off-diagonal; Mamba-2's \(N\)-semiseparability bounds submatrices on or below the diagonal, in the triangular case only. Mamba-2 Remark 2 acknowledges that some authors would call its object quasiseparable. Conflating the two makes the rank bounds appear inconsistent when they are not.
3.5. The SSM transformation with state size \(N\) coincides with multiplication by an \(N\)-semiseparable matrix in SSS form.
3.6. An \(N\)-SS matrix of size \(T\) is representable in \(O(NT)\) parameters and admits \(O(NT)\) matvec.
3.7. Any state space model of state size \(N\) on length \(T\) can be computed in \(O(TN)\), modulo preprocessing.
Theorem 3.7 says more than it appears to. A dense \(A_t\) requires \(O(TN^2)\) merely to write down, yet the transformation it induces costs \(O(TN)\) — matching the \(\Omega(TN)\) lower bound already imposed by the sizes of \(B\) and \(C\). Structure on \(A\) is therefore required in practice not for the asymptotics but to avoid a preprocessing step involving singular value decompositions.
Now restrict \(A_t = a_tI\), a scalar multiple of the identity. Then \(M_{ji}=A^\times_{j:i}\cdot(C_j^\top B_i)\) factorises, and the map becomes
with \(B,C\in\mathbb{R}^{T\times N}\), \(X\in\mathbb{R}^{T\times D}\). Equation (9) is formally identical to causal linear attention \(Y=(L\circ QK^\top)V\) under the identification \(Q:=C\), \(K:=B\), \(V:=X\) — with the 0/1 causal mask replaced by a data-dependent exponential-decay mask.
This is state space duality (SSD): scalar-decay SSMs and linear attention are one computation viewed from two directions. More precisely, the two are the two contraction orders of a single four-way tensor contraction \(\mathrm{contract}(TN,SN,SP,TS\to TP)(Q,K,V,L)\), yielding the quadratic and the linear algorithm respectively.
For any structured masked attention that is an autoregressive process of bounded order, the mask \(L\) must be semiseparable.
Efficient autoregressive attention is, in this sense, semiseparable masked attention. Linear attention (\(L\) the causal all-ones mask), RetNet (\(L_{ij}=\gamma^{i-j}\)) and SSD (\(L\) a general 1-SS matrix) are three points on one axis rather than three separate architectures.
The practical algorithm partitions \(M\) into a \(\tfrac{T}{Q}\times\tfrac{T}{Q}\) grid of \(Q\times Q\) blocks and treats the two block types differently. Diagonal blocks are self-similar SSM problems, evaluated by the quadratic form (9) — inexpensive for small \(Q\), and pure matrix multiplication. Off-diagonal blocks are low-rank by semiseparability and factor into three stages, each with a clean interpretation:
Fig. 7.3 — The numerical rank of every off-diagonal block is measured and reported as \(N\) varies: it never exceeds \(\min(Q,N)\), which is the entire content of semiseparability and the reason the chunked algorithm exists. The readout also evaluates the recurrence and the chunked matmul form and prints their disagreement, which remains at machine epsilon for every \(Q\) — including the degenerate cases \(Q=1\) (pure recurrence) and \(Q=T\) (pure quadratic form). The chunk size is thus a pure performance parameter, with no effect on the computed values.
For state expansion \(N\) and head dimension \(P=N\): \(O(TN^2)\) training FLOPs, \(O(TN)\) inference FLOPs, \(O(N^2)\) inference memory, with the work dominated by matrix multiplication.
With \(N=P=Q\), every batched matmul takes the shape \(\mathrm{BMM}(T/N,N,N,N)\), and all three bounds are tight. Empirically SSD runs 2–8× faster than Mamba-1's fused selective scan, and faster than FlashAttention-2 beyond sequence length 2K.
import numpy as np
def ssd_chunked(a, B, C, X, Q):
"""Mamba-2 SSD. a:(T,) scalar decays, B,C:(T,N), X:(T,P)."""
T, N = B.shape; P = X.shape[1]
Y = np.zeros((T, P)); H = np.zeros((N, P))
for c in range(T // Q):
s = slice(c * Q, (c + 1) * Q)
ac, Bc, Cc, Xc = a[s], B[s], C[s], X[s]
# cumulative products inside the chunk, computed once
cp = np.cumprod(ac) # a_0..a_t
# diagonal block: the quadratic form. Q x Q, pure matmul.
Lc = np.tril(cp[:, None] / cp[None, :] * ac[None, :])
Y[s] = (Lc * (Cc @ Bc.T)) @ Xc
# off-diagonal contribution: rank <= N, via the carried state
Y[s] += (Cc @ H) * cp[:, None]
# chunk-final state: decay each input to the chunk boundary
tail = cp[-1] / cp
H = cp[-1] * H + (Bc * tail[:, None]).T @ Xc
return Y
# Q=1 recovers the pure recurrence, Q=T the pure quadratic form, and
# every intermediate Q agrees to ~1e-16: Q is a performance knob only.
Three things, not one — and discussions of the paper tend to collapse them into the first:
The common summary — the scalar restriction sacrifices expressivity for speed — is only half of the accounting. Mamba-2 spends the speed on state: the MQAR recall benchmark improves monotonically along \(N{=}16\to64\to256\), and that is the very dimension the restriction made affordable. To evaluate the trade fairly one must weigh the loss in per-step expressivity against the gain in state capacity.
At identical total state size (Mamba-2 Table 5):
| pattern | what is shared | perplexity |
|---|---|---|
| multi-value (Mamba-1's) | \(B,C\) shared; \(X\) per-head | 11.66 |
| multi-key | \(C,X\) shared | 12.59 |
| multi-query | \(B,X\) shared | 12.62 |
Nearly a full point of perplexity separates the head patterns at fixed state budget. We record this because Mamba-3's parameter-matched MIMO construction in §11 relies specifically on the multi-value pattern — sharing \(B\) and \(C\) across heads — having been the winner.
Before Mamba-3's remedies, we must state the disease precisely. Three expressivity results circulate in this literature and are frequently cited interchangeably; they have different hypotheses and different strengths, and two of them are logically independent of one another. We state each with its exact scope.
Parity requires an update of the form \(h_t = R(\pi x_t)h_{t-1}\) for a two-dimensional rotation \(R\). Mamba-2's real scalar decay \(\alpha_t\in(0,1)\) cannot rotate — it can only contract, and no sequence of contractions distinguishes an even from an odd number of sign flips.
Note further that \(R(\pi) = -I\), with both eigenvalues equal to \(-1\): the rotation account and the negative-eigenvalue account are the same account, evaluated at \(\theta=\pi\). This is exactly the deficiency §10 addresses.
Fig. 8.1 — The separability panels evaluate all \(2^{12}\) input sequences and report, for each readout, the best accuracy achievable by any single threshold. The rotation model at \(\theta=\pi\) occupies exactly two points, and its readout is parity at every length. Detuning \(\theta\) away from \(\pi\) causes phase drift and degrades the accuracy — which is why the angle must be learnable, and ultimately input-dependent, rather than fixed. The decay model's readout is monotone in the number of 1-bits and carries no parity information whatsoever.
Yu & Erichson (arXiv:2505.09022) show that a single-layer Mamba is not a universal approximator, and that a block-biased variant recovers the property. This paper is the origin of Mamba-3's learned biases on \(B\) and \(C\) — although, as §11.4 records, Mamba-3's own ablation fails to reproduce their finding for the \(B\)-bias in isolation.
Mamba-3 introduces three independent, composable modifications on top of Mamba-2. The paper's organising argument (§5.4 there) is that none of the three arises naturally from the linear-attention or test-time-regression viewpoints, since those framings possess no discretisation step, assign no meaning to a complex regularisation coefficient, and have no MIMO notion. Whether or not one finds this framing decisive, it organises the material well, and each of the three modifications targets a different one of the three pressures named in the introduction: this section addresses training-time structure, §10 addresses expressivity, and §11 addresses decoding hardware.
We return to first principles. Variation of constants on \([\tau_{t-1},\tau_t]\), with nothing yet approximated, gives
Approximate the state-transition integral by its right endpoint — set \(A(s):=A_t\) on the interval, incurring local error \(O(\Delta_t^2)\) — and deliberately leave the state-input integral open:
Equation (10) is a framework rather than a scheme: distinct treatments of the remaining integral produce distinct schemes, and — usefully — reproduce all the earlier ones as special cases:
| scheme | \(\alpha_t\) | \(\beta_t\) | \(\gamma_t\) |
|---|---|---|---|
| Trapezoidal (LTI) | \((I-\tfrac\Delta2A)^{-1}(I+\tfrac\Delta2A)\) | — | \((I-\tfrac\Delta2A)^{-1}\Delta\) |
| Zero-order hold (LTI) | \(\exp(\Delta A)\) | — | \(A^{-1}(\exp(\Delta A)-I)\) |
| Zero-order hold (LTV) | \(\exp(\Delta_tA_t)\) | — | \(A_t^{-1}(\exp(\Delta_tA_t)-I)\) |
| Exponential-Euler ← Mamba-1/2 | \(\exp(\Delta_tA_t)\) | — | \(\Delta_t\) |
| Exponential-trapezoidal ← Mamba-3 | \(\exp(\Delta_tA_t)\) | \((1-\lambda_t)\Delta_t e^{\Delta_tA_t}\) | \(\lambda_t\Delta_t\) |
Holding the integrand at the right endpoint (exponential-Euler) gives \(h_t = e^{\Delta_tA_t}h_{t-1} + \Delta_tB_tx_t\): precisely the update Mamba-1 and Mamba-2 shipped. At this line, therefore, Mamba-3's contribution is retrospective justification rather than a new formula — and the LTV zero-order hold falls out of the same computation, proving the substitution that Mamba-1 had assumed (§1.2).
The new scheme (Prop. 1) evaluates the integrand at a data-dependent convex combination of the two endpoints:
Setting \(\lambda_t\equiv\tfrac12\) recovers the classical trapezoid rule; \(\lambda_t\equiv1\) recovers exponential-Euler. The scheme is thus a strict generalisation at the cost of one additional scalar per token.
Expanding \(g(\tau):=e^{(t_k-\tau)A_k}B(\tau)x(\tau)\) to second order gives \[ \int_{t_{k-1}}^{t_k}\!\! g - Q_\lambda = \Big(\tfrac12-\lambda_t\Big)\Delta_t^2 g'(t_{k-1}) + \Big(\tfrac16-\tfrac{\lambda_t}{2}\Big)\Delta_t^3 g''(t_{k-1}) + O(\Delta_t^4). \] The \(\Delta_t^2\) term vanishes to leading order only if \(\lambda_t=\tfrac12+O(\Delta_t)\), and this is the standing hypothesis of the \(O(\Delta_t^3)\) claim (Remark 3).
The released model does not enforce this hypothesis. It sets \(\lambda_t=\sigma(u_t)\) for a learned projection \(u_t\), free to lie anywhere in \((0,1)\). Table 8 reports: learned \(15.72\), fixed \(\tfrac12\) \(15.76\), Euler \(15.81\). We conclude that second-order accuracy is the motivation, while the measured gain derives from the additional data-dependent degree of freedom. Both statements are true, and the paper states both.
Equation (11) is a three-term recurrence, and unrolling it changes the SSD mask of §7: in place of the pure decay matrix, one obtains the product of the 1-semiseparable decay with a two-band matrix (Mamba-3 eq. 7):
In other words, exponential-trapezoidal discretisation is a width-2 causal convolution applied to the state-input \(B_tx_t\), folded into the recurrence itself — as distinct from the separate short causal convolution that Mamba-1/2 and most linear-recurrent architectures apply externally to \(x_t\).
Fig. 9.3 — The right-hand panel plots the leading quadrature error terms against \(\lambda\): a zero crossing at \(\lambda=\tfrac12\), the classical trapezoid rule and the source of the \(O(\Delta^3)\) claim. The released model's \(\lambda_t=\sigma(u_t)\) may sit anywhere on this curve, and by Table 8 it prefers to. The readout verifies the factorisation against the direct three-term recurrence at machine epsilon.
Combined with the learned additive biases on \(B,C\) of §11.4, the implicit width-2 convolution renders the external short convolution unnecessary. Table 5a:
The final row carries the weight of the argument: two mechanisms performing the same function are worse than one. This is respectable evidence that reading equation (11) as a convolution is the correct reading and not an algebraic coincidence.
§8 identified the deficiency: a real scalar decay cannot rotate. The natural repair is to complexify. Per pair of state dimensions, consider the complex SSM
with \(h(t)\in\mathbb{C}^{N/2}\) and — the hypothesis that will carry the entire section — \(A(t)\in\mathbb{R}\) scalar.
Under exponential-Euler discretisation this equals the real system \(h_t = e^{\Delta_tA_t}R_th_{t-1} + \Delta_tB_tx_t\), \(y_t=C_t^\top h_t\), with \(h_t\in\mathbb{R}^{N}\), \(B_t=\binom{B_t}{\hat B_t}\), \(C_t=\binom{C_t}{-\hat C_t}\), and \(R_t=\mathrm{Block}\{R(\Delta_t\theta_t[i])\}_{i=1}^{N/2}\).
The proof is a single application of Euler's formula: \(e^{\Delta(A+i\theta)} = e^{\Delta A}(\cos\Delta\theta + i\sin\Delta\theta)\), and multiplication by a unit complex number is a \(2\times2\) rotation in real coordinates. The state dimension doubles (\(N/2\to N\)) but remains real and hardware-friendly. Note the sign reversal on \(\hat C\): it arises from taking the real part of a complex inner product, and is easily lost in implementation.
The unrolled recurrence is identical to a plain scalar-transition SSM with a data-dependent rotary embedding applied to \(B\) and \(C\): \[ h_t = e^{\Delta_tA_t}h_{t-1} + \Big(\textstyle\prod_{i=0}^{t}R_i^\top\Big)\Delta_tB_tx_t, \qquad y_t = \Big[\Big(\textstyle\prod_{i=0}^{t}R_i^\top\Big)C_t\Big]^\top h_t . \]
Unrolling gives \(y_t = \sum_i C_t^\top\big(\prod_{s=i+1}^{t}e^{\Delta_sA_s}R_s\big)\Delta_iB_ix_i\). The rotations are orthogonal and commute among themselves, so the partial product telescopes: \(\prod_{s=i+1}^{t}R_s = (\prod_{s=0}^{t}R_s)(\prod_{s=0}^{i}R_s^\top)\). And because the scalars \(e^{\Delta_sA_s}\) commute with the rotations, they may be extracted, and the two rotation products absorbed into \(C_t\) and \(B_i\) separately.
Both commutations are essential, and the second requires \(A_t\) scalar: with a genuinely diagonal \(A_t\), the decay and rotation factors no longer commute and the identity is false. The toggle in Fig. 10.1 performs exactly this substitution; the measured disagreement rises from \(10^{-15}\) to order \(10^{-1}\).
The resulting object is exactly RoPE (Su et al., arXiv:2104.09864) — with two differences. Vanilla RoPE fixes a geometric frequency schedule \(\theta[i]=10000^{-2i/N}\), applied identically at every layer; Mamba-3's \(\theta_t\) is learned and input-dependent, and it is applied inside the recurrence, to \(B\) and \(C\) — the SSD analogues of \(K\) and \(Q\). The efficient pairwise cosine/sine implementation carries over unchanged, so state tracking is obtained at negligible cost. Prop. 4 extends the identity to the trapezoidal recurrence of §9, with \(\prod_{i=0}^{t-1}R_i^\top\) applied to the \(\beta\) term.
Fig. 10.1 — Left: the state under repeated multiplication by \(e^{\Delta(A+i\theta)}\), a logarithmic spiral combining decay and rotation; at \(\theta=0\) it degenerates to the ray that Mamba-2 was restricted to. Right: the two computational forms of Prop. 3, with their maximum disagreement reported. The toggle replaces the scalar decay by a genuinely diagonal one and thereby falsifies the identity — demonstrating that the scalar restriction on \(A_t\) is not stylistic but is what makes the inexpensive algorithm exist.
Mamba-3 Table 5b, scaled accuracy in per cent:
| model | parity | mod. arith. (no brackets) | mod. arith. (brackets) |
|---|---|---|---|
| Mamba-3 | 100.00 | 98.51 | 87.75 |
| Mamba-3 (standard RoPE) | 1.56 | 20.70 | 2.62 |
| Mamba-3 (no RoPE) | 2.27 | 1.49 | 0.72 |
| Mamba-2 | 0.90 | 47.81 | 0.88 |
| Gated DeltaNet \([-1,1]\) | 100.00 | 99.25 | 93.50 |
Standard RoPE does not help: 1.56% on parity, barely above the no-RoPE baseline. The active ingredient is the data dependence of the rotation, not the rotation as such — exactly as the intuition of §8 predicts, since a fixed frequency schedule cannot make the rotation depend on the bit being processed.
The final row also deserves attention: a Gated DeltaNet with eigenvalue range \([-1,1]\) already solves these tasks, and handles the bracketed case better. This is consistent with Grazzi et al.: negative real eigenvalues suffice for parity, with complex eigenvalues required for richer cyclic structure. Mamba-3's complexification is one route to this capability, not the only one.
S5 and the LRU adopted MIMO for training simplicity, at reduced state capacity. Mamba-3 adopts it for a different reason entirely — decoding hardware efficiency — and this section is best read as a roofline analysis with an architectural conclusion.
A SISO update \(h_t\leftarrow \alpha_th_{t-1}+\Delta_tB_tx_t^\top\), broadcast over head dimension \(P\), is an outer product: \(O(NP)\) floating-point operations moving \(O(NP)\) bytes. Mamba-3 Table 2a computes the arithmetic intensity exactly:
to be compared with roughly 295 ops/byte at the ridge of an H100-SXM5 in bf16. Decoding is thus deeply memory-bound, and the tensor cores idle. The decisive observation is that no existing Mamba hyperparameter remedies this: expression (12) tends to \(\tfrac52\) as \(N,P\to\infty\), so enlarging the state does not move the operating point.
The remedy is to promote the outer product to a genuine matrix product, by granting \(B_t,x_t,C_t\) an additional rank-\(R\) dimension: \(B_t\in\mathbb{R}^{N\times R}\), \(x_t\in\mathbb{R}^{P\times R}\), and
The state \(H_t\) — and with it the memory traffic — is unchanged; the floating-point work grows by the factor \(R\). The intensity therefore becomes \(\Theta(\min(N,P,R))=\Theta(R)\) for \(R\ll N,P\): idle compute is converted into useful work at nearly unchanged decode latency.
Fig. 11.2 — Sweep \(N\) and \(P\) across their full ranges and observe that the SISO point does not move horizontally: this is the content of \(\Theta(1)\), and the reason the update rule — rather than any size — had to change. Only \(R\) moves the point rightward. Note that even at \(R=64\) the operating point remains far left of the ridge: MIMO does not make decoding compute-bound; it reduces the fraction of the machine that stands idle.
Four times the arithmetic for a 15% latency increase over Mamba-3's own SISO variant, while remaining faster than Mamba-2. This measurement is the point of the entire section.
For training, a rank-\(R\) MIMO SSM decomposes into \(R^2\) SISO SSMs — \(R\) inputs sharing each recurrence, summed for each of \(R\) outputs — so every SISO algorithm developed above (SSD chunking, trapezoidal discretisation, the RoPE identity) applies as a black box. Naively this costs \(R^2\) times the FLOPs.
The recovery is a chunk-size adjustment: shrinking the chunk by the factor \(1/R\) (\(C_{\text{MIMO}}=C_{\text{SISO}}/R\)) keeps the intra-chunk cost fixed while multiplying the chunk count by \(R\), for a total of \(8TRN^2\) — an \(R\)-fold rather than \(R^2\)-fold increase. Measured MIMO training kernels run approximately 2× slower at \(R{=}4\).
A naive rank-\(R\) lift would multiply all of the \(B,C,X,z,y\) projections by \(R\). Mamba-3 avoids this by exploiting the multi-value head structure — \(B,C\) shared across heads — so that those projections cost only \(DN\to DNR\) for the entire layer; for the per-head \(x,y,z\) it retains the SISO projection and applies a learnable, data-independent elementwise scaling to rank \(R\): \(DP\to DP+PR\) per head.
The growth is additive, not multiplicative — and it is available only because the head pattern that Mamba-2's ablation selected is the one that shares \(B\) and \(C\).
At the 1.5B scale on 100B FineWeb-Edu tokens: Mamba-3 SISO exceeds Gated DeltaNet by \(+0.6\) average downstream points, and MIMO (\(R{=}4\)) by a further \(+1.2\). Mamba-3 (MIMO) at state size 64 matches Mamba-2 at state size 128.
Let us assemble the pieces. The introduction promised that every design decision in this lineage trades among three requirements — memory, trainability, and decoding cost. It is worth verifying that promise against the record:
| step | the binding constraint | the response | what it cost |
|---|---|---|---|
| HiPPO | what should the state contain? | optimal polynomial projection; \(A\) from a derivation, not a search | — |
| LSSL | compute \(\mathcal{K}_L\) in \(\tilde O(N{+}L)\) | quasiseparable divide-and-conquer | numerically unusable — conditioning, not FLOPs |
| S4 | the same, stably | NPLR + Woodbury + Cauchy | considerable machinery |
| S4D / S5 | most of that machinery unnecessary | diagonal \(A\); scan | the exact HiPPO interpretation |
| Mamba | content-independent memory | \(\Delta_t,B_t,C_t\) from the input | the convolutional view |
| Mamba-2 | the scan is not matmul-shaped | scalar \(A_t\); SSD chunking | rotation — hence parity (§8) |
| Mamba-3 | first-order discretisation | exponential-trapezoidal (11) | one scalar per token |
| no state tracking | complex pairs = data-dependent RoPE | doubled pair dimension, one rotation | |
| decode intensity \(\Theta(1)\) | MIMO rank \(R\) | \(R\times\) training FLOPs |
Three sentences suffice for the argument of these notes. A linear system is two algorithms, and the field has alternated between them as the binding constraint moved. Selectivity destroyed the convolutional algorithm, and the semiseparable-matrix view rebuilt an equivalent one out of matrix multiplication. What a scalar recurrence then still could not represent — phase — was restored by complexification, at the cost of one rotation per step, because the rotation happens to commute with everything it must commute with.
Honesty about open edges, in declining order of importance as we judge them:
For the reader proceeding to the sources: HiPPO for the projection framework (its appendices repay the effort); S4 App. B–C for the linear algebra of §4; Mamba-2 §3–§6 for semiseparability and SSD, which we regard as the conceptual centre of the lineage; Mamba-3 for the three refinements of §9–§11. LSSL is best read last, as a study in how a correct theorem fails in floating point — the lesson the rest of the field then spent four years applying.
These notes were checked against the literature as of July 2026. The state-tracking results of §8 continue to develop (see e.g. arXiv:2605.07755 on the expressivity of input-dependent rotations); statements about "current" models should be read with that date attached.
| # | work | arXiv |
|---|---|---|
| 1 | Gu, Dao — Mamba: Linear-Time Sequence Modeling with Selective State Spaces | 2312.00752 |
| 2 | Dao, Gu — Transformers are SSMs (Mamba-2 / SSD) | 2405.21060 |
| 3 | NVIDIA et al. — Mamba-3: Improved Sequence Modeling using State Space Principles (ICLR 2026) | 2603.15569 |
| 4 | Gu, Dao, Ermon, Rudra, Ré — HiPPO: Recurrent Memory with Optimal Polynomial Projections | 2008.07669 |
| 5 | Gu, Johnson, Goel, Saab, Dao, Rudra, Ré — Combining Recurrent, Convolutional, and Continuous-time Models (LSSL) | 2110.13985 |
| 6 | Gu, Goel, Ré — Efficiently Modeling Long Sequences with Structured State Spaces (S4) | 2111.00396 |
| 7 | Gupta, Gu, Berant — Diagonal State Spaces (DSS) | 2203.14343 |
| 8 | Gu, Goel, Gupta, Ré — On the Parameterization and Initialization of Diagonal State Space Models (S4D) | 2206.11893 |
| 9 | Smith, Warrington, Linderman — Simplified State Space Layers (S5) | 2208.04933 |
| 10 | Orvieto et al. — Resurrecting Recurrent Neural Networks (LRU) | 2303.06349 |
| 11 | Goel, Gu, Donahue, Ré — It's Raw! Audio Generation with State-Space Models (SaShiMi) | 2202.09729 |
| 12 | Merrill, Petty, Sabharwal — The Illusion of State in State-Space Models | 2404.08819 |
| 13 | Sarrof, Veitsman, Hahn — The Expressive Capacity of State Space Models: A Formal Language Perspective | 2405.17394 |
| 14 | Grazzi, Siems, Franke, Zela, Hutter, Pontil — Unlocking State-Tracking in Linear RNNs Through Negative Eigenvalues | 2411.12537 |
| 15 | Yu, Erichson — Block-Biased Mamba (universal approximation) | 2505.09022 |
| 16 | Su, Lu, Pan, Murtadha, Wen, Liu — RoFormer: Enhanced Transformer with Rotary Position Embedding | 2104.09864 |
| 17 | Pan — Fast Approximate Computations with Cauchy Matrices and Polynomials | 1506.02285 |
| 18 | Katharopoulos, Vyas, Pappas, Fleuret — Transformers are RNNs (Linear Attention) | 2006.16236 |
| 19 | Sun et al. — Retentive Network (RetNet) | 2307.08621 |
| 20 | Yang, Wang, Shen, Panda, Kim — Gated Linear Attention Transformers | 2312.06635 |
| 21 | Yang, Kautz, Hatamizadeh — Gated Delta Networks | 2412.06464 |
| 22 | Dao et al. — FlashAttention-2 | 2307.08691 |
| 23 | Voelker, Kajić, Eliasmith — Legendre Memory Units (NeurIPS 2019) | LMU |
| 24 | Blelloch — Prefix Sums and Their Applications (CMU tech report) | Ble93 |
| 25 | Eidelman, Gohberg — On a new class of structured matrices (quasiseparability) | 1999 |
| 26 | Trefethen, Embree — Spectra and Pseudospectra (non-normality background) | 2005 |
| 27 | Williams — Roofline: An Insightful Visual Performance Model | CACM 2009 |
| 28 | Higham — Accuracy and Stability of Numerical Algorithms (conditioning background) | 2002 |
| 29 | Arora et al. — Zoology: Measuring and Improving Recall in Efficient Language Models (MQAR) | 2312.04927 |
| 30 | Siems et al. — On the Expressivity of Input-Dependent Rotations in Linear RNNs | 2605.07755 |
| 31 | Gu — On the Tradeoffs of SSMs and Transformers (blog, 2025) | goombalab |
Written and verified July 2026 · every figure computes live in this page · corrections welcome — l@muehrke.de
Everything here is doable with pen and paper or a pocket calculator; four exercises want a script, all under twenty lines. ★ marks the one exercise per part to do if you do only one — in each case because it forces a realisation that reading cannot. [hand] is pen and paper, [calc] a pocket calculator, [code] under twenty lines of NumPy, [argue] open-ended — there is no single correct answer, only a better or worse one. Every answer is checkable against a computation you can run or a statement proved above.
Let \(V\) be invertible. Show that \((A,B,C)\) and \((V^{-1}AV,\,V^{-1}B,\,CV)\) have the same impulse response \(h(t)=Ce^{At}B\), hence define the same operator \(u\mapsto y\). Two lines. Everything S4 does in §4 is licensed by this identity; note where you used invertibility and nothing else.
\(\tilde Ce^{\tilde At}\tilde B=CVV^{-1}e^{At}VV^{-1}B=Ce^{At}B\), using \(e^{V^{-1}AV}=V^{-1}e^AV\) (true termwise in the series). Only invertibility is used — which is why S4 may pick any well-conditioned \(V\), and why the whole question in §4.1 becomes "which \(V\) is numerically admissible."
Take \(N=1\), \(A=-1\), \(B=C=1\), \(D=0\), and discretise bilinearly with \(\Delta=1\). Compute \(\bar A\) and \(\bar B\). Write out \(\mathcal K_4\). Now compute \(y_3\) for the input \(u=(1,1,1,1)\) twice: once by running the recurrence, once by convolving with \(\mathcal K_4\). They must agree exactly — not approximately.
\(\bar A=(1-\tfrac12)/(1+\tfrac12)=1/3\), \(\bar B=1/(1+\tfrac12)=2/3\). \(\mathcal K_4=\tfrac23(1,\tfrac13,\tfrac19,\tfrac1{27})\). Recurrence: \(x=\tfrac23,\tfrac89,\tfrac{26}{27},\tfrac{80}{81}\); so \(y_3=80/81\). Convolution: \(\tfrac23(1+\tfrac13+\tfrac19+\tfrac1{27})=\tfrac23\cdot\tfrac{40}{27}=\tfrac{80}{81}\). Exact.
The triple \((A,B,C)\) carries \(N^2+2N\) parameters, while the transfer function \(H(s)=C(sI-A)^{-1}B\) is a strictly proper rational function of degree \(N\), determined by \(2N\) coefficients. How many parameters are therefore unidentifiable? Match your count against \(\dim\mathrm{GL}(N)\) and against Exercise 0.1. What does this predict about the freedom to choose a convenient form for \(A\) — and hence about §5?
\(N^2+2N-2N=N^2\) unidentifiable parameters, exactly \(\dim\mathrm{GL}(N)\) — the orbit of the conjugation action of 0.1. Consequence: a canonical form costs nothing in expressivity, which is the entire licence for §5's diagonal restriction.
For the scalar system \(\dot x=ax\) with \(a<0\) real, write \(\bar A\) under forward Euler, backward Euler, bilinear, and ZOH. For each, determine the set of step sizes \(\Delta>0\) with \(|\bar A|<1\). Confirm that forward Euler requires \(\Delta<2/|a|\) and that the other three impose no condition. This is Fig. 1.2, done analytically.
Forward \(1+\Delta a\) (needs \(\Delta<2/|a|\)); backward \(1/(1-\Delta a)\); bilinear \((1+\Delta a/2)/(1-\Delta a/2)\); ZOH \(e^{\Delta a}\). The last three have modulus \(<1\) for all \(\Delta>0\) when \(a<0\).
Now let \(a\in\mathbb C\). Show that the bilinear transform satisfies \(|\bar A|<1\iff\mathrm{Re}(a)<0\), exactly. Hint: compute \(|1+\Delta a/2|^2-|1-\Delta a/2|^2\).
\(|1+\Delta a/2|^2-|1-\Delta a/2|^2=2\Delta\,\mathrm{Re}(a)\), negative iff \(\mathrm{Re}(a)<0\). The bilinear map is the Cayley transform: it carries the open left half-plane onto the open unit disc bijectively.
Two schemes, two gates. You have derived that backward Euler on \(\dot x=-x+u\) with \(\Delta=e^z\) gives the gate \(\sigma(z)\). Now derive the gate produced by ZOH on the same ODE with the same \(\Delta\). You should obtain \(x_k=e^{-\Delta}x_{k-1}+(1-e^{-\Delta})u_k\), i.e. gate \(1-\exp(-e^z)\). Both are convex combinations; both saturate at 0 and 1. Tabulate the two at \(z=-3,-1,0,1,3\) and identify where they differ most. Which one is the LSTM's, and what does that tell you about how much of "gating" is forced and how much is a choice of quadrature?
ZOH gives \(\bar A=e^{-\Delta}\), \(\bar B=1-e^{-\Delta}\); gate \(1-\exp(-e^z)\). At \(z=-3,-1,0,1,3\): sigmoid \(0.047,0.269,0.500,0.731,0.953\); ZOH gate \(0.049,0.307,0.632,0.934,1.000\). The ZOH gate saturates far faster and is not symmetric about \(z=0\). The LSTM's is the sigmoid, i.e. backward Euler. So the saturating shape is forced by the ODE, but the specific curve is a choice of quadrature — gating is less canonical than it alone suggests.
With \(\bar A=e^{\Delta A}\) and \(A=-1\), how many tokens pass before the state decays to half its value? Evaluate for \(\Delta=0.01,0.1,1\). This number is what "\(\Delta\) is a timescale" means operationally.
\(\ln2/\Delta\) tokens: \(69.3\), \(6.93\), \(0.69\).
Write out \(A\) and \(B\) for HiPPO-LegS at \(N=3\) from the closed form. Verify \(A=DMD^{-1}\) by direct multiplication, and read off \(\mathrm{spec}(A)=\{1,2,3\}\) without computing a characteristic polynomial. Why is the spectrum immediate?
\(A=\begin{pmatrix}1&0&0\\\sqrt3&2&0\\\sqrt5&\sqrt{15}&3\end{pmatrix}\), \(B=(1,\sqrt3,\sqrt5)^\top\). Triangular, so the spectrum is the diagonal, and diagonal similarity \(DMD^{-1}\) preserves it.
The state really is the coefficient vector. Feed the constant input \(u\equiv1\). At steady state \(\dot x=0\), so \(Ax=B\). Solve this by hand at \(N=3\) — it is triangular, so it takes three lines — and observe that \(x=e_0=(1,0,0)^\top\). Now explain why this was forced: expand the constant function 1 in the normalised Legendre basis \(p_n=(2n+1)^{1/2}P_n(2Y/t-1)\) and compute the coefficients directly, using \(\int_{-1}^1P_n=2\delta_{n0}\). The two calculations agree because the ODE was derived from the projection — but seeing them meet is the moment HiPPO stops being a matrix and becomes a compression scheme. Verify the identity \(Ax=B\) holds at every \(N\), in one line, from the closed form.
\(Ax=B\) with \(x=e_0\): row \(n>0\) reads \(A_{n0}=\sqrt{2n+1}\cdot\sqrt1=\sqrt{2n+1}=B_n\); row 0 reads \(A_{00}=1=B_0\). True at every \(N\), in one line, with no inversion. From the projection side, \(c_n=(2n+1)^{1/2}\tfrac12\int_{-1}^1P_n=\delta_{n0}\). The state of a constant signal is the constant's zeroth Legendre coefficient and nothing else — the state is a compression, not an arbitrary feature vector.
Take \(u(t)=\sin(3t)+\tfrac12\sin(11t)\) on \([0,1]\), run the LegS recurrence, and reconstruct \(u\) from the \(N\) coefficients via \(\sum_nx_np_n\). Plot the \(L^2\) error against \(N\in\{4,\dots,64\}\) on log axes and estimate the exponent. Compare with the \(O(N^{-1/2})\) of Prop. 6 for Lipschitz inputs, and explain the discrepancy you find.
You will measure a rate far steeper than \(N^{-1/2}\), because the input is analytic, not merely Lipschitz; Prop. 6's second clause with large \(k\) is the relevant bound. The exercise is intended to make you notice that the advertised rate is worst-case.
Where the algorithm actually dies. Figure 3.2 compares the intermediate \(\binom{2(N-1)}{N-1}\) against the float64 overflow ceiling \(1.8\times10^{308}\), and reports that overflow arrives near \(N=516\). But these quantities are added to numbers of order one. Compute \(\binom{2(N-1)}{N-1}\) for \(N=16,24,29,30,64\) and compare instead against \(2^{53}\approx9.0\times10^{15}\), the point at which a double can no longer resolve a unit increment. At what \(N\) is all relative precision destroyed? Compare with 516 and state which number describes the failure.
\(\binom{2(N-1)}{N-1}\) equals \(1.55\times10^8\) (N=16), \(8.23\times10^{12}\) (N=24), \(7.65\times10^{15}\) (N=29), \(3.01\times10^{16}\) (N=30), \(6.04\times10^{36}\) (N=64). It crosses \(2^{53}\) between \(N=29\) and \(N=30\). So all relative precision is gone by \(N\approx30\) — while overflow waits until \(N\approx516\). The honest statement is that the algorithm is unusable at the state sizes S4 actually ships, and it fails silently.
Write the \(5\times5\) integer matrix \(M\) of §2.3. Compute the rank of every submatrix lying strictly below the diagonal. (There are few enough to do by inspection — look at the rows.) What is the maximum? Now, before reading §4: predict the rank \(r\) of the low-rank correction in S4's normal-plus-low-rank decomposition of this matrix, and say why.
Every strictly-lower entry is \(M_{nk}=2k+1\), independent of \(n\): all rows of any strictly-lower submatrix are identical, so the rank is exactly 1. Predicted \(r=1\) — which is what S4 Theorem 1 states for LegS. The quasiseparable structure of §3 and the low-rank correction of §4 are the same fact seen twice.
Exercise 1.1 showed every scheme drives \(\bar A\to I\) as \(\Delta\to0\). Explain why this innocuous limit is the worst case for LSSL's algorithm rather than the most benign one. What is the characteristic polynomial of \(I\), and what is special about its coefficients among all degree-\(N\) polynomials with roots in the unit disc?
\(p(x)=\det(I-xI)=(1-x)^N\), whose coefficients \(\binom Nk\) are the largest attainable for a degree-\(N\) polynomial with all roots at a single point. Maximal root multiplicity is the worst conditioning for polynomial root-finding, and discretisation drives the system toward it.
The truncation factor is not cosmetic. Take \(N=1\), \(\bar A=a=0.5\), \(L=4\). Compute \(\sum_{i=0}^3(az)^i\) directly at the four fourth roots of unity \(z\in\{1,i,-1,-i\}\). Compute \((1-a^4z^4)/(1-az)\) at the same points and confirm agreement. Now compute \(1/(1-az)\) — the untruncated resolvent — at those points and report the relative error. Repeat mentally for \(a=0.99\): does dropping the factor get better or worse as the system becomes more retentive, and why is that exactly the regime one cares about?
At \(z^4=1\): \(\sum_{i<4}(az)^i\) and \((1-a^4z^4)/(1-az)\) agree since \(z^4=1\) makes the numerator \(1-a^4\). At \(z=1\), \(a=0.5\): both give \(1.875\); the untruncated \(1/(1-a)=2\), a relative error of \(6.7\%\). At \(a=0.99\): truncated \(\approx3.94\), untruncated \(100\) — error \(96\%\). Dropping the factor gets catastrophically worse as \(a\to1\), i.e. exactly in the long-memory regime the whole model exists to reach.
Let \(\Lambda=\mathrm{diag}(\lambda_1,\lambda_2)\), \(P=Q=(1,1)^\top\), and \(\omega\in\mathbb C\). Compute \((\Lambda-PQ^\top-\omega I)^{-1}\) twice: once by the \(2\times2\) cofactor formula, once by Woodbury. Confirm they agree, and identify which quantity in the Woodbury form is the scalar that makes \(r=1\) cheap.
Woodbury with \(U=-P\), \(V=Q\): the scalar is \(1+Q^\top(\Lambda-\omega I)^{-1}P=1+\sum_j\frac1{\lambda_j-\omega}\). For \(r=1\) the inverse of a \(1\times1\) matrix is a reciprocal, which is why \(r=1\) costs essentially nothing.
With \(\Delta=1\), evaluate the node map \(\omega(z)=2\frac{1-z}{1+z}\) at \(z=1,i,-i\). Confirm each result is purely imaginary. Then consider \(z=-1\), which is a fourth root of unity: \(\omega\) has a pole there, and the prefactor \(\frac2{1+z}\) in \(\hat K(z)\) blows up. Yet \(\hat K_L(z)=\sum_{i<L}\bar C\bar A^i\bar Bz^i\) is a polynomial and therefore finite at \(z=-1\). Resolve the apparent contradiction. What does this say about where the singularity must cancel?
\(\omega(1)=0\), \(\omega(i)=-2i\), \(\omega(-i)=2i\): all purely imaginary. At \(z=-1\) the prefactor \(\frac2{1+z}\) diverges, but the bracket contains a compensating zero, since \(\bar C^*(I-\bar Az)^{-1}\bar B\) is evaluated at \(\bar Az\) approaching a point where the resolvent stays bounded. The product is the polynomial \(\hat K_L\), finite everywhere; the singularity is an artefact of the factorisation, not of the object. In practice one never evaluates at \(z=-1\) with this form.
Build \(-A\) for LegS at \(N=8\), add the rank-one matrix with entries \(\tfrac12(2n+1)^{1/2}(2k+1)^{1/2}\), and verify numerically that the result is \(-\tfrac12I+S\) with \(S^\top=-S\). Print the eigenvalues and confirm every real part is \(-\tfrac12\). You have just executed S4's Theorem 1 for the only matrix that matters.
All eigenvalues have real part exactly \(-\tfrac12\), to machine precision, at every \(N\).
At \(N=64\): how many real parameters in a dense \(A\)? In a diagonal complex \(\Lambda\)? Now combine with Exercise 0.3 — of the dense count, how many were ever identifiable from the input–output map? Does the diagonal restriction discard identifiable degrees of freedom, or only redundant ones? State precisely what is lost, given that the answer to the previous question is "only redundant ones."
Dense: 4096. Diagonal complex: 128. But by 0.3 only \(2N=128\) were ever identifiable — the same count. The diagonal restriction discards only redundancy. What is lost is not expressivity but the HiPPO interpretation: a specific \(\Lambda\) no longer corresponds to a specific measure and basis, so the initialisation must be transplanted rather than derived.
Mamba-2's Theorem 3.7 says any SSM of state size \(N\) on length \(T\) is computable in \(O(TN)\), dense \(A_t\) included. If the asymptotics do not require structure, articulate what structure on \(A\) actually buys. Give two distinct answers, one about preprocessing and one about the shape of the arithmetic.
(i) Reaching \(O(TN)\) for a dense \(A_t\) requires a preprocessing step involving SVDs — expensive and hardware-hostile. (ii) The asymptotics say nothing about shape: a scan and a matmul with equal FLOP counts differ by an order of magnitude in achieved throughput, because only one uses tensor cores. Structure buys the constant, and the constant is the entire subject of §7.
Verify that \((a_2,b_2)\circ(a_1,b_1)=(a_2a_1,\,a_2b_1+b_2)\) is associative (one line), then exhibit a pair showing it is not commutative. Explain in one sentence why the Blelloch down-sweep must therefore compose the incoming prefix on a specific side, and what would break if you used the sum-scan's ordering.
Take \((2,1)\) and \((3,0)\): one order gives \((6,3)\), the other \((6,1)\). Non-commutative, so the down-sweep must apply the incoming prefix on the left of the left-subtree reduction; the sum-scan's ordering silently swaps the two and produces wrong increments while leaving the transitions correct — a bug that survives casual testing.
What one timescale cannot do. Let \(A=-1\) and use \(\bar A_t=e^{-\Delta_t}\), \(\bar B_t=\Delta_t\). A "marked" token arrives, followed by 20 tokens of noise. Compute the fraction of the marked token's contribution still present in the state after those 20 steps, in three regimes:
(a) selective: \(\Delta=3\) on the marked token, \(\Delta=0.01\) on the noise;
(b) LTI fast: \(\Delta=3\) throughout;
(c) LTI slow: \(\Delta=0.01\) throughout.
For each, also compute how much of a single noise token is absorbed. Tabulate retention against noise-uptake for the three, and state the trade that (a) escapes and (b) and (c) cannot.
Retention over the 20 noise steps is the product of the per-step decays \(\prod e^{-\Delta}\): (a) \(e^{-0.2}=0.819\), (b) \(e^{-60}\approx10^{-26}\), (c) \(e^{-0.2}=0.819\). Noise uptake per token is \(\bar B=\Delta\): (a) \(0.01\), (b) \(3\), (c) \(0.01\). So (b) absorbs the mark strongly but forgets it immediately; (c) retains but never absorbs anything strongly, mark included — its uptake on the marked token is also \(0.01\). Only (a) achieves high uptake on the mark and high retention through the noise, because the two are controlled by the same knob at different times. One \(\Delta\) cannot be both.
Show concretely that an LTV system has no impulse response. Write \(y_2\) for a three-step recurrence with distinct \(\bar A_0,\bar A_1,\bar A_2\), and exhibit the coefficient of \(u_0\) in \(y_2\) and of \(u_1\) in \(y_3\). Both have \(k-i=2\). Are they equal? What would have to hold for a fixed filter to exist?
Coefficient of \(u_0\) in \(y_2\) is \(C\bar A_2\bar A_1\bar B_0\); of \(u_1\) in \(y_3\) is \(C\bar A_3\bar A_2\bar B_1\). Equal only if the \(\bar A\)'s coincide. A fixed filter requires the coefficient to depend on \(k-i\) alone, i.e. time invariance — which selectivity removes by construction.
At \(T=4\), \(N=1\), with scalars \(a_t,B_t,C_t\), write the \(4\times4\) matrix \(M\) entry by entry, and confirm \(M_{ji}=C_j\big(\prod_{i+1\le s\le j}a_s\big)B_i\). Check the diagonal separately: what is the empty product, and what goes wrong if you write \(\prod_{i\le s\le j}\) instead?
\(M_{jj}=C_jB_j\): the empty product is 1. Writing \(\prod_{i\le s\le j}\) gives \(M_{jj}=C_ja_jB_j\), an extra decay on the diagonal — precisely the off-by-one in the §7.3 listing, and the reason it disagrees with the recurrence by \(O(1)\) rather than by \(O(\varepsilon)\).
Semiseparability, derived rather than quoted. Take \(a_t\equiv a\) constant, so \(L_{ts}=a^{t-s}\) for \(t\ge s\). Show that any submatrix of \(L\) lying strictly below the diagonal is an outer product of \((a^t)\) with \((a^{-s})\), hence has rank exactly 1. Now restore \(B,C\in\mathbb R^{T\times N}\) and consider \(M=L\circ CB^\top\). Show that any block \(M_{j:j',\,i':i}\) with \(i\le j\) has rank at most \(N\), by writing it as a product of a \((\cdot\times N)\) and an \((N\times\cdot)\) factor. You have proved Definition 3.1 for this case, and the factorisation you wrote is precisely the one the chunked algorithm exploits.
\(L_{ts}=a^{t-s}=a^t\cdot a^{-s}\), an outer product of two vectors: rank 1. For general \(M\), the block factors as \(\big(C_jA^\times_{j:j_0}\big)_j\cdot \big(A^\times_{i_0:i}B_i\big)_i^\top\) with inner dimension \(N\). Rank \(\le N\) is then immediate, and the two factors are exactly the left and right factors of the chunked algorithm.
Implement the chunked SSD in ten lines and check it against a plain recurrence for \(Q=1,2,4,8,T\). All must agree to \(\sim10^{-15}\). Note: the listing in §7.3 of the notes contains an off-by-one in the intra-chunk mask; deriving the correct mask from Exercise 7.1 and finding the discrepancy is part of the exercise.
Once the mask is corrected using 7.1 — the diagonal entry must carry the empty product, i.e. plain \(C_jB_j\), not \(C_ja_jB_j\) — the chunked and recurrent computations agree to machine precision (\(\sim10^{-15}\)) for every \(Q\) tested, including \(Q=T\) (a single full chunk), which collapses the chunked path onto the dense recurrence exactly.
The uncorrected listing's error is not the \(O(\varepsilon)\) rounding you'd expect from a numerically distinct but correct implementation: it is an \(O(1)\) relative error concentrated on the diagonal terms, exactly as quantified in 7.1's answer. That signature — wrong by a fixed factor rather than by noise — is how you tell a masking bug from a numerical one in any semiseparable implementation.
At \(T=1024\) and \(N=P=Q=64\), evaluate: intra-chunk \(2TC(N+P)\), inter-chunk \(4TNP\), total. Compare with quadratic attention \(T^2N\) and with the pure recurrence \(TN^2\). Confirm the total is \(8TN^2\) and identify the \(T\) at which SSD overtakes attention.
Intra \(2\cdot1024\cdot64\cdot128=1.68\times10^7\); inter \(4\cdot1024\cdot64\cdot64=1.68\times10^7\); total \(3.36\times10^7=8TN^2\). Attention \(T^2N=6.7\times10^7\); recurrence \(TN^2=4.2\times10^6\) FLOPs but without matmul shape. SSD overtakes attention in FLOPs at \(T=8N=512\).
An impossibility proof you can write out. Consider \(h_t=\alpha h_{t-1}+x_t\) with \(\alpha\in(0,1)\) real and \(x_t\in\{0,1\}\), read out by any threshold on \(h_T\). Write \(h_T\) as a sum. Show that \(h_T\) is strictly increasing in each \(x_t\) separately. Conclude that no threshold readout computes parity, and name the property of parity that does the work. Note that this argument uses no circuit complexity, no precision assumption, and no conjecture — which is exactly why it is a different result from Merrill et al.
\(h_T=\sum_t\alpha^{T-t}x_t\) with all coefficients strictly positive, so \(h_T\) is strictly increasing in each \(x_t\): flipping any bit from 0 to 1 increases \(h_T\). Parity is not monotone — flipping a bit alternately increases and decreases the target — so no threshold can realise it. Unconditional, precision-free, conjecture-free.
Verify \(R(\pi)=-I\) and confirm both eigenvalues are \(-1\). Then run \(h_t=R(\pi x_t)h_{t-1}\) from \(h_0=(1,0)^\top\) over \(x=(1,0,1,1)\) by hand, and read parity off the first coordinate. Explain in one sentence why the rotation account and the negative-eigenvalue account of §8 are the same account.
\(R(\pi)=\begin{pmatrix}-1&0\\0&-1\end{pmatrix}\); \(h_4=(-1)^3(1,0)^\top=(-1,0)^\top\), and \(\sum x=3\) is odd. The two accounts coincide because a rotation by \(\pi\) is the eigenvalue \(-1\): the negative-eigenvalue condition is the \(\theta=\pi\) slice of the rotation condition.
Suppose the rotation angle is mistuned: \(\theta=\pi(1+\varepsilon)\) instead of \(\pi\). After \(k\) ones the accumulated angle is \(k\pi(1+\varepsilon)\). For a sequence of length 256, bound \(\varepsilon\) so that the phase drift \(k\pi\varepsilon\) stays below \(\pi/4\) for every \(k\le256\). Now argue why this tolerance makes a fixed frequency schedule an unpromising design, and connect your answer to row 2 of Table 5b.
\(k\pi\varepsilon<\pi/4\) for all \(k\le256\) requires \(\varepsilon<1/1024\approx10^{-3}\). A fixed geometric schedule has no mechanism to land within \(0.1\%\) of \(\pi\) at the relevant frequency, and — more decisively — its angle does not depend on \(x_t\) at all, so no tuning helps. Hence \(1.56\%\).
Derive the error expansion. Let \(g\) be smooth on \([t_{k-1},t_k]\), \(\Delta=t_k-t_{k-1}\). Expand \(\int_{t_{k-1}}^{t_k}g\) and \(Q_\lambda=\Delta[(1-\lambda)g(t_{k-1})+\lambda g(t_k)]\) to third order about \(t_{k-1}\) and subtract, obtaining
\[ \int g - Q_\lambda = \Big(\tfrac12-\lambda\Big)\Delta^2g' + \Big(\tfrac16-\tfrac\lambda2\Big)\Delta^3g'' + O(\Delta^4). \]Five lines of Taylor series. Then answer: for which \(\lambda\) does the \(\Delta^2\) term vanish identically, and for which does it merely vanish to leading order? The distinction is the whole content of Remark 3.
\(\int g=\Delta g+\tfrac{\Delta^2}2g'+\tfrac{\Delta^3}6g''+O(\Delta^4)\); \(Q_\lambda=\Delta g+\lambda\Delta^2g'+\lambda\tfrac{\Delta^3}2g''+O(\Delta^4)\). Subtract. The \(\Delta^2\) term vanishes identically only at \(\lambda=\tfrac12\) exactly; it vanishes to leading order for \(\lambda=\tfrac12+O(\Delta)\), which is Remark 3's hypothesis and which a free \(\sigma(u_t)\) does not satisfy.
Substitute \(\lambda=\tfrac12\) and recover the classical trapezoid error \(-\tfrac1{12}\Delta^3g''\). Substitute \(\lambda=1\) and confirm the first-order Euler error. Finally, sketch the coefficient \((\tfrac12-\lambda)\) over \(\lambda\in(0,1)\) and mark where a learned \(\sigma(u_t)\) is free to sit.
At \(\lambda=\tfrac12\): \(\tfrac16-\tfrac14=-\tfrac1{12}\). At \(\lambda=1\): the \(\Delta^2\) coefficient is \(-\tfrac12\), first order.
Unroll the three-term recurrence for \(t=0,1,2\) and verify by direct multiplication that the mask factorises as decay × 2-band. It suffices to check one nontrivial entry: confirm \(L_{2,0}=\alpha_2(\gamma_0\alpha_1+\beta_1)\).
\(h_2=\alpha_2h_1+\beta_2B_1x_1+\gamma_2B_2x_2\) with \(h_1=\alpha_1\gamma_0B_0x_0+\beta_1B_0x_0+\gamma_1B_1x_1\); the coefficient of \(B_0x_0\) in \(h_2\) is \(\alpha_2(\gamma_0\alpha_1+\beta_1)\), matching row 2 column 0 of the product.
Set \(\lambda_t\equiv1\) in the definitions of \(\beta_t,\gamma_t\). Show the 2-band matrix collapses to \(\mathrm{diag}(\gamma)\) and hence that Mamba-2 is the special case. What is the extra parameter cost per token of the general scheme?
\(\beta_t=(1-1)\Delta_te^{\Delta_tA_t}=0\), so the 2-band matrix keeps only its diagonal \(\gamma_t=\Delta_t\). Cost of the general scheme: one scalar \(\lambda_t\) per token, i.e. one extra projection — against which the measured gain is \(15.81\to15.72\) perplexity.
Write \(h=x+iy\) and expand \(e^{\Delta(A+i\theta)}(x+iy)\) using Euler's formula. Separate real and imaginary parts and read off the \(2\times2\) real matrix acting on \((x,y)^\top\). Confirm it is \(e^{\Delta A}R(\Delta\theta)\).
Real part \(e^{\Delta A}(x\cos\Delta\theta-y\sin\Delta\theta)\), imaginary \(e^{\Delta A}(x\sin\Delta\theta+y\cos\Delta\theta)\): exactly \(e^{\Delta A}R(\Delta\theta)\).
Where Proposition 3 would fail. The RoPE identity needs the decay factor to commute with the rotation. Take \(R=R(\pi/2)=\begin{pmatrix}0&-1\\1&0\end{pmatrix}\) and \(D=\mathrm{diag}(1,2)\), and compute \(DR\) and \(RD\). Are they equal? Now take \(D=cI\) and repeat. State the precise hypothesis on \(A_t\) that Proposition 3 requires, and explain why a genuinely diagonal \(A_t\) — Mamba-1's setting — breaks the cheap algorithm even though it is strictly more expressive.
\(DR=\begin{pmatrix}0&-1\\2&0\end{pmatrix}\), \(RD=\begin{pmatrix}0&-2\\1&0\end{pmatrix}\) — unequal. With \(D=cI\) they commute trivially. Proposition 3 requires \(A_t\) scalar so that \(e^{\Delta_tA_t}\) is a scalar. A diagonal \(A_t\) is more expressive per step but destroys the telescoping, so the rotations can no longer be absorbed into \(B\) and \(C\) and the cheap RoPE form does not exist. This is the trade the §10 toggle exhibits at \(10^{-15}\to10^{-1}\).
Vanilla RoPE uses the fixed schedule \(\theta[i]=10000^{-2i/N}\), identical at every position-independent step. Argue that the accumulated rotation after \(t\) tokens is then a function of \(t\) alone. Conclude that the readout carries no information about \(\sum_sx_s\), and explain row 2 of Table 5b (1.56% on parity) without appealing to any experiment.
\(\prod_{s\le t}R_s\) depends only on \(t\) when each \(R_s\) is fixed, so the rotation applied to \(B_t,C_t\) is a deterministic function of position. Nothing in the recurrence then varies with \(x_t\) beyond what Mamba-2 already had, so parity remains unreachable by 8.1.
Evaluate the SISO intensity \(\dfrac{5NP-P}{2(1+2N+P+NP)}\) at \((N,P)=(16,64),(64,64),(128,64),(256,64)\). Confirm the limit \(\tfrac52\) analytically. Then evaluate the MIMO expression \(\dfrac{4NPR+NP-PR}{2(1+2NR+PR+NP)}\) at \(N=128,P=64\) for \(R=1,2,4,8,16\) and confirm the growth is linear in \(R\) over this range.
SISO: \(2.35,2.45,2.47,2.49\) — converging to \(\tfrac52\) from below, and note it barely moves across a \(16\times\) range of \(N\). MIMO at \(N=128,P=64\): \(2.40,4.17,7.34,12.55,19.96\) for \(R=1,2,4,8,16\).
Derive the ridge yourself. An H100-SXM5 delivers roughly 989 TFLOP/s in bf16 with about 3.35 TB/s of HBM bandwidth. Compute the ridge point of the roofline in operations per byte. You should land near 295. Now place the SISO number from 11.1 on that axis: what fraction of peak arithmetic is reachable by the decode step, and does enlarging \(N\) or \(P\) move it?
\(989\times10^{12}/3.35\times10^{12}\approx295\) ops/byte. At \(2.5\) ops/byte the decode step reaches roughly \(2.5/295\approx0.85\%\) of peak arithmetic. Neither \(N\) nor \(P\) moves it, since the expression tends to \(\tfrac52\) in both — which is the argument for changing the update rule rather than any dimension.
The naive MIMO training cost is \(R^2\) times SISO. Intra-chunk cost scales as \(\dfrac TC(CR)^2(N+P)=TCR^2(N+P)\). Substitute \(C\to C/R\) and show the cost becomes \(TCR(N+P)\), an \(R\)-fold rather than \(R^2\)-fold increase. What happens to the number of chunks, and why does the inter-chunk term not spoil the accounting?
Chunk count rises from \(T/C\) to \(TR/C\); intra-chunk cost per chunk falls by \(R^2\); the product falls by \(R\). Inter-chunk cost is \(4TNP(R)\) plus a \(T/C\)-scaled remainder that stays subdominant when \(CR=N=P\). Total \(8TRN^2\).
Take \(D=2048\), \(N=128\), \(P=64\), \(H=32\) heads, \(R=4\). Compute the added parameters under (i) a naive rank-\(R\) lift of all of \(B,C,x,y,z\), and (ii) Mamba-3's scheme, in which \(B,C\) are shared across heads (\(DN\to DNR\) for the layer) while the per-head projections go \(DP\to DP+PR\). Express both as a percentage of the SISO layer. The gap is why §7.5's head-pattern ablation matters here and not merely as trivia.
Naive: every projection \(\times4\), roughly a \(4\times\) layer parameter count. Mamba-3: \(B,C\) contribute \(DN(R-1)=2048\cdot128\cdot3\approx7.9\times10^5\) added for the layer; per-head terms add \(PR=256\) each, \(\times32\) heads \(=8192\). The added total is a few per cent, absorbed by trimming the MLP width by \(6.6\%\) — against \(\sim300\%\) for the naive lift. Sharing \(B,C\) is what makes MIMO affordable, and §7.5 is where that sharing was chosen.
For each row of the §12 table, name which of {memory, trainability, decoding cost} was bought and which was paid. Two rows resist the classification — identify them and say why.
The two that resist: HiPPO (which pays nothing — it is the question, not an answer to a constraint) and §12.1's second bullet, the expressivity ceiling (a limitation discovered, not a trade made). Recognising that the table has two kinds of row is the point.
Every model in the lineage responded to whichever constraint was binding at the time. State what you believe the binding constraint is now, and what a response to it would have to change. Test your answer against 12.1: does it address one of the four open edges, or a fifth?
No single answer is printed here on purpose — this is the one exercise in the set that asks you to take a position, not recover one. One defensible case: the binding constraint is retrieval capacity, the third of the four open edges above — a fixed-size state cannot outgrow its capacity no matter how the recurrence inside it is parameterised, and every refinement since S4 (diagonalisation, selectivity, SSD, exponential-trapezoidal discretisation, complexification, MIMO) has improved what the state does with its fixed budget, not the budget itself. A genuine response would have to change the object being scanned — a variable or growing state, or a principled way to spill to and retrieve from an external store — which is a different kind of move than anything in the §12 table, all of whose rows fix \(N\) and refine the map. That reading makes it a fifth edge in the sense the exercise asks about: not the expressivity ceiling, not the discretisation-versus-theory gap, not "complexification is one route, not the route," but the retrieval bullet promoted from caveat to constraint.
The competing case is that the binding constraint is still the expressivity ceiling — \(\mathsf{TC}^0\) is a hard wall, not a soft one — in which case the correct response is not a further state-space refinement at all but a structurally different recurrence (a non-diagonal, Householder-type transition, as in Gated DeltaNet), which is one of the four edges rather than a fifth. Which of the two you find more urgent is exactly the judgment call this exercise is asking for.
Parity is reachable by two routes: Mamba-3's complexification, and Grazzi et al.'s extension of the eigenvalue range to \([-1,1]\). Using Exercise 8.2, explain why these are related but not identical, which is more general, and what each costs. Then account for why Gated DeltaNet \([-1,1]\) beats Mamba-3 on bracketed modular arithmetic while tying on parity.
Negative real eigenvalues give \(R(\pi)\) only; complex eigenvalues give \(R(\theta)\) for arbitrary \(\theta\), hence arbitrary cyclic groups rather than just \(\mathbb Z/2\). Complexification is strictly more general and costs a doubled pair dimension; the eigenvalue extension is nearly free but reaches less. Gated DeltaNet's advantage on bracketed modular arithmetic comes from the delta rule's non-diagonal (Householder) transition, which is a third and independent axis — not from its eigenvalue range.