Transformer-Based Models Are Not Yet Perfect At Learning to Emulate Structural Recursion
Not on the map. Why?
Abstract (arXiv)
This paper investigates the ability of transformer-based models to learn structural recursion from examples. Recursion is a universal concept in both natural and formal languages. Structural recursion is central to the programming language and formal mathematics tasks where symbolic tools currently excel beyond neural models, such as inferring semantic relations between datatypes and emulating program behavior. We introduce a general framework that nicely connects the abstract concepts of structural recursion in the programming language domain to concrete sequence modeling problems and learned models' behavior. The framework includes a representation that captures the general textitsyntax of structural recursion, coupled with two different frameworks for understanding their textitsemantics -- one that is more natural from a programming languages perspective and one that helps bridge that perspective with a mechanistic understanding of the underlying transformer architecture. With our framework as a powerful conceptual tool, we identify different issues under various set-ups. The models trained to emulate recursive computations cannot fully capture the recursion yet instead fit short-cut algorithms and thus cannot solve certain edge cases that are under-represented in the training distribution. In addition, it is difficult for state-of-the-art large language models (LLMs) to mine recursive rules from in-context demonstrations. Meanwhile, these LLMs fail in interesting ways when emulating reduction (step-wise computation) of the recursive function.
Key facts. Cited by 14 papers in the map (data through 7 Oct 2026). Builds on 53 of its 91 references that are in the map. First posted on arXiv 23 Jan 2024.
Builds on
53 of 91 references.
References · 53
- 2017Attention Is All You Needcited by 59,932
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020Transformer Feed-Forward Layers Are Key-Value Memoriescited by 1,307
- 2022LaMDA: Language Models for Dialog Applicationscited by 1,218
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,116
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
38 more
- 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 831
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2021ByT5: Towards a token-free future with pre-trained byte-to-byte modelscited by 504
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2020Generative Language Modeling for Automated Theorem Provingcited by 379
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 241
- 2023Automatically Correcting Large Language Models: Surveying the landscape of diverse self-correction strategiescited by 236
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 141
- 2022Practical Program Repair in the Era of Large Pre-trained Language Modelscited by 133
- 2019Learning to Prove Theorems via Interacting with Proof Assistantscited by 107
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 105
- 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
- 2022On the Paradox of Learning to Reason from Datacited by 93
- 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
- 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 53
- 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
- 2021Inductive logic programming at 30cited by 46
- 2019Generating Correctness Proofs with Neural Networkscited by 36
- 2023Code Execution with Pre-trained Language Modelscited by 33
- 2021Pointer Value Retrieval: A new benchmark for understanding the limits of neural network generalizationcited by 29
- 2023TRACED: Execution-aware Pre-training for Source Codecited by 27
- 2022Passport: Improving Automated Formal Verification Using Identifierscited by 19
- 2021Elixir: Effective object-oriented program repaircited by 16
- 2021Effective Attention Sheds Light On Interpretabilitycited by 11
50 most cited of 53 All 53 (JSON)
Built on by
Citing papers per year: 2024: 3; 2025: 9; 2026: 2.
14 papers.
Sort:
By area:
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 49
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checkingcited by 23
- 2024Can Transformers Do Enumerative Geometry?cited by 8
- 2025An explainable transformer circuit for compositional generalizationcited by 8
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Modelscited by 6
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Modelscited by 6
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Predictioncited by 6
- 2025Optimizing Multi-Hop Document Retrieval Through Intermediate Representationscited by 5
- 2025Fodor and Pylyshyn's Legacy: Still No Human-like Systematic Compositionality in Neural Networkscited by 3
- 2025Emergent Stack Representations in Modeling Counter Languages Using Transformerscited by 2
- 2025Sigma: The Key for Vision-Language-Action Models toward Telepathic Alignmentcited by 1
2 more
- 2026Training Transformers as a Universal Computercited by 1
- 2026Unveiling the Visual Counting Bottleneck in Vision-Language Modelscited by 1
- 2026Unveiling the Visual Counting Bottleneck in Vision-Language Models28 May 2026
- 2026Training Transformers as a Universal Computer28 Apr 2026
- 2025Sigma: The Key for Vision-Language-Action Models toward Telepathic Alignment30 Nov 2025
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Prediction27 Sep 2025
- 2025Fodor and Pylyshyn's Legacy: Still No Human-like Systematic Compositionality in Neural Networks2 Jun 2025
- 2025Optimizing Multi-Hop Document Retrieval Through Intermediate Representations2 Mar 2025
- 2025An explainable transformer circuit for compositional generalization19 Feb 2025
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking18 Feb 2025
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models5 Feb 2025
- 2025Emergent Stack Representations in Modeling Counter Languages Using Transformers3 Feb 2025
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Models30 Jan 2025
- 2024Can Transformers Do Enumerative Geometry?27 Aug 2024
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checkingcited by 23
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Modelscited by 6
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking18 Feb 2025
- 2025A Tool for In-depth Analysis of Code Execution Reasoning of Large Language Models30 Jan 2025
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics7 May 2024
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 49
- 2024Can Transformers Do Enumerative Geometry?cited by 8
- 2025An explainable transformer circuit for compositional generalizationcited by 8
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Modelscited by 6
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Predictioncited by 6
- 2025Fodor and Pylyshyn's Legacy: Still No Human-like Systematic Compositionality in Neural Networkscited by 3
- 2025Emergent Stack Representations in Modeling Counter Languages Using Transformerscited by 2
- 2026Training Transformers as a Universal Computercited by 1
- 2026Training Transformers as a Universal Computer28 Apr 2026
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Prediction27 Sep 2025
- 2025Fodor and Pylyshyn's Legacy: Still No Human-like Systematic Compositionality in Neural Networks2 Jun 2025
- 2025An explainable transformer circuit for compositional generalization19 Feb 2025
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models5 Feb 2025
- 2025Emergent Stack Representations in Modeling Counter Languages Using Transformers3 Feb 2025
- 2024Can Transformers Do Enumerative Geometry?27 Aug 2024
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Task19 Feb 2024