mlsanityData to 7 Oct 2026

Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformers

arXiv 2503.01805 ↗First posted 3 Mar 2025cs.LG cs.AI cs.CLcited by 11

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  4. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  5. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  6. 2017Graph Attention Networkscited by 8,854
  7. 2017Neural Message Passing for Quantum Chemistrycited by 3,460
  8. 2020Open Graph Benchmark: Datasets for Machine Learning on Graphscited by 2,148
  9. 2020TUDataset: A collection of benchmark datasets for learning with graphscited by 718
  10. 2020A Generalization of Transformer Networks to Graphscited by 653
  11. 2021Rethinking Graph Transformers with Spectral Attentioncited by 468
  12. 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
14 more
  1. 2022Transformers Learn Shortcuts to Automatacited by 260
  2. 2020Can Graph Neural Networks Count Substructures?cited by 235
  3. 2019What graph neural networks cannot learn: depth vs widthcited by 195
  4. 2022The Parallelism Tradeoff: Limitations of Log-Precision Transformerscited by 191
  5. 2020Graph-Bert: Only Attention is Needed for Learning Graph Representationscited by 176
  6. 2023Talk like a Graph: Encoding Graphs for Large Language Modelscited by 175
  7. 2023Representational Strengths and Limitations of Transformerscited by 132
  8. 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
  9. 2022Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexitycited by 92
  10. 2022A Logic for Expressing Log-Precision Transformerscited by 67
  11. 2024Understanding Transformer Reasoning Capabilities via Graph Algorithmscited by 64
  12. 2024When Can Transformers Count to n?cited by 22
  13. 2020Multi-Objective Molecule Generation using Interpretable Substructurescited by 9
  14. 2018Discovering Molecular Functional Groups Using Graph Convolutional Neural Networkscited by 5

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 3; 2026: 8.

11 papers.