6.1.11 · D5Scaling & Efficient Architectures
Question bank — State-space models (Mamba, S4)
Before you start, one vocabulary anchor so nothing below is a surprise:
True or false — justify
TF — "SSMs are just RNNs, so they must be trained sequentially like an RNN."
False. At inference they run as a recurrence like an RNN, but at training the linear (input-independent) SSM unrolls into a convolution, which parallelises across the whole sequence — RNNs cannot do this because their nonlinearity blocks unrolling into a fixed kernel.
TF — "The continuous ODE is what actually runs on the GPU."
False. The GPU runs the discretised recurrence . The continuous form is a design language that lets us borrow control-theory tools; discretisation converts it to something computable on tokens.
TF — "Making the state dimension larger always makes an SSM slower per token by ."
False for S4/Mamba. A dense would cost , but S4's diagonal-plus-low-rank and Mamba's diagonal make the per-step cost effectively , which is why large (long memory) stays affordable.
TF — "The convolution kernel and full self-attention are the same cost."
False. Naively the kernel is length , so direct convolution is — but because it is a fixed kernel it goes through FFT at . Attention builds an score matrix that has no such shortcut, staying .
TF — " means the eigenvalues of must be positive."
False. They must lie inside the unit circle (magnitude ) for stable, decaying memory. Since 's eigenvalues typically have negative real parts, produces magnitudes below 1 — the sign of the exponent's real part, not the entry, is what matters.
TF — "In Mamba, is a learned lookup table indexed by the token."
False. : the base is a fixed learned parameter, but the effective transition changes per token because is computed from the input. Selection lives in (and in ), not in a table.
TF — "Because Mamba is input-dependent, it can no longer be written as any kind of recurrence."
False. It is still a recurrence — every step runs one after another. What it loses is the convolutional form, because a convolution needs a single time-invariant kernel.
Spot the error
Error — ", so if the model breaks (divide by zero)."
The formula is a limit-safe expression: as , (Taylor expand ). So — no blow-up, the input is simply written proportional to the step size.
Error — "Since is a skip connection, dropping it () removes the ability to copy the input to the output."
Wrong to call it a fatal loss but the mechanism is right: with the direct path is gone, so any input echo must route through the state. In practice is a cheap residual and is often kept precisely so the model needn't waste state capacity on a copy.
Error — "The kernel is ."
Missing the read-out. Each entry must be pre-multiplied by : . Without you'd have the state's impulse response, not the output's.
Error — "Mamba beats S4 because it uses the FFT more cleverly."
Backwards. Mamba cannot use the FFT at all — its input-dependent parameters destroy the fixed kernel. It wins on modelling quality via selection, and stays fast through a hardware-aware scan (fused kernels, work in SRAM), not through FFT.
Error — " is a fixed hyperparameter you tune, like a learning rate."
In S4 it is a learned scalar per channel; in Mamba it is computed from each token. It is never a hand-set constant during the forward pass — it is exactly the knob the model turns to decide memory length.
Error — "Using Euler's method is fine — it's simpler and gives the same result."
It's only the first-order approximation of . Over 100K-token sequences the small per-step error compounds, and stability can be lost when eigenvalues drift outside the unit circle. The matrix exponential is the exact zero-order-hold solution, which is why it's preferred.
Why questions
Why — "Why phrase the model as a continuous system when we only ever feed discrete tokens?"
The continuous form lets us set using well-understood signal-processing theory (e.g. HiPPO for optimal memory) and gives a principled, error-controlled discretisation via — advantages a purely discrete recurrence design lacks.
Why — "Why does a single scalar act like a memory dial?"
, so a large pushes eigenvalue magnitudes near 1 (state barely decays → long memory) while a small pushes them toward 0 (state decays fast → short memory). One number smoothly interpolates the whole memory range.
Why — "Why is the SSM related to a convolution but with a kernel as long as the sequence?"
Unrolling the recurrence shows each output is a weighted sum of all past inputs with weights . That is a convolution whose receptive field is the entire sequence — unlike a CNN's short fixed window, giving unbounded (but decaying) context.
Why — "Why is Mamba sometimes compared to Linear Attention?"
Both avoid the attention matrix by keeping a fixed-size running summary of the past that is updated additively per token. The state plays the role of linear attention's accumulated key–value memory; both trade an explicit token-pair matrix for a recurrent state.
Why — "Why must be allowed negative entries (like the in the worked example)?"
Negative read-out weights let state dimensions cancel or oppose each other, so the model can express conditions like "fire when dimension 1 is high and dimension 2 is low" — richer than a purely additive read-out could.
Why — "Why can't a fixed-kernel S4 solve the 'remember a name for the whole document' task well?"
Its decay rate is the same for every token, so it must pick one global compromise: long memory keeps the name but also clutters with filler words; short memory drops the filler but forgets the name. Mamba escapes this by choosing per-token.
Edge cases
Edge — "What does an SSM do when exactly (eigenvalues on the unit circle)?"
The state never decays — it becomes a running accumulator of . This is a perfect but lossless memory; useful for counting/integrating, but risky since it never forgets and can grow unbounded.
Edge — "What happens as for a token?"
and (since ), so the state is frozen and the input ignored — the token is effectively skipped. This is exactly how Mamba "forgets" or bypasses filler.
Edge — "What happens as ?"
If 's eigenvalues have negative real part, : the old state is wiped and the step is dominated by the fresh input — a sharp "reset and pay full attention here" behaviour.
Edge — "With initial state , is the first output always zero?"
No. so — the first input immediately writes into the state and reads out, so is nonzero whenever and the kernel head are nonzero.
Edge — "If every eigenvalue of has magnitude just above 1, what breaks over a long sequence?"
Old contributions get amplified each step, so explodes and the state overflows — the SSM's version of an RNN's exploding gradient/activation. Stable training keeps magnitudes strictly below 1.
Edge — "For a degenerate 1-token sequence (), does the recurrent vs convolutional distinction matter?"
No — both reduce to the single computation . The parallel-training advantage of the convolution only appears once ; the two views are two lenses on the same underlying map.
Edge — "If two different state dimensions share the same eigenvalue in , is anything lost?"
They decay at the identical rate, so their memories become linearly redundant unless / separate them — effectively wasting capacity. Diverse eigenvalues (fast + slow channels) are what give the model a spectrum of memory timescales.
Recall Self-check
The single sentence that ties it together ::: A linear SSM is one machine seen two ways — a recurrence for cheap inference and a convolution for parallel training — and Mamba trades the convolution away for the power to change its memory dial () per token.