mlsanityData to 14 Oct 2026

Training Neural Networks as Recognizers of Formal Languages

arXiv 2411.07107 ↗First posted 11 Nov 2024cs.CL cs.LGcited by 24

On the map: LLM reasoning → Reasoning benchmarks and evaluation

Abstract (arXiv)

Characterizing the computational power of neural network architectures in terms of formal language theory remains a crucial line of research, as it describes lower and upper bounds on the reasoning capabilities of modern AI. However, when empirically testing these bounds, existing work often leaves a discrepancy between experiments and the formal claims they are meant to support. The problem is that formal language theory pertains specifically to recognizers: machines that receive a string as input and classify whether it belongs to a language. On the other hand, it is common instead to evaluate language models on proxy tasks, e.g., language modeling or sequence-to-sequence transduction, that are similar in only an informal sense to the underlying theory. We correct this mismatch by training and evaluating neural networks directly as binary classifiers of strings, using a general method that can be applied to a wide variety of languages. As part of this, we extend an algorithm recently proposed by Snaebjarnarson et al. (2025) for efficient length-controlled sampling of strings from regular languages. We provide results on a variety of languages across the Chomsky hierarchy for three neural architectures: a simple RNN, an LSTM, and a causally-masked transformer. We find that the RNN and LSTM often outperform the transformer, and that auxiliary training objectives such as language modeling can help, although no single objective uniformly improves performance across languages and architectures. Our contributions will facilitate theoretically sound empirical testing of language recognition claims in future work. We have released our datasets as a benchmark called FLaRe (Formal Language Recognition), along with our code.

Key facts. Cited by 24 papers in the map (data through 14 Oct 2026). Placed in Reasoning benchmarks and evaluation, one of 17 directions in LLM reasoning. Builds on 38 of its 63 references that are in the map. First posted on arXiv 11 Nov 2024.

Builds on

38 of 63 references.

References · 38

  1. 2017Attention Is All You Needcited by 60,361
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  3. 2019Learning Deep Transformer Models for Machine Translationcited by 309
  4. 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
  5. 2022Transformers Learn Shortcuts to Automatacited by 268
  6. 2022Neural Networks and the Chomsky Hierarchycited by 217
  7. 2019Transformers without Tears: Improving the Normalization of Self-Attentioncited by 153
  8. 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
  9. 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 139
  10. 2023What Formal Languages Can Transformers Express? A Surveycited by 124
  11. 2018On the Practical Computational Power of Finite Precision RNNs for Language Recognitioncited by 117
  12. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
26 more
  1. 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
  2. 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
  3. 2024In-Context Language Learning: Architectures and Algorithmscited by 89
  4. 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
  5. 2024Why are Sensitive Functions Hard for Transformers?cited by 74
  6. 2022Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functionscited by 70
  7. 2017Extracting Automata from Recurrent Neural Networks Using Queries and Counterexamplescited by 66
  8. 2020A Formal Hierarchy of RNN Architecturescited by 62
  9. 2020RNNs can generate bounded hierarchical languages with optimal memorycited by 59
  10. 2019Sequential Neural Networks as Automatacited by 54
  11. 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
  12. 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 49
  13. 2019LSTM Networks Can Perform Dynamic Countingcited by 45
  14. 2022A Measure-Theoretic Characterization of Tight Language Modelscited by 33
  15. 2019Memory-Augmented Recurrent Neural Networks Can Learn Generalized Dyck Languagescited by 31
  16. 2023Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarscited by 30
  17. 2024Separations in the Representational Capabilities of Transformers and Recurrent Architecturescited by 29
  18. 2023Average-Hard Attention Transformers are Constant-Depth Uniform Threshold Circuitscited by 26
  19. 2020On the Practical Ability of Recurrent Neural Networks to Recognize Hierarchical Languagescited by 22
  20. 2024What Languages are Easy to Language-Model? A Perspective from Learning Probabilistic Regular Languagescited by 20
  21. 2018On Evaluating the Generalization of LSTM Models in Formal Languagescited by 17
  22. 2023Stack Attention: Improving the Ability of Transformers to Model Hierarchical Patternscited by 17
  23. 2021Learning Hierarchical Structures with Differentiable Nondeterministic Stackscited by 16
  24. 2020Learning Context-Free Languages with Nondeterministic Stack RNNscited by 15
  25. 2023MLRegTest: A Benchmark for the Machine Learning of Regular Languagescited by 7
  26. 2022The Surprising Computational Power of Nondeterministic Stack RNNscited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 14; 2026: 10.

24 papers.

Sort:

By area:

  1. 2025Between Circuits and Chomsky: Pre-pretraining on Formal Languages Imparts Linguistic Biasescited by 37
  2. 2025Lower Bounds for Chain-of-Thought Reasoning in Hard-Attention Transformerscited by 28
  3. 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
  4. 2025Information Locality as an Inductive Bias for Neural Language Modelscited by 14
  5. 2026Learning State-Tracking from Code Using Linear RNNscited by 6
  6. 2025Rethinking Addressing in Language Models via Contexualized Equivariant Positional Encodingcited by 4
  7. 2026Context-Free Recognition with Transformerscited by 4
  8. 2026Characterizing the Expressivity of Local Attention in Transformerscited by 3
  9. 2025PBEBench: A Multi-Step Programming by Examples Reasoning Benchmark inspired by Historical Linguisticscited by 2
  10. 2025A Constructive Framework for Nondeterministic Automata via Time-Shared, Depth-Unrolled Feedforward Networkscited by 2
  11. 2025Is In-Context Learning Learning?cited by 2
  12. 2025Probability Distributions Computed by Autoregressive Transformerscited by 2
12 more
  1. 2025Randomly Sampled Language Reasoning Problems Elucidate Limitations of In-Context Learningcited by 1
  2. 2025RNN Generalization to Omega-Regular Languagescited by 1
  3. 2025Symbolic Feedforward Networks for Probabilistic Finite Automata: Exact Simulation and Learnabilitycited by 1
  4. 2025Bearing Syntactic Fruit with Stack-Augmented Neural Networkscited by 1
  5. 2026Length Generalization with Log-Depth Recurrent Unitscited by 1
  6. 2026Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don'tcited by 1
  7. 2026Understanding the Parameter Space Geometry of Transformers Encoding Boolean Functionscited by 1
  8. 2025Prompting Robot Teams with Natural Languagecited by 0
  9. 2026Evaluating the Formal Reasoning Capabilities of Large Language Models through Chomsky Hierarchycited by 0
  10. 2026Causally Evaluating the Learnability of Formal Language Taskscited by 0
  11. 2026Length Generalization for Transformers via Compressioncited by 0
  12. 2026Training Dynamics of Transformers on Unbounded Inputs: Attention Learning Can Lag Output Layer Learningcited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024On the Representational Capacity of Neural Language Models with Chain-of-Thought Reasoning
  2. 2026The Emergent Symbolic Structure of Artificial Neural Networks
  3. 2026Language Identification with Succinct Machine-Independent Traces
  4. 2025Emergent Symbolic Mechanisms Support Abstract Reasoning in Large Language Models
  5. 2022Neural-Symbolic Recursive Machine for Systematic Generalization
  6. 2024Circuit Compositions: Exploring Modular Structures in Transformer-Based Language Models
  7. 2024A Philosophical Introduction to Language Models -- Part I: Continuity With Classic Debates
  8. 2026An Algebraic View of the Expressivity of Recurrent Language Models