State Space Models for Language › Linear Time Invariance and the Convolution View
Language AI HandbookAll chapters Now set the initial state to zero, , and unroll the recurrence for a few steps to see the pattern.
At each step the state receives another input and propagates every earlier contribution through one more application of the transition. An input from therefore passes through transitions by position . The general form is
Apply the readout to that state.
Define the state-mediated impulse response taps
With zero initial state, a unit input at position zero produces the state-mediated response at lag . An input of amplitude at position contributes to the state-mediated output at position . Summing these scaled, shifted responses gives the causal convolution. The direct path adds .
Three things are doing work here.
Zero initial state. For , add to the convolution output at position . This term propagates the existing state over the same updates.
Causal truncation. The sum at includes only lags through . For the first outputs, it is exact to build a length- kernel and retain the first entries of the full linear convolution. Later taps would apply only at later outputs.
The direct path. The direct contribution changes the lag-zero tap to . The later taps stay at . The example below folds the direct path into the lag-zero tap.
For a known sequence, the convolution can evaluate the outputs together. During autoregressive decoding, an implementation can use the recurrence to update its last state as each new input arrives. For a diagonal transition, updating and reading a state of width uses arithmetic per channel.
The equality between convolution and recurrence holds in exact arithmetic. A numerical comparison needs a tolerance because the two evaluation orders accumulate rounding differently.
Building the Kernel and Applying It
Building a length- kernel and applying it are separate computations.
- Build the taps. In a diagonal system of state size , you can start with and multiply elementwise by the diagonal of for each lag. A dot product with gives each tap. That uses arithmetic for one channel.
- Apply the kernel. Direct convolution over the causal pairs takes arithmetic per channel. FFT convolution with padding for a linear convolution takes for that length. Keep the first outputs for the causal readout.
S4 builds its kernel by evaluating the finite generating function at the roots of unity and transforming those evaluations back to coefficients. For a complex evaluation point , the finite sum is
When is invertible, summing the matrix geometric series gives
At the roots of unity the last factor is . This factor preserves the exact finite kernel, including modes that still carry substantial weight at lag . It can be merged into the readout because it commutes with . This leaves an expression that a structured matrix algorithm can compute across the evaluation points. See S4, section 3.2 and Appendix C.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!