Abstract: As State Space Models (SSMs) like Mamba and S4 gain prominence as efficient alternatives to Transformers, understanding their theoretical limits for verification becomes essential. This paper presents the first comprehensive study of the computational complexity of the satisfiability problem for SSMs (ssmSAT). We demonstrate that while the general problem is undecidable, practical constraints such as bounded input lengths and fixed-width arithmetic render it decidable. Our analysis maps the complexity landscape from NP-complete to EXPSPACE, providing critical insights into the formal verification of modern sequence models.
Introduction
The rapid adoption of State Space Models (SSMs) in large-scale machine learning has highlighted the need for robust safety and reliability guarantees. Unlike Transformers, which rely on attention mechanisms, SSMs utilize linear recurrences and gating to process long-range dependencies. This structural difference necessitates a dedicated analysis of their formal properties. This paper addresses the fundamental question: can we mathematically determine if an SSM will ever reach a specific, potentially unsafe, state?
The ssmSAT Problem
In formal verification, "satisfiability" (SAT) is the task of determining whether there exists an input sequence that causes a model to satisfy a given property—for instance, reaching an "accepting" or "error" state. Solving ssmSAT is a prerequisite for safety verification and explainability in SSMs. The paper seeks to identify which versions of the model are computationally tractable and which are mathematically impossible to verify.
Methodology
The researchers employ tools from computational complexity theory, primarily reductions, to establish bounds:
- Undecidability Proof: By showing that a general SSM can simulate a two-counter Minsky Machine, the authors prove that ssmSAT is undecidable in its most general form, as the halting problem for Minsky Machines is undecidable.
- Decidability via Constraints: The study investigates two realistic constraints: Bounded Context Length (restricting the input sequence to a maximum length $n$) and Fixed-Width Arithmetic (modeling the quantization used in actual hardware implementations).
- Lower Bounds: Using Linear Temporal Logic (LTLf), the authors demonstrate that even simple SSMs can encode complex logical requirements, establishing a PSPACE-hard lower bound for many variants.
Key Results
The paper establishes a detailed hierarchy of complexity for ssmSAT, distinguishing between time-invariant SSMs ($\mathfrak{S}_{\text{ti}}$) and diagonal gated SSMs ($\mathfrak{S}_{\text{diag}}$).
As shown in Table 1, the results indicate that complexity is highly sensitive to how constraints are represented. For instance, when the context length is provided in unary, the problem is NP-complete. However, if the length is encoded in binary, the complexity escalates to NEXPTIME due to the exponential growth of the search space relative to the input description. Similarly, fixed bit-width constraints lead to PSPACE-complete or EXPSPACE results depending on the encoding.
Theoretical Insights
- The Role of Gating: The non-linear gating mechanisms found in models like Mamba significantly contribute to their computational power and, consequently, the difficulty of their verification. Time-invariant SSMs are generally "simpler" than diagonal gated variants.
- Precision and Decidability: Undecidability persists even if the precision of numbers grows only logarithmically with the input length. Decidability is only achieved when the bit-width is strictly capped (quantization), which effectively makes the state space finite.
- Comparison with Transformers: The complexity classes identified for SSMs largely mirror those found in Transformer architectures, suggesting that the shift to SSMs does not simplify the fundamental challenges of formal verification despite offering better inference speed.
Conclusion and Future Work
This work provides a theoretical foundation for the verification of SSMs. While the high complexity bounds (up to EXPSPACE) present challenges, the identification of decidable fragments opens the door for developing practical SMT solvers. Future research will focus on closing the gap between PSPACE and EXPSPACE bounds for binary-encoded bit-widths and exploring whether purely linear SSMs offer a more tractable path for verification.
Summary updated