Introduction
Transformers are the undisputed kings of modern AI, but their quadratic scaling makes them "memory hungry" as sequences get longer. State Space Models (SSMs), such as Mamba, offer a promising alternative with linear scaling and recurrent efficiency. However, a formal understanding of their "expressive capacity"—the mathematical limits of what these models can represent—has been lacking. This research investigates whether SSMs are merely faster Transformers or if they possess a distinct set of computational capabilities. By applying formal language theory, the authors compare SSMs against Transformers and traditional RNNs to identify where their strengths overlap and diverge.
Methods
The study defines a generalized SSM framework encompassing modern implementations like Mamba, Griffin, and GLA. Two primary approaches are employed:
- Theoretical Analysis: Utilizing algebraic automata theory, specifically the Krohn-Rhodes Theorem, the authors prove which classes of languages SSMs can recognize under finite precision settings.
- Empirical Verification: A Mamba model is trained on 27 formal languages to test if practical performance aligns with theoretical bounds.
Datasets
The researchers utilized several classic and specialized formal language benchmarks to probe the models' logic:
- Tomita Grammars: Seven regular languages used to test neural network logic.
- Counter Languages: Tasks like $a^n b^n$ or Dyck-1 that require tracking unbounded counts.
- Flip-Flop Languages: A fundamental test of state tracking where the model must remember the last bit written to a specific address.
- Bounded-depth Dyck: A benchmark for hierarchical structures, such as nested brackets, common in natural language.
Key Insights and Ideas
The "Nonnegative" Bottleneck
Most modern SSMs utilize sigmoid or exponential functions for gating, resulting in strictly positive gate values. The authors prove this design choice makes it mathematically impossible for these SSMs to solve the PARITY problem (determining if a string contains an even or odd number of 1s). Solving PARITY requires the ability to "flip" state, which necessitates negative coefficients.
State Tracking and Counting Superpowers
Unlike Transformers, which often struggle with exact "Flip-Flop" logic over long sequences due to their reliance on attention weights, SSMs handle state tracking effortlessly. Their recurrent nature allows them to generalize to sequences much longer than those seen during training. Furthermore, the authors demonstrate that SSMs can model bounded hierarchical structures using optimal memory ($O(h \log K)$) through their counting and state-tracking abilities, without explicitly simulating a stack.
Star-Free vs. Non-Star-Free
The paper establishes a clear computational divide: SSMs can recognize all "star-free" regular languages (those not requiring modular counting) but fail on "non-star-free" ones.
Key Results
- Empirical Match: Mamba's performance perfectly mirrored theoretical predictions, achieving ~100% accuracy on all star-free and counter languages.
- The Failure Point: As predicted, Mamba failed significantly on the PARITY task and other modular languages where Transformers can theoretically succeed.
- Length Generalization: On star-free tasks, Mamba showed perfect generalization to sequences twice the training length, outperforming Transformers in these scenarios.
- Efficiency: A 2-layer SSM proved sufficient to model complex hierarchical structures, confirming that deep stacks are unnecessary for many linguistic patterns.
Limitations and Future Work
The research focuses on expressive capacity (what a model can do) rather than learnability (how easily it learns via gradient descent). While an SSM can represent a counter, it may not always learn to be a perfect counter in practice.
Future Directions: * Hybrid Architectures: The complementary strengths of Transformers (complex logic/counting) and SSMs (state tracking/hierarchy) suggest that hybrid models like Jamba may be the most robust path forward. * New Gating Mechanisms: Exploring complex-valued or negative gates could overcome the PARITY limitation, though training stability remains a concern.
Summary updated