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
This work addresses the state-tracking limitations of linear recurrent networks by extending the allowed eigenvalue range of state-transition matrices from [0,1] to [-1,1], enabling parity and broader regular-language recognition. It provides theoretical results showing that positive-eigenvalue LRNNs cannot solve parity and that non-diagonal structures and GH products expand expressivity, including sufficiency for any regular language under finite precision. Empirically, extending to negative eigenvalues improves parity and modular counting performance for Mamba and DeltaNet, and allows scalable pretraining up to 1.3B parameters with competitive language modeling and promising code/math task improvements, especially for DeltaNet. The findings highlight the critical role of non-diagonal state transitions in state-tracking and suggest a viable path for scaling LRNNs to long sequences and complex tasks without Transformer-style quadratic costs.
Abstract
Linear Recurrent Neural Networks (LRNNs) such as Mamba, RWKV, GLA, mLSTM, and DeltaNet have emerged as efficient alternatives to Transformers for long sequences. However, both Transformers and LRNNs struggle to perform state-tracking, which may impair performance in tasks such as code evaluation. In one forward pass, current architectures are unable to solve even parity, the simplest state-tracking task, which non-linear RNNs can handle effectively. Recently, Sarrof et al. (2024) demonstrated that the failure of LRNNs like Mamba to solve parity stems from restricting the value range of their diagonal state-transition matrices to $[0, 1]$ and that incorporating negative values can resolve this issue. We extend this result to non-diagonal LRNNs such as DeltaNet. We prove that finite precision LRNNs with state-transition matrices having only positive eigenvalues cannot solve parity, while non-triangular matrices are needed to count modulo $3$. Notably, we also prove that LRNNs can learn any regular language when their state-transition matrices are products of identity minus vector outer product matrices, each with eigenvalues in the range $[-1, 1]$. Our experiments confirm that extending the eigenvalue range of Mamba and DeltaNet to include negative values not only enables them to solve parity but consistently improves their performance on state-tracking tasks. We also show that state-tracking enabled LRNNs can be pretrained stably and efficiently at scale (1.3B parameters), achieving competitive performance on language modeling and showing promise on code and math tasks.
