State Space Models (SSMs) have recently emerged as a powerful alternative to Transformers for modeling long sequences, offering linear scaling with sequence length. However, the pioneering "S4" model is notoriously complex to implement, involving intricate frequency-domain convolutions and specialized matrix decompositions.
In this paper, the authors introduce S5 (Simplified State Space Layers). S5 strips away the complexity of S4 by moving from a bank of many small, independent models to a single, multi-input multi-output (MIMO) system. By leveraging parallel scans instead of convolutions, S5 matches S4’s efficiency while becoming more flexible and easier to use.
The Challenge of Long-Range Dependencies
Efficiently modeling dependencies in sequences spanning thousands of timesteps is a core challenge in AI. While Transformers are the standard, their self-attention mechanism has a quadratic cost ($O(L^2)$), making them prohibitively slow for very long sequences.
The Structured State Space (S4) model solved this by using linear ODEs to track state, achieving $O(L \log L)$ complexity. However, S4 is mathematically dense: it requires "Normal Plus Low-Rank" (NPLR) matrix decompositions and computes its output via a global convolution in the frequency domain. This convolutional approach makes it difficult to handle sequences where the time between observations varies (irregular sampling) and requires a high degree of specialized "plumbing" to implement efficiently.
The S5 Architecture: Simplifying State Spaces
The authors propose two major shifts to simplify the SSM architecture:
1. From SISO to MIMO S4 uses a "bank" of $H$ independent Single-Input Single-Output (SISO) SSMs. S5 replaces this with a single Multi-Input Multi-Output (MIMO) SSM. This allows the model to learn interactions within the state space itself rather than relying solely on a mixing layer after the SSM.
2. Parallel Scans Instead of Convolutions Instead of treating the SSM as a massive convolution, S5 treats it as a linear recurrence ($x_k = \bar{A}x_{k-1} + \bar{B}u_k$). By ensuring the state matrix $A$ is diagonal, the authors can use a parallel scan (an "all-prefix-sum" algorithm). This computes the entire sequence of states in $O(\log L)$ parallel time, matching the efficiency of FFT-based convolutions but operating entirely in the time domain.
To maintain the performance of S4, S5 inherits the HiPPO framework for initialization. Since the standard HiPPO-LegS matrix isn't stably diagonalizable, S5 uses the HiPPO-N (Normal) approximation, which provides similar long-range memory benefits while being compatible with diagonal parallel scans.
Key Insights and Advantages
- The "Aha" Moment on Projections: The authors prove that S5 is mathematically related to S4. Specifically, S5 can be viewed as a different output projection of the same underlying dynamics used in S4. This explains why S5 can achieve similar performance despite its simpler structure.
- Time-Domain Flexibility: Because S5 uses a recurrence (scan) rather than a fixed convolution kernel, it can handle time-varying parameters. For example, if a sequence is sampled irregularly, S5 can simply adjust the discretization step $\Delta$ at each individual timestep—something the convolutional S4 cannot do easily.
- Efficiency through Diagonalization: By forcing the state matrix to be diagonal, the matrix-matrix multiplications in the parallel scan become simple element-wise operations, drastically reducing the computational overhead.
Empirical Performance
The model was evaluated on a diverse set of challenging benchmarks, demonstrating that simplification does not come at the cost of performance:
- Long Range Arena (LRA): S5 achieved an average score of 87.46%, outperforming S4, S4D, and concurrent models like Liquid-S4 across tasks with sequence lengths up to 16,000.
- Path-X Mastery: On Path-X (the most difficult LRA task), S5 achieved 98.58% accuracy, setting a new state-of-the-art.
- Speed and Irregular Sampling: On a pendulum regression task involving irregularly sampled images, S5 was 86x faster than the Continuous Recurrent Unit (CRU) while achieving lower error.
- Zero-Shot Sampling: S5 showed impressive robustness to sampling rate changes. A model trained on 16kHz audio could be applied to 8kHz audio "zero-shot" simply by doubling the step size $\Delta$, significantly outperforming baseline CNNs.
Limitations and Future Directions
While highly effective, S5 has some limitations. The model is currently restricted to diagonalizable matrices for the parallel scan to remain efficient; non-diagonalizable systems might offer more expressive power but are computationally expensive. Additionally, performance is sensitive to the latent state size $P$, and finding the optimal balance between state size and the number of layers remains an empirical challenge.
Ultimately, the MIMO design of S5 opens exciting new doors, potentially bridging deep learning SSMs with classical control theory and probabilistic state-space filtering and smoothing techniques.
Summary updated