Transformers Provably Learn Graph Search: Training Dynamics and the Exponential Power of Depth
On the map: LLM reasoning → Test-time compute and efficient thinking also fits: Knowledge- and tool-augmented reasoning
Abstract (arXiv)
Large Language Models (LLMs) have achieved remarkable progress on complex reasoning tasks, yet the mechanisms by which they acquire reasoning capabilities and the efficiency of their reasoning remain poorly understood. In this paper, we investigate the path-finding problem over directed graphs, a symbolic abstraction of multi-step reasoning. We first characterize the architectural requirements for this task, proving that one-layer transformers require Omega(N2) size on dense graphs to implement the key DFS child-selection primitive. While a two-layer transformer implements full DFS with O(Nlog(N)) size. Thus, a second layer is necessary and sufficient for near-linear DFS reasoning. We then extend this expressivity analysis to deeper models: for every k≥3, a k-layer transformer implements a bounded-reachability DFS policy with look-ahead horizon 1+2k-3, establishing an exponential increase in reachability horizon with depth. Finally, going beyond expressivity, given appropriately curated training data, we show that two-layer transformers can provably learn to execute DFS via gradient flow and generalize to unseen graphs. Together, our results provide a mechanistic account of how transformers implement graph search, how depth expands bounded look-ahead, and how such reasoning algorithms can emerge through training.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Test-time compute and efficient thinking, one of 17 directions in LLM reasoning. Builds on 18 of its 45 references that are in the map. Submitted 10 Nov 2026.
Builds on
18 of 45 references.
References · 18
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,810
- 2022In-context Learning and Induction Headscited by 1,085
- 2024LLMs Can't Plan, But Can Help Planning in LLM-Modulo Frameworkscited by 193
- 2024Beyond A*: Better Planning with Transformers via Search Dynamics Bootstrappingcited by 101
- 2023GPT-4 Doesn't Know It's Wrong: An Analysis of Iterative Prompting for Reasoning Problemscited by 96
- 2024Transformers, parallel computation, and logarithmic depthcited by 92
- 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thoughtcited by 84
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 55
- 2024One-layer transformers fail to solve the induction heads taskcited by 36
- 2023Average-Hard Attention Transformers are Constant-Depth Uniform Threshold Circuitscited by 31
- 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 28
- 2024Transformers Struggle to Learn to Searchcited by 26
6 more
- 2025Exact Expressive Power of Transformers with Paddingcited by 22
- 2025Emergence of Superposition: Unveiling the Training Dynamics of Chain of Continuous Thoughtcited by 19
- 2025Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformerscited by 13
- 2024The Mystery of the Pathological Path-star Task for Language Modelscited by 9
- 2025Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descentcited by 9
- 2026Transformers Provably Learn to Internalize Chain-of-Thoughtcited by 5
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers
- 2024Understanding Transformer Reasoning Capabilities via Graph Algorithms
- 2026Unrolled Flow Models for Reasoning
- 2024Transformers Provably Solve Parity Efficiently with Chain of Thought
- 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization
- 2026How Transformers Learn to Plan via Multi-Token Prediction
- 2024Towards an Understanding of Stepwise Inference in Transformers: A Synthetic Graph Navigation Model
- 2025Toward a Graph Foundation Model: Pre-Training Transformers With Random Walks