RNNs can generate bounded hierarchical languages with optimal memory
John Hewitt, Michael Hahn, Surya Ganguli, Percy Liang, Christopher D. Manning
Abstract
Recurrent neural networks empirically generate natural language with high syntactic fidelity. However, their success is not wellunderstood theoretically. We provide theoretical insight into this success, proving in a finiteprecision setting that RNNs can efficiently generate bounded hierarchical languages that reflect the scaffolding of natural language syntax. We introduce Dyck-(k,m), the language of well-nested brackets (of k types) and mbounded nesting depth, reflecting the bounded memory needs and long-distance dependencies of natural language syntax. The best known results use O(k m 2 ) memory (hidden units) to generate these languages. We prove that an RNN with O(m log k) hidden units suffices, an exponential reduction in memory, by an explicit construction. Finally, we show that no algorithm, even with unbounded computation, can suffice with o(m log k) hidden units.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
36 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- How Do Transformers Learn Topic Structure: Towards a Mechanistic Understanding cites Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformers
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites Thinking Like Transformers
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformers
Cited by top-tier papers36
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
- Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 citations
- Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with TransformersColin Wei, Yining Chen, Tengyu MaNeurIPS 2022 · 117 citations
- In-Context Language Learning: Architectures and AlgorithmsEkin Akyürek, Bailin Wang, Yoon Kim, Jacob AndreasICML 2024 · 91 citations
- How Do Transformers Learn Topic Structure: Towards a Mechanistic UnderstandingYuchen Li, Yuanzhi Li, Andrej RisteskiICML 2023 · 87 citations
Related papers
- Self-Attention Networks Can Process Bounded Hierarchical LanguagesShunyu Yao, Binghui Peng, Christos H. Papadimitriou, Karthik NarasimhanACL 2021
- On Efficiently Representing Regular Languages as RNNsAnej Svete, Robin Chan, Ryan CotterellACL Findings 2024 · 1 citation
- Separations in the Representational Capabilities of Transformers and Recurrent ArchitecturesSatwik Bhattamishra, Michael Hahn, Phil Blunsom, Varun KanadeNeurIPS 2024 · 36 citations
- Provable Long-Range Benefits of Next-Token PredictionXinyuan Cao, Santosh S. VempalaSTOC 2026
- Recurrent Neural Language Models as Probabilistic Finite-state AutomataAnej Svete, Ryan CotterellEMNLP 2023 · 1 citation
