Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformers
Not on the map. Why?
Abstract (arXiv)
Transformers have revolutionized the field of machine learning. In particular, they can be used to solve complex algorithmic problems, including graph-based tasks. In such algorithmic tasks a key question is what is the minimal size of a transformer that can implement the task. Recent work has begun to explore this problem for graph-based tasks, showing that for sub-linear embedding dimension (i.e., model width) logarithmic depth suffices. However, an open question, which we address here, is what happens if width is allowed to grow linearly, while depth is kept fixed. Here we analyze this setting, and provide the surprising result that with linear width, constant depth suffices for solving a host of graph-based problems. This suggests that a moderate increase in width can allow much shallower models, which are advantageous in terms of inference and train time. For other problems, we show that quadratic width is required. Our results demonstrate the complex and intriguing landscape of transformer implementations of graph-based algorithms. We empirically investigate these trade-offs between the relative powers of depth and width and find tasks where wider models have the same accuracy as deep models, while having much faster train and inference time due to parallelizable hardware.
Key facts. Cited by 11 papers in the map (data through 7 Oct 2026). Builds on 26 of its 43 references that are in the map. First posted on arXiv 3 Mar 2025.
Builds on
26 of 43 references.
References · 26
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2017Graph Attention Networkscited by 8,854
- 2017Neural Message Passing for Quantum Chemistrycited by 3,460
- 2020Open Graph Benchmark: Datasets for Machine Learning on Graphscited by 2,148
- 2020TUDataset: A collection of benchmark datasets for learning with graphscited by 718
- 2020A Generalization of Transformer Networks to Graphscited by 653
- 2021Rethinking Graph Transformers with Spectral Attentioncited by 468
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
14 more
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2020Can Graph Neural Networks Count Substructures?cited by 235
- 2019What graph neural networks cannot learn: depth vs widthcited by 195
- 2022The Parallelism Tradeoff: Limitations of Log-Precision Transformerscited by 191
- 2020Graph-Bert: Only Attention is Needed for Learning Graph Representationscited by 176
- 2023Talk like a Graph: Encoding Graphs for Large Language Modelscited by 175
- 2023Representational Strengths and Limitations of Transformerscited by 132
- 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
- 2022Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexitycited by 92
- 2022A Logic for Expressing Log-Precision Transformerscited by 67
- 2024Understanding Transformer Reasoning Capabilities via Graph Algorithmscited by 64
- 2024When Can Transformers Count to n?cited by 22
- 2020Multi-Objective Molecule Generation using Interpretable Substructurescited by 9
- 2018Discovering Molecular Functional Groups Using Graph Convolutional Neural Networkscited by 5
Built on by
Citing papers per year: 2025: 3; 2026: 8.
11 papers.
- 2026Billion-Scale Graph Foundation Modelscited by 5
- 2025Subquadratic Algorithms and Hardness for Attention with Any Temperaturecited by 4
- 2025From Sequence to Structure: Uncovering Substructure Reasoning in Transformerscited by 3
- 2026Expressivity-Efficiency Tradeoffs for Hybrid Sequence Modelscited by 3
- 2026Lost in Tokenization: Fundamental Trade-offs in Graph Tokenization for Transformerscited by 2
- 2025Convexified Message-Passing Graph Neural Networkscited by 0
- 2026Plain Transformers are Surprisingly Powerful Link Predictorscited by 0
- 2026Learning to Approximate Uniform Facility Location via Graph Neural Networkscited by 0
- 2026On the Computational Hardness of Transformerscited by 0
- 2026GraspLLM: Towards Zero-Shot Generalization on Text-Attributed Graphs with LLMscited by 0
- 2026Identifiability and Order-Dimension Limits of In-Context Learning on Partial Orderscited by 0
- 2026Identifiability and Order-Dimension Limits of In-Context Learning on Partial Orders14 Aug 2026
- 2026GraspLLM: Towards Zero-Shot Generalization on Text-Attributed Graphs with LLMs10 Jun 2026
- 2026Lost in Tokenization: Fundamental Trade-offs in Graph Tokenization for Transformers21 May 2026
- 2026On the Computational Hardness of Transformers11 Mar 2026
- 2026Expressivity-Efficiency Tradeoffs for Hybrid Sequence Models9 Mar 2026
- 2026Learning to Approximate Uniform Facility Location via Graph Neural Networks13 Feb 2026
- 2026Billion-Scale Graph Foundation Models4 Feb 2026
- 2026Plain Transformers are Surprisingly Powerful Link Predictors2 Feb 2026
- 2025From Sequence to Structure: Uncovering Substructure Reasoning in Transformers11 Jul 2025
- 2025Convexified Message-Passing Graph Neural Networks23 May 2025
- 2025Subquadratic Algorithms and Hardness for Attention with Any Temperature20 May 2025