Unlocking State-Tracking in Linear RNNs Through Negative Eigenvalues

Riccardo Grazzi, Julien Siems, Arber Zela, Jörg K. H. Franke, Frank Hutter, Massimiliano Pontil · DOI · OpenReview

TL;DR

Linear Recurrent Neural Networks (LRNNs) like Mamba and DeltaNet, while efficient for long sequences, struggle with state-tracking tasks. This paper shows that by allowing negative eigenvalues in their state-transition matrices (extending the range from [0, 1] to [-1, 1]), these models can effectively learn tasks like parity and modular arithmetic, significantly improving their state-tracking capabilities without compromising efficiency.

What Problem Does This Paper Address?

Transformers have revolutionized NLP, but their quadratic complexity with sequence length makes them inefficient for very long sequences. Linear Recurrent Neural Networks (LRNNs) have emerged as promising alternatives, offering linear scaling. However, a key limitation shared by both Transformers and current LRNNs is their difficulty in "state-tracking" – essentially, remembering and updating information over long sequences. This is crucial for tasks like understanding nested code structures or reasoning about narratives. Even simple tasks like determining the parity (even or odd number) of a sequence of bits are challenging for these models. Previous work suggested that this failure in LRNNs stems from their state-transition matrices having only positive eigenvalues. This paper investigates whether extending this eigenvalue range to include negative values can unlock better state-tracking capabilities in LRNNs, particularly for non-diagonal architectures like DeltaNet.

Methods

The core of this paper's contribution lies in its theoretical analysis and experimental validation of extending the eigenvalue range of state-transition matrices in LRNNs.

  • Theoretical Analysis: The authors prove that LRNNs with only positive real eigenvalues in their state-transition matrices cannot solve parity for arbitrary sequence lengths. They further demonstrate that non-triangular matrices are also necessary for more complex tasks like modular counting. A key theoretical result is that LRNNs with state-transition matrices formed by products of generalized Householder (GH) matrices, where eigenvalues are in the range [-1, 1], can learn any regular language.
  • Modification of LRNNs: The paper proposes a simple modification to existing LRNN architectures (like Mamba and DeltaNet) by extending the eigenvalue range of their state-transition matrices from [0, 1] to [-1, 1]. This is achieved by adjusting the learnable parameters within the matrix computations. For diagonal LRNNs, this involves transforming s(x) to 2s(x)-1, and for GH matrices, it's I - 2φ(x)v(x)v(x)ᵀ. This modification is computationally inexpensive.
  • Experimental Setup: The authors train modified versions of Mamba and DeltaNet, comparing them against their original counterparts and other baselines (Transformer, mLSTM, sLSTM). Experiments cover formal language tasks (parity, modular arithmetic), state-tracking on group word problems (S5 group), and large-scale language modeling.

Datasets

The paper uses several datasets for evaluation:

  • Formal Language Tasks: Parity, Modular Arithmetic (with and without brackets). These are standard benchmarks for evaluating the expressivity of sequence models.
  • State-Tracking Tasks: S5 group word problem, and Z60 cyclic group. These are derived from existing work on evaluating LRNNs and Transformers on group theory problems.
  • Language Modeling Tasks: FineWeb-100B (for pre-training), and for evaluation: CodeParrot, Math-Hard, TriviaQA, and SlimPajama. These are standard datasets for evaluating language model performance, with a focus on tasks that might benefit from state-tracking (coding, math).

Key Insights and Ideas

  • Negative Eigenvalues are Crucial for State-Tracking: The most significant insight is that the inability of current LRNNs to solve simple state-tracking tasks like parity is directly linked to their state-transition matrices being restricted to positive eigenvalues. Allowing negative eigenvalues fundamentally unlocks this capability.
  • Non-Diagonal Matrices Enhance Expressivity: While extending the eigenvalue range helps diagonal LRNNs like Mamba, non-diagonal architectures like DeltaNet, which inherently allow for more complex interactions (token-channel mixing), benefit even more significantly from this modification, especially on tasks beyond simple parity.
  • Minimal Change, Major Impact: The proposed modification is remarkably simple – just adjusting the range of eigenvalues – yet it leads to substantial improvements in state-tracking performance without increasing computational cost or compromising training stability.
  • Regular Language Recognition: The theoretical work establishes that LRNNs with GH matrices and eigenvalues in [-1, 1] can learn any regular language, a powerful result for understanding their expressive power.

Key Results

  • Parity Solved: Modified Mamba and DeltaNet models achieve perfect accuracy on the parity task, whereas their original counterparts performed poorly.
  • Modular Arithmetic Improvement: DeltaNet with the extended eigenvalue range showed substantial performance gains on modular arithmetic tasks, achieving accuracies of 0.971 and 0.260 (compared to 0.314 and 0.194 for the original). Mamba also saw improvements.
  • State-Tracking on S5: DeltaNet [-1,1] with just one layer could learn the S5 task when inputs were restricted to swaps, demonstrating the power of the extended range. With more complex inputs, performance still improved compared to the [0,1] baseline.
  • Language Modeling: Pre-trained models with the extended eigenvalue range showed comparable, and in some cases slightly better, performance on language modeling tasks, particularly on coding and math datasets, suggesting that improved state-tracking can benefit these areas. For example, DeltaNet [-1,1] achieved lower perplexity on coding and math datasets.
  • Scalability: The modified models were trained stably at scale (up to 1.3B parameters).

Limitations and Future Work

  • Compatibility with Log-Space Computations: The modification is not directly compatible with numerical techniques used by some diagonal LRNNs (like Mamba2, GLA, mLSTM) that rely on positive state-transition matrices for stable log-space computations. Future work could explore ways to adapt these methods.
  • Normalization in RNNs: The modification might be less suited for methods using normalized RNN states (like mLSTM), as normalization terms could become close to zero with negative values.
  • Theoretical Expressivity of DeltaNet: The full theoretical expressivity of DeltaNet [-1,1] with multiple layers for various word problems remains an open question.
  • Hybrid Model Design: The authors suggest investigating the trade-off between state-tracking and associative recall, which could guide the design of future hybrid models.
  • Understanding Downsides of Increased Expressivity: Further research is needed to understand potential downsides of increased expressivity, such as potential for overfitting or other unforeseen issues.

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