Can Transformers Learn to Solve Problems Recursively?
Not on the map. Why?
Abstract (arXiv)
Neural networks have in recent years shown promise for helping software engineers write programs and even formally verify them. While semantic information plays a crucial part in these processes, it remains unclear to what degree popular neural architectures like transformers are capable of modeling that information. This paper examines the behavior of neural networks learning algorithms relevant to programs and formal verification proofs through the lens of mechanistic interpretability, focusing in particular on structural recursion. Structural recursion is at the heart of tasks on which symbolic tools currently outperform neural models, like inferring semantic relations between datatypes and emulating program behavior. We evaluate the ability of transformer models to learn to emulate the behavior of structurally recursive functions from input-output examples. Our evaluation includes empirical and conceptual analyses of the limitations and capabilities of transformer models in approximating these functions, as well as reconstructions of the ``shortcut" algorithms the model learns. By reconstructing these algorithms, we are able to correctly predict 91 percent of failure cases for one of the approximated functions. Our work provides a new foundation for understanding the behavior of neural networks that fail to solve the very tasks they are trained for.
Key facts. Cited by 17 papers in the map (data through 14 Oct 2026). Builds on 33 of its 47 references that are in the map. First posted on arXiv 24 May 2023.
Builds on
33 of 47 references.
References · 33
- 2017Attention Is All You Needcited by 60,361
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2022Locating and Editing Factual Associations in GPTcited by 2,691
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2020Transformer Feed-Forward Layers Are Key-Value Memoriescited by 1,336
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 886
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
- 2023StarCoder: may the source be with you!cited by 799
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 724
21 more
- 2018Universal Transformerscited by 647
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2022Neural Networks and the Chomsky Hierarchycited by 217
- 2023SantaCoder: don't reach for the stars!cited by 170
- 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 144
- 2022Practical Program Repair in the Era of Large Pre-trained Language Modelscited by 133
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2023Baldur: Whole-Proof Generation and Repair with Large Language Modelscited by 119
- 2019Learning to Prove Theorems via Interacting with Proof Assistantscited by 109
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2022Formal Algorithms for Transformerscited by 72
- 2021Inductive logic programming at 30cited by 47
- 2019Generating Correctness Proofs with Neural Networkscited by 37
- 2021Pointer Value Retrieval: A new benchmark for understanding the limits of neural network generalizationcited by 29
- 2022Passport: Improving Automated Formal Verification Using Identifierscited by 19
- 2021Elixir: Effective object-oriented program repaircited by 16
- 2020Proof Repair across Type Equivalencescited by 8
- 2018Evolving Algebras 1993: Lipari Guidecited by 2
- 2018Synthesizing Symmetric Lensescited by 2
Built on by
Citing papers per year: 2023: 6; 2024: 4; 2025: 7.
17 papers.
Sort:
By area:
- 2023Llemma: An Open Language Model For Mathematicscited by 388
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 149
- 2023Explainable Artificial Intelligence (XAI) 2.0: A Manifesto of Open Challenges and Interdisciplinary Research Directionscited by 125
- 2024MegaAgent: A Large-Scale Autonomous LLM-based Multi-Agent System Without Predefined SOPscited by 47
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 25
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2023Grokking Group Multiplication with Cosetscited by 24
- 2023Structured World Representations in Maze-Solving Transformerscited by 16
- 2025Can Compressed LLMs Truly Act? An Empirical Evaluation of Agentic Capabilities in LLM Compressioncited by 16
- 2024Code Simulation Challenges for Large Language Modelscited by 15
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Modelscited by 7
5 more
- 2025Learning the symmetric group: large from smallcited by 3
- 2025Structured Transformations for Stable and Interpretable Neural Computationcited by 2
- 2025Learning Model Successorscited by 0
- 2025Higher Embedding Dimension Creates a Stronger World Model for a Simple Sorting Taskcited by 0
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Taskscited by 0
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks2 Dec 2025
- 2025Higher Embedding Dimension Creates a Stronger World Model for a Simple Sorting Task21 Oct 2025
- 2025Structured Transformations for Stable and Interpretable Neural Computation31 Jul 2025
- 2025Can Compressed LLMs Truly Act? An Empirical Evaluation of Agentic Capabilities in LLM Compression26 May 2025
- 2025Learning the symmetric group: large from small18 Feb 2025
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models5 Feb 2025
- 2025Learning Model Successors31 Jan 2025
- 2024MegaAgent: A Large-Scale Autonomous LLM-based Multi-Agent System Without Predefined SOPs19 Aug 2024
- 2024Language Models Need Inductive Biases to Count Inductively30 May 2024
- 2024Code Simulation Challenges for Large Language Models17 Jan 2024
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution5 Jan 2024
- 2023Grokking Group Multiplication with Cosets11 Dec 2023
5 more
- 2023Structured World Representations in Maze-Solving Transformers5 Dec 2023
- 2023Looped Transformers are Better at Learning Learning Algorithms21 Nov 2023
- 2023Explainable Artificial Intelligence (XAI) 2.0: A Manifesto of Open Challenges and Interdisciplinary Research Directions30 Oct 2023
- 2023Llemma: An Open Language Model For Mathematics16 Oct 2023
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Models31 Aug 2023
- 2023Llemma: An Open Language Model For Mathematicscited by 388
- 2023Llemma: An Open Language Model For Mathematics16 Oct 2023
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 149
- 2023Explainable Artificial Intelligence (XAI) 2.0: A Manifesto of Open Challenges and Interdisciplinary Research Directionscited by 125
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 25
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2023Grokking Group Multiplication with Cosetscited by 24
- 2023Structured World Representations in Maze-Solving Transformerscited by 16
- 2024Code Simulation Challenges for Large Language Modelscited by 15
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Modelscited by 7
- 2025Learning the symmetric group: large from smallcited by 3
- 2025Structured Transformations for Stable and Interpretable Neural Computationcited by 2
- 2025Learning Model Successorscited by 0
12 most cited of 13 All 13 (JSON)
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks2 Dec 2025
- 2025Structured Transformations for Stable and Interpretable Neural Computation31 Jul 2025
- 2025Learning the symmetric group: large from small18 Feb 2025
- 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models5 Feb 2025
- 2025Learning Model Successors31 Jan 2025
- 2024Language Models Need Inductive Biases to Count Inductively30 May 2024
- 2024Code Simulation Challenges for Large Language Models17 Jan 2024
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution5 Jan 2024
- 2023Grokking Group Multiplication with Cosets11 Dec 2023
- 2023Structured World Representations in Maze-Solving Transformers5 Dec 2023
- 2023Looped Transformers are Better at Learning Learning Algorithms21 Nov 2023
- 2023Explainable Artificial Intelligence (XAI) 2.0: A Manifesto of Open Challenges and Interdisciplinary Research Directions30 Oct 2023
12 newest of 13 All 13 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2026Discovering Interpretable Algorithms by Decompiling Transformers to RASP
- 2024Interpreting Affine Recurrence Learning in GPT-style Transformers
- 2026Towards Verifiable Transformers: Solver-Checkable Circuit Explanations
- 2024Validating Mechanistic Interpretations: An Axiomatic Approach
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)
- 2024Circuit Compositions: Exploring Modular Structures in Transformer-Based Language Models
- 2023Learning Transformer Programs
- 2026Neuro-Symbolic Proof Generation for Scaling Systems Software Verification