Advancing Regular Language Reasoning in Linear Recurrent Neural Networks
Ting-Han Fan, Ta-Chung Chi, Alexander I. Rudnicky
TL;DR
The paper investigates whether linear recurrent neural networks can learn regular-language rules through length extrapolation, revealing that many LRNNs lack the expressiveness to model arithmetic operations like subtraction. It introduces a block-diagonal, input-dependent LRNN with norm-constrained transitions and an efficient Parallel Scan implementation, enabling true extrapolation on regular-language tasks Sum($M$), EvenPair($M$), and ModArith($M$). Empirical results show this architecture uniquely achieves length extrapolation where baselines fail, highlighting the importance of input-dependent transitions and stabilized expressiveness. The work advances LRNN design for rule-learning in long-range sequence modeling and provides a practical, parallelizable approach with publicly released code.
Abstract
In recent studies, linear recurrent neural networks (LRNNs) have achieved Transformer-level performance in natural language and long-range modeling, while offering rapid parallel training and constant inference cost. With the resurgence of interest in LRNNs, we study whether they can learn the hidden rules in training sequences, such as the grammatical structures of regular language. We theoretically analyze some existing LRNNs and discover their limitations in modeling regular language. Motivated by this analysis, we propose a new LRNN equipped with a block-diagonal and input-dependent transition matrix. Experiments suggest that the proposed model is the only LRNN capable of performing length extrapolation on regular language tasks such as Sum, Even Pair, and Modular Arithmetic. The code is released at \url{https://github.com/tinghanf/RegluarLRNN}.
