Structured Sparse Transition Matrices to Enable State Tracking in State-Space Models

Aleksandar Terzic, Nicolas Menet, Michael Hersche, Thomas Hofmann, Abbas Rahimi

TL;DR

State-Space Models (SSMs) are rapidly emerging as scalable alternatives to Transformers, but their efficiency often comes at the cost of expressivity—specifically, the ability to emulate complex logic and finite-state automata (FSA). This paper introduces PD-SSM, which utilizes a novel "Structured Sparse" transition matrix ($P \times D$). This approach achieves the expressivity of dense, unstructured models while maintaining the linear computational scaling of diagonal models like Mamba, effectively bridging the gap between algorithmic reasoning and high-speed sequence modeling.

The "Diagonal Tax" and FSA State Tracking

Modern SSMs, such as Mamba and S6, achieve their signature linear scaling with sequence length by relying on diagonal transition matrices. However, this efficiency introduces a "diagonal tax": these mathematically restricted matrices struggle to track the state of Finite-State Automata (FSA), which are fundamental building blocks of algorithmic logic.

Examples of Finite-State Automata and their corresponding transition matrices.

To accurately track these states, diagonal models must be made prohibitively deep or wide. Conversely, "dense" (unstructured) transition matrices can easily track FSA states but are too slow for practical use due to their $O(N^3)$ matrix multiplication costs. The core challenge addressed by this paper is creating an SSM that is both expressive enough to handle complex logic and efficient enough to remain fast to compute.

The PD-SSM Architecture

To solve this, the authors propose the PD-SSM, which parametrizes the state transition matrix $A(u_t)$ as the product of two specific matrices:

  1. $P$ (Column One-Hot Matrix): A sparse binary matrix where each column has exactly one "1". This acts as a permutation or selection mechanism, routing information between hidden state dimensions.
  2. $D$ (Complex Diagonal Matrix): A diagonal matrix that scales and rotates the state components in the complex plane.
Architecture of the PD-SSM showing the generation of the sparse matrix P and complex diagonal matrix D.

The Algebraic "Secret Sauce": The set of $PD$ matrices forms a monoid under multiplication. This means that multiplying two $PD$ matrices results in another $PD$ matrix. This crucial algebraic property allows the model to utilize associative parallel scans, keeping the computational complexity at $\Theta(LN)$—identical to the scaling of much simpler diagonal models.

To generate these matrices dynamically from input data, the model uses two MLPs to generate the magnitude and phase of the diagonal matrix $D$, and a dictionary-based approach with a "hardmax" operation to select the sparse matrix $P$.

Key Insights and Theoretical Guarantees

  • Optimal Expressivity: Theoretically, PD-SSM is "maximally expressive." It can emulate any $N$-state FSA using a single layer of dimension $N$ and a linear readout. Previous structured models required significantly higher dimensions or many more layers to achieve the same result.
  • Stability by Design: By using a sigmoid-based MLP for the magnitude of $D$, the authors ensure the model is Bounded-Input, Bounded-Output (BIBO) stable. This prevents hidden states from exploding during long sequences.
  • The Power of Sparsity: The paper demonstrates that dense matrices aren't strictly necessary for logic; the right kind of sparsity suffices. The $P$ matrix allows the model to "route" information, which perfectly mirrors the discrete state transitions in an automaton.

Experimental Results

The model was evaluated across a diverse range of benchmarks, yielding impressive results:

  • Algorithmic Superiority: On classic FSA tasks (e.g., Cycle Navigation, Modular Arithmetic), PD-SSM achieved an average accuracy of 98.8%, vastly outperforming Mamba (~58.9%) and other structured variants.
  • Computational Speed: In runtime tests, PD-SSM was 71x faster than dense SSMs at large dimensions. While it is roughly 7x slower than pure diagonal models due to the overhead of generating the $P$ matrix, it successfully maintains the critical $O(N)$ linear scaling.
  • Time-Series Performance: On the UEA Multivariate Time-Series Archive, it outperformed Neural Controlled Differential Equations (NCDEs), despite NCDEs being explicitly designed for that domain.
  • Natural Language Logic: The authors introduced a novel benchmark where FSA transitions are hidden within variable-length English sentences. PD-SSM converged within 10,000 steps to perfectly track states, whereas diagonal models failed to learn the task entirely.
  • Hybrid Potential: PD-SSM was successfully integrated into a hybrid architecture (replacing a layer in a frozen Qwen-2.5 1.5B model), demonstrating its ability to enhance the reasoning capabilities of existing Large Language Models.

Limitations and Future Work

While the recurrence is fast, generating the $P(u_t)$ matrix at every timestep adds a constant overhead. Future work will investigate more efficient one-hot generation strategies. Additionally, while the model excels at discrete logic, the authors noted it does not yet match the accuracy of Linear Time-Invariant (LTI) systems in certain continuous signal processing tasks (like image processing), suggesting a trade-off between tracking discrete logic and processing continuous signals. Finally, scaling these benefits to "frontier-scale" models (100B+ parameters) remains an exciting open question.

Summary updated

BibTeX
@inproceedings{terzic2025structured,
  author = {Aleksandar Terzic and Nicolas Menet and Michael Hersche and Thomas Hofmann and Abbas Rahimi},
  title = {{Structured Sparse Transition Matrices to Enable State Tracking in State-Space Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=RDbuSCWhad},
}
Figure