Selective State-Space Models (SSMs), most notably the Mamba architecture, have recently emerged as a compelling alternative to Transformers. By combining the parallelizable training of CNNs with the efficient, constant-time inference of Recurrent Neural Networks (RNNs), SSMs promise to scale more effectively to long sequences. However, most modern implementations rely on diagonal transition matrices to maintain computational efficiency. This paper investigates whether this diagonal constraint limits the model's ability to emulate Finite-State Automata (FSA) and proposes a more expressive alternative: the Selective Dense State-Space Model (SD-SSM).
The Challenge of State-Tracking
Large Language Models (LLMs) based on the Transformer architecture often struggle with tasks requiring precise "state-tracking"—the ability to maintain and update a logical state over long horizons. While RNNs are theoretically well-suited for this, they suffer from training bottlenecks. Selective SSMs were designed to bridge this gap.
Despite their promise, the authors identify a fundamental limitation in standard diagonal SSMs: they are restricted to emulating commutative automata, where the order of input tokens does not affect the final state. Many complex logical tasks and regular languages are non-commutative, requiring a more robust mechanism for state transitions.
The SD-SSM Architecture
To address these limitations, the authors introduce SD-SSM (Selective Dense State-Space Model). Unlike standard models that use a single diagonal matrix, SD-SSM employs a dictionary of trainable dense transition matrices.
As shown in the architecture diagram above, SD-SSM operates through four key mechanisms:
- Dense Transition Dictionary: The model maintains $k$ dense transition matrices ($A_1, \dots, A_k$).
- Softmax Selection: At each time step $t$, a softmax mechanism computes a weighted average of these matrices based on the input $u_t$, producing a time-varying transition matrix $A(u_t)$.
- Operator Normalization (OpNorm): To prevent numerical instability over long sequences, the model applies column-wise $l_p$ normalization to the transition matrices, ensuring eigenvalues remain controlled.
- Linear Readout: The authors found that a simple linear map (preceded by Layer Normalization) is superior to a multi-layer perceptron (MLP) for preserving state information across long horizons.
Crucially, despite using dense matrices, SD-SSM remains parallelizable during training via the parallel scan algorithm, preserving the core advantage of the SSM paradigm.
Empirical Evaluation and Results
The authors evaluated SD-SSM against a variety of baselines, including RNNs, Transformers, and popular SSM variants like S4D, H3, and Mamba. The evaluation focused on seven FSA emulation tasks, ranging from simple parity checks to complex algebraic group tasks based on Cayley diagrams (e.g., the non-commutative $D_4$ group and the non-solvable $A_5$ group).
The results demonstrate a significant performance gap. While diagonal models like Mamba and S4D perform well on simple commutative tasks, they fail significantly on non-commutative logic. For instance, on the Arithmetic task, Mamba achieves only ~50% accuracy, whereas SD-SSM achieves a perfect 100%. Furthermore, SD-SSM demonstrates remarkable length generalization, maintaining near-perfect accuracy on sequences up to length 500 even when trained on sequences as short as 40 tokens.
Key Insights
- Dense Matrices are Essential: The transition from diagonal to dense matrices is necessary for capturing non-commutative state logic. While this increases parameter count ($O(n^2)$ vs $O(n)$), it is the key to emulating complex FSAs.
- Simplicity in Readout: A surprising finding was that non-linearities in the readout layer (like MLPs) actually hinder length generalization. A linear readout better preserves the integrity of the latent state.
- Stability via OpNorm: Operator Normalization is critical for ensuring that the recurrent dynamics do not explode or vanish over thousands of steps.
Conclusion
SD-SSM represents a significant step forward in understanding the expressivity of state-space models. By relaxing the diagonal constraint and optimizing the readout mechanism, the authors have created a model capable of perfect length generalization on complex regular languages. While the computational overhead of dense matrices is higher, the gains in logical reasoning and state-tracking suggest that dense transitions may be a vital component for the next generation of recurrent architectures.
Summary updated