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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Yehudai, Gilad, Sanford, Clayton, Bechler-Speicher, Maya, Fischer, Orr, Gilad-Bachrach, Ran, Globerson, Amir
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912853689106432
author Yehudai, Gilad
Sanford, Clayton
Bechler-Speicher, Maya
Fischer, Orr
Gilad-Bachrach, Ran
Globerson, Amir
author_facet Yehudai, Gilad
Sanford, Clayton
Bechler-Speicher, Maya
Fischer, Orr
Gilad-Bachrach, Ran
Globerson, Amir
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2503_01805
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformers
Yehudai, Gilad
Sanford, Clayton
Bechler-Speicher, Maya
Fischer, Orr
Gilad-Bachrach, Ran
Globerson, Amir
Machine Learning
Artificial Intelligence
Computation and Language
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.
title Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformers
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2503.01805