Understanding Transformer Reasoning Capabilities via Graph Algorithms

Clayton Sanford, Bahare Fatemi, Ethan Hall, Anton Tsitsulin, Mehran Kazemi +3 more
5/28/2024
cs.LGcs.AI

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Which transformer scaling regimes are able to perfectly solve different classes of algorithmic problems? While tremendous empirical advances have been attained by transformer-based neural networks, a theoretical understanding of their algorithmic reasoning capabilities in realistic parameter regimes is lacking. We investigate this question in terms of the network's depth, width, and number of extra tokens for algorithm execution. Our novel representational hierarchy separates 9 algorithmic reasoning problems into classes solvable by transformers in different realistic parameter scaling regimes. We prove that logarithmic depth is necessary and sufficient for tasks like graph connectivity, while single-layer transformers with small embedding dimensions can solve contextual retrieval tasks. We also support our theoretical analysis with ample empirical evidence using the GraphQA benchmark. These results show that transformers excel at many graph reasoning tasks, even outperforming specialized graph neural networks.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{sanford2024understanding,
  title  = {Understanding Transformer Reasoning Capabilities via Graph Algorithms},
  author = {Clayton Sanford and Bahare Fatemi and Ethan Hall and Anton Tsitsulin and Mehran Kazemi and Jonathan Halcrow and Bryan Perozzi and Vahab Mirrokni},
  year   = {2024},
  eprint = {2405.18512},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2405.18512},
  url    = {http://arxiv.org/abs/2405.18512v1},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.18512.svg)](https://codeofpaper.com/paper/2405.18512)

Discussion