M squared RNN: Non-Linear RNNs with Matrix-Valued States for Scalable Language Modeling
cs.LG, cs.AI
Submitted: 2026-03-15
Updated: 2026-10-16
Code: https://github.com/open-lm-engine/lm-engine
License: http://creativecommons.org/licenses/by/4.0/
The gist: Transformers are highly parallel but are limited to computations in the TC 0 complexity class, excluding tasks such as entity tracking and code execution that provably require greater expressive
Terminology
Abstract
Transformers are highly parallel but are limited to computations in the TC 0 complexity class, excluding tasks such as entity tracking and code execution that provably require greater expressive power. Motivated by this limitation, we revisit non-linear Recurrent Neural Networks (RNNs) for language modeling and introduce Matrix-to-Matrix RNN (M squared RNN): an architecture with matrix-valued hidden states and expressive non-linear state transitions. We demonstrate that the language modeling performance of non-linear RNNs is limited by their state size, and show how the state size expansion mechanism enables efficient use of tensor cores. Empirically, M squared RNN achieves perfect state tracking generalization at sequence lengths not seen during training. These benefits also translate to large-scale language modeling. In hybrid settings that interleave recurrent layers with attention, Hybrid M squared RNN outperforms equivalent Gated DeltaNet hybrids by 0.4 - 0.5 perplexity points on a 7B MoE model, while using 3 times smaller state sizes for the recurrent layers. Notably, replacing even a single recurrent layer with M squared RNN in an existing hybrid architecture yields accuracy gains comparable to Hybrid M squared RNN with minimal impact on training throughput. Further, the Hybrid Gated DeltaNet models with a single M squared RNN layer also achieve superior long-context generalization, outperforming state-of-the-art hybrid linear attention architectures by up to 8 points on LongBench. Together, these results establish non-linear RNN layers as a compelling building block for efficient and scalable language models.
Sources
- Ladder-residual: parallelism-aware architecture for accelerating large model inference with communication overlapping
- PIQA: Reasoning about Physical Commonsense in Natural Language
- NVIDIA Nemotron 3: Efficient and Open Intelligence
- On the Properties of Neural Machine Translation: Encoder-Decoder Approaches
- Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
- Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling
- BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questions
- Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge
- ParaRNN: Unlocking Parallel Training of Nonlinear RNNs for Large Language Models
- FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Hungry Hungry Hippos: Towards Language Modeling with State Space Models
- The Llama 3 Herd of Models
- Unlocking State-Tracking in Linear RNNs Through Negative Eigenvalues
- Efficiently Modeling Long Sequences with Structured State Spaces
- SonicMoE: Accelerating MoE with IO and Tile-aware Optimizations
- Gaussian Error Linear Units (GELUs)
- RULER: What's the Real Context Size of Your Long-Context Language Models?
- A Study of BFLOAT16 for Deep Learning Training
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks