Unlocking State-Tracking in Linear RNNs Through Negative Eigenvalues

Riccardo Grazzi, Julien Siems, Arber Zela, Jörg K.h. Franke, Frank Hutter, Massimiliano Pontil

TL;DR

Current Linear Recurrent Neural Networks (LRNNs) like Mamba and DeltaNet fail at simple state-tracking tasks, such as calculating parity, because their internal transition matrices are restricted to positive eigenvalues. This paper proves that extending this range to include negative eigenvalues ($[-1, 1]$) allows these models to solve parity, count modulo $n$, and theoretically learn any regular language. This architectural tweak leads to significant performance gains in code and mathematics at the 1.3B parameter scale.

The State-Tracking Problem

While Transformers and LRNNs have revolutionized natural language processing, they share a surprising blind spot: they struggle with state-tracking. State-tracking is the ability to maintain and update an internal state over a sequence—for example, keeping track of nested brackets in code or performing modular arithmetic.

The simplest version of this is the parity problem: given a string of bits, is the number of "1s" even or odd? While older non-linear RNNs (like LSTMs) solve this easily, they are notoriously hard to parallelize. Modern, efficient LRNNs were previously thought to be fundamentally incapable of solving parity. Recent research suggested the culprit was the restriction of transition matrices to positive eigenvalues (the $[0, 1]$ range). This paper aims to prove that theory across different architectures and demonstrate that "fixing" the eigenvalues works in practice at scale.

Methods and Theoretical Foundations

The authors propose a mathematically simple but conceptually powerful modification: allowing negative eigenvalues.

  1. The "Fix": In models like Mamba (diagonal) and DeltaNet (non-diagonal), the state-transition matrix $A(x_t)$ is usually gated to stay between 0 and 1. The authors modify the gating functions (e.g., changing $I - \beta vv^\top$ to $I - 2\beta vv^\top$) to map the eigenvalues to the range $[-1, 1]$.
  2. Theoretical Proofs: The paper provides four key theorems. Most notably, the authors prove that LRNNs with eigenvalues in $[-1, 1]$ can represent any Finite State Automaton (FSA), meaning they can theoretically recognize any regular language.
  3. Architectural Generalization: They show that while diagonal matrices (Mamba) can solve parity with negative eigenvalues, non-triangular matrices (like the Householder transformations in DeltaNet) are required to perform more complex tasks like counting modulo 3.
  4. Scaling: To ensure the modification didn't break training stability, they integrated these changes into Mamba and DeltaNet and pre-trained models up to 1.3 billion parameters.

Key Insights and Ideas

Oscillation vs Monotonicity
  • The "Oscillation" Necessity: Positive eigenvalues cause internal states to either converge or diverge monotonically (moving in one direction). State-tracking often requires "flipping" or "oscillating" (e.g., transitioning between Even and Odd states), which fundamentally requires negative eigenvalues.
  • Non-Triangularity Matters: To count modulo $m$ (where $m$ is not a power of 2), a model needs to be able to "rotate" its state in a way that triangular matrices cannot achieve. This highlights why architectures like DeltaNet have a structural advantage over purely diagonal models like Mamba for certain logic tasks.
  • Stability at Scale: A common fear in RNN research is that allowing negative values or complex transitions will lead to exploding gradients. This paper demonstrates that as long as the eigenvalues stay within the unit circle (magnitude $\le 1$), training remains stable even at the billion-parameter scale.

Experimental Setup

The researchers evaluated their approach across three tiers of complexity:

  • Formal Languages: Synthetic tasks from the Chomsky Hierarchy, including Parity and Modular Arithmetic (with and without brackets).
  • Group Word Problems: Tracking permutations in the $S_5$ symmetric group and the $Z_{60}$ cyclic group.
  • Large-Scale Pre-training: Training on FineWeb-100B (a high-quality web crawl dataset).
  • Downstream Evaluation: Perplexity testing on CodeParrot (programming), Math-Hard (mathematics), TriviaQA, and SlimPajama.

Key Results

Accuracy jump with negative eigenvalues
  • Parity Solved: On the parity task, Mamba and DeltaNet went from 0.0 accuracy (random guessing) to 1.0 (perfect score) simply by enabling negative eigenvalues.
  • Modular Arithmetic: DeltaNet with the $[-1, 1]$ range achieved 0.971 accuracy on modular arithmetic without brackets, compared to 0.314 for the original version.
  • Code and Math Gains: In the 1.3B parameter DeltaNet model, the version with negative eigenvalues showed consistently lower perplexity (better prediction) on code and math datasets compared to the standard $[0, 1]$ baseline.
  • Competitive Benchmarking: On standard common sense benchmarks (HellaSwag, ARC, etc.), the modified models performed comparably to or slightly better than the originals, proving that the fix for state-tracking doesn't hurt general language performance.

Limitations and Future Work

  • Numerical Efficiency: Some high-performance implementations of LRNNs (like Mamba2 or GLA) rely on "log-space" computations that require all values to be positive. Extending these specific kernels to handle negative values without a speed penalty remains a technical challenge.
  • State Normalization: The authors note that their change might be less effective for models that use heavy state normalization (like mLSTM), as negative values could cause the state norm to approach zero, leading to numerical instability.
  • The "Recall" Trade-off: The authors hypothesize there might be a fundamental trade-off between a model's ability to perform state-tracking (logic) and its ability to perform associative recall (memory). Exploring this balance is a suggested next step.

Summary updated

BibTeX
@inproceedings{grazzi2025unlocking,
  author = {Riccardo Grazzi and Julien Siems and Arber Zela and Jörg K.H. Franke and Frank Hutter and Massimiliano Pontil},
  title = {{Unlocking State-Tracking in Linear RNNs Through Negative Eigenvalues}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=UvTo3tVBk2},
}
Figure