Simulation of Graph Algorithms with Looped Transformers
Not on the map. Why?
Abstract (arXiv)
The execution of graph algorithms using neural networks has recently attracted significant interest due to promising empirical progress. This motivates further understanding of how neural networks can replicate reasoning steps with relational data. In this work, we study the ability of transformer networks to simulate algorithms on graphs from a theoretical perspective. The architecture we use is a looped transformer with extra attention heads that interact with the graph. We prove by construction that this architecture can simulate individual algorithms such as Dijkstra's shortest path, Breadth- and Depth-First Search, and Kosaraju's strongly connected components, as well as multiple algorithms simultaneously. The number of parameters in the networks does not increase with the input graph size, which implies that the networks can simulate the above algorithms for any graph. Despite this property, we show a limit to simulation in our solution due to finite precision. Finally, we show a Turing Completeness result with constant width when the extra attention heads are utilized.
Key facts. Cited by 30 papers in the map (data through 14 Oct 2026). Builds on 34 of its 44 references that are in the map. First posted on arXiv 2 Feb 2024.
Builds on
34 of 44 references.
References · 34
- 2017Attention Is All You Needcited by 60,361
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2016Semi-Supervised Classification with Graph Convolutional Networkscited by 11,361
- 2017Graph Attention Networkscited by 8,923
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2021Transformers in Vision: A Surveycited by 1,013
- 2023Scaling Vision Transformers to 22 Billion Parameterscited by 694
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2014Neural Turing Machinescited by 644
- 2021Combinatorial optimization and reasoning with graph neural networkscited by 268
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2020Sparse Sinkhorn Attentioncited by 251
22 more
- 2021Incorporating Convolution Designs into Visual Transformerscited by 248
- 2023Looped Transformers as Programmable Computerscited by 237
- 2019What graph neural networks cannot learn: depth vs widthcited by 201
- 2019What Can Neural Networks Reason About?cited by 159
- 2023Teaching Arithmetic to Small Transformerscited by 123
- 2015Neural GPUs Learn Algorithmscited by 121
- 2019Neural Execution of Graph Algorithmscited by 121
- 2022The CLRS Algorithmic Reasoning Benchmarkcited by 106
- 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 104
- 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 102
- 2015Neural Programmer-Interpreterscited by 101
- 2021Neural Algorithmic Reasoningcited by 94
- 2022A Generalist Neural Algorithmic Learnercited by 59
- 2022Graph Neural Networks are Dynamic Programmerscited by 55
- 2022Relational Attention: Generalizing Transformers for Graph-Structured Taskscited by 41
- 2023Learning Transformer Programscited by 41
- 2020Neural Execution Engines: Learning to Execute Subroutinescited by 36
- 2023Neural Algorithmic Reasoning with Causal Regularisationcited by 31
- 2023Dual Algorithmic Reasoningcited by 21
- 2023Neural Algorithmic Reasoning for Combinatorial Optimisationcited by 19
- 2023Neural Algorithmic Reasoning Without Intermediate Supervisioncited by 17
- 2023Parallel Algorithms Align with Neural Executioncited by 6
Built on by
Citing papers per year: 2024: 9; 2025: 10; 2026: 11.
30 papers.
Sort:
By area:
- 2025Reasoning with Latent Thoughts: On the Power of Looped Transformerscited by 240
- 2025A Survey on Latent Reasoningcited by 81
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
- 2026LoopFormer: Elastic-Depth Looped Transformers for Latent Reasoning via Shortcut Modulationcited by 61
- 2024On Expressive Power of Looped Transformers: Theoretical Analysis and Enhancement via Timestep Encodingcited by 36
- 2024How Do Large Language Models Understand Graph Patterns? A Benchmark for Graph Pattern Comprehensioncited by 30
- 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descentcited by 22
- 2025A Formal Comparison Between Chain of Thought and Latent Thoughtcited by 15
- 2026Training-Free Looped Transformerscited by 15
- 2024Revisiting Random Walks for Learning on Graphscited by 13
- 2024Revisiting the Graph Reasoning Ability of Large Language Models: Case Studies in Translation, Connectivity and Shortest Pathcited by 10
- 2024Discrete Neural Algorithmic Reasoningcited by 9
18 more
- 2025Primal-Dual Neural Algorithmic Reasoningcited by 9
- 2024Benchmarking ChatGPT on Algorithmic Reasoningcited by 8
- 2026Loop the Loopies!cited by 8
- 2025Towards High-Order Mean Flow Generative Models: Feasibility, Expressivity, and Provably Efficient Criteriacited by 5
- 2025Neural Algorithmic Reasoning for Hypergraphs with Looped Transformerscited by 4
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networkscited by 4
- 2025Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical Perspectivecited by 4
- 2026Chain-of-Thought and Compressed Looped Transformers: A Memory-Budget Separationcited by 2
- 2025Efficiently Learning Branching Networks for Multitask Algorithmic Reasoningcited by 1
- 2026Beyond Test-Time Memory: State-Space Optimal Control for LLM Reasoningcited by 1
- 2024Algorithm-Informed Graph Neural Networks for Leakage Detection and Localization in Water Distribution Networkscited by 0
- 2025Fundamental Limits of Crystalline Equivariant Graph Neural Networks: A Circuit Complexity Perspectivecited by 0
- 2026Beyond What Seems Necessary: Hidden Gains from Scaling Training-Time Reasoning Length under Outcome Supervisioncited by 0
- 2026Learning to Approximate Uniform Facility Location via Graph Neural Networkscited by 0
- 2026UltRAG: a Universal Simple Scalable Recipe for Knowledge Graph RAGcited by 0
- 2026Loom: A Scalable Analytical Neural Computer Architecturecited by 0
- 2026Position: The Turing-Completeness of Autoregressive Transformers Relies Heavily on Context Managementcited by 0
- 2026Learning to Extrapolate in Depth with Looped Transformerscited by 0
- 2026Learning to Extrapolate in Depth with Looped Transformers10 Oct 2026
- 2026Loop the Loopies!17 Jul 2026
- 2026Chain-of-Thought and Compressed Looped Transformers: A Memory-Budget Separation29 May 2026
- 2026Training-Free Looped Transformers22 May 2026
- 2026Position: The Turing-Completeness of Autoregressive Transformers Relies Heavily on Context Management19 May 2026
- 2026Loom: A Scalable Analytical Neural Computer Architecture9 Apr 2026
- 2026Beyond Test-Time Memory: State-Space Optimal Control for LLM Reasoning10 Mar 2026
- 2026Learning to Approximate Uniform Facility Location via Graph Neural Networks13 Feb 2026
- 2026LoopFormer: Elastic-Depth Looped Transformers for Latent Reasoning via Shortcut Modulation11 Feb 2026
- 2026Beyond What Seems Necessary: Hidden Gains from Scaling Training-Time Reasoning Length under Outcome Supervision31 Jan 2026
- 2026UltRAG: a Universal Simple Scalable Recipe for Knowledge Graph RAG28 Jan 2026
- 2025Efficiently Learning Branching Networks for Multitask Algorithmic Reasoning30 Nov 2025
18 more
- 2025Fundamental Limits of Crystalline Equivariant Graph Neural Networks: A Circuit Complexity Perspective7 Oct 2025
- 2025Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical Perspective26 Sep 2025
- 2025A Formal Comparison Between Chain of Thought and Latent Thought25 Sep 2025
- 2025Towards High-Order Mean Flow Generative Models: Feasibility, Expressivity, and Provably Efficient Criteria9 Aug 2025
- 2025A Survey on Latent Reasoning8 Jul 2025
- 2025Primal-Dual Neural Algorithmic Reasoning29 May 2025
- 2025Reasoning with Latent Thoughts: On the Power of Looped Transformers24 Feb 2025
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networks24 Feb 2025
- 2025Neural Algorithmic Reasoning for Hypergraphs with Looped Transformers18 Jan 2025
- 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descent15 Oct 2024
- 2024How Do Large Language Models Understand Graph Patterns? A Benchmark for Graph Pattern Comprehension4 Oct 2024
- 2024On Expressive Power of Looped Transformers: Theoretical Analysis and Enhancement via Timestep Encoding2 Oct 2024
- 2024Revisiting the Graph Reasoning Ability of Large Language Models: Case Studies in Translation, Connectivity and Shortest Path18 Aug 2024
- 2024Algorithm-Informed Graph Neural Networks for Leakage Detection and Localization in Water Distribution Networks5 Aug 2024
- 2024Revisiting Random Walks for Learning on Graphs1 Jul 2024
- 2024Transformers Can Do Arithmetic with the Right Embeddings27 May 2024
- 2024Benchmarking ChatGPT on Algorithmic Reasoning4 Apr 2024
- 2024Discrete Neural Algorithmic Reasoning18 Feb 2024
- 2025Reasoning with Latent Thoughts: On the Power of Looped Transformerscited by 240
- 2025A Survey on Latent Reasoningcited by 81
- 2026LoopFormer: Elastic-Depth Looped Transformers for Latent Reasoning via Shortcut Modulationcited by 61
- 2025A Formal Comparison Between Chain of Thought and Latent Thoughtcited by 15
- 2024Revisiting the Graph Reasoning Ability of Large Language Models: Case Studies in Translation, Connectivity and Shortest Pathcited by 10
- 2025Neural Algorithmic Reasoning for Hypergraphs with Looped Transformerscited by 4
- 2026Chain-of-Thought and Compressed Looped Transformers: A Memory-Budget Separationcited by 2
- 2025Efficiently Learning Branching Networks for Multitask Algorithmic Reasoningcited by 1
- 2026Beyond Test-Time Memory: State-Space Optimal Control for LLM Reasoningcited by 1
- 2026Beyond What Seems Necessary: Hidden Gains from Scaling Training-Time Reasoning Length under Outcome Supervisioncited by 0
- 2026Chain-of-Thought and Compressed Looped Transformers: A Memory-Budget Separation29 May 2026
- 2026Beyond Test-Time Memory: State-Space Optimal Control for LLM Reasoning10 Mar 2026
- 2026LoopFormer: Elastic-Depth Looped Transformers for Latent Reasoning via Shortcut Modulation11 Feb 2026
- 2026Beyond What Seems Necessary: Hidden Gains from Scaling Training-Time Reasoning Length under Outcome Supervision31 Jan 2026
- 2025Efficiently Learning Branching Networks for Multitask Algorithmic Reasoning30 Nov 2025
- 2025A Formal Comparison Between Chain of Thought and Latent Thought25 Sep 2025
- 2025A Survey on Latent Reasoning8 Jul 2025
- 2025Reasoning with Latent Thoughts: On the Power of Looped Transformers24 Feb 2025
- 2025Neural Algorithmic Reasoning for Hypergraphs with Looped Transformers18 Jan 2025
- 2024Revisiting the Graph Reasoning Ability of Large Language Models: Case Studies in Translation, Connectivity and Shortest Path18 Aug 2024
- 2026Training-Free Looped Transformerscited by 15
- 2026Loop the Loopies!cited by 8
- 2026Loop the Loopies!17 Jul 2026
- 2026Training-Free Looped Transformers22 May 2026
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
- 2024On Expressive Power of Looped Transformers: Theoretical Analysis and Enhancement via Timestep Encodingcited by 36
- 2024How Do Large Language Models Understand Graph Patterns? A Benchmark for Graph Pattern Comprehensioncited by 30
- 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descentcited by 22
- 2024Revisiting Random Walks for Learning on Graphscited by 13
- 2024Discrete Neural Algorithmic Reasoningcited by 9
- 2025Primal-Dual Neural Algorithmic Reasoningcited by 9
- 2024Benchmarking ChatGPT on Algorithmic Reasoningcited by 8
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networkscited by 4
- 2025Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical Perspectivecited by 4
- 2024Algorithm-Informed Graph Neural Networks for Leakage Detection and Localization in Water Distribution Networkscited by 0
- 2025Fundamental Limits of Crystalline Equivariant Graph Neural Networks: A Circuit Complexity Perspectivecited by 0
12 most cited of 17 All 17 (JSON)
- 2026Learning to Extrapolate in Depth with Looped Transformers10 Oct 2026
- 2026Position: The Turing-Completeness of Autoregressive Transformers Relies Heavily on Context Management19 May 2026
- 2026Loom: A Scalable Analytical Neural Computer Architecture9 Apr 2026
- 2026Learning to Approximate Uniform Facility Location via Graph Neural Networks13 Feb 2026
- 2026UltRAG: a Universal Simple Scalable Recipe for Knowledge Graph RAG28 Jan 2026
- 2025Fundamental Limits of Crystalline Equivariant Graph Neural Networks: A Circuit Complexity Perspective7 Oct 2025
- 2025Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical Perspective26 Sep 2025
- 2025Primal-Dual Neural Algorithmic Reasoning29 May 2025
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networks24 Feb 2025
- 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descent15 Oct 2024
- 2024How Do Large Language Models Understand Graph Patterns? A Benchmark for Graph Pattern Comprehension4 Oct 2024
- 2024On Expressive Power of Looped Transformers: Theoretical Analysis and Enhancement via Timestep Encoding2 Oct 2024
12 newest of 17 All 17 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2024Understanding Transformer Reasoning Capabilities via Graph Algorithms
- 2026Which Algorithms Can Graph Neural Networks Learn?
- 2026Stability and Generalization in Looped Transformers
- 2024Transformers Struggle to Learn to Search
- 2024Reasoning Algorithmically in Graph Neural Networks
- 2025Neural Tractability via Structure: Learning-Augmented Algorithms for Graph Combinatorial Optimization
- 2026Shared Weights, Selected Computations: How Looped Transformers Route What Each Loop Does
- 2024Are Large-Language Models Graph Algorithmic Reasoners?