Understanding Transformer Reasoning Capabilities via Graph Algorithms
Authors: Clayton Sanford
Bahare Fatemi
Ethan Hall
Anton Tsitsulin
Mehran Kazemi
Jonathan Halcrow
Bryan Perozzi
Vahab Mirrokni
Venue: NeurIPS 2024 poster (2024)
Keywords: transformers
graph neural networks
representation
theory
Primary area: deep_learning_architectures
TL;DR: We provide theoretical results about transformer reasoning capabilities over graph structure.

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.

Understanding Transformer Reasoning Capabilities via Graph Algorithms
Clayton Sanford : Bahare Fatemi', Ethan Hall Anton Tsitsulin', Mehran Kazemi", Jonathan Halcrow', Bryan Perozzi* and Vahab Mirrokni Google Research, 2Columbia University," 'Google DeepMind
Abstract
Which transformer scaling regimes are able to perfectly solve different classes of algorithmic problems? While tremendous empirical advances have been at- tained by transformer- basee 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 '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.
Introduction
The transformer neural network architecture, which was initially introduced for neural machine translation [6, 77], quickly became the standard neural network architecture across many fields, powering recent breakthroughs language modeling [20, 66, 12, 76, 3, 75, 67], computer vision [21, 49], and natural sciences [36, 53). Across fields, transformers have superseded other architectures, surpassing them downstream performance while maintaining reasonable computational footprint.
How can we analyze reasoning capabilities of neural networks? One approach is to study algorithms executable with their internal representations. Neural algorithmic reasoning [30, 89, 34, 37, 78] is field of research dedicated to exploring such capabilities. Algorithmic execution is desirable because models use generalize diitt--distributionn [92, 46] and scale to larger problem sizes [93].
In this work, we focus on classes of transformers solving algorithmic reasoning problems on graphs. Why graph problems in particular? Recent research by Besta al. [10] suggests that graphs are an ideal abstraction of complex reasoning with dependencies, including chain-of-thought [82] and its generalizations [86, 17, 41, 40). Furthermore, investigate graph reasoning in order to evaluate transformer capabilities compared to specialized models that explicitly capture the structure of data. Graph neural networks (GNNs) [72, 44, 28, 7, 15] offer strong baselines for algorithmic reasoning [79, 13] and comprehensive theoretical frameworks for their capabilities and limitations [51, 84]. The complexity by non-graph architectures and others require sophistication beyond standard GNNs [90]. This makes graph tasks compelling testbed for both theoretical and empirical evaluations.
graph reasoning tasks varies greatly; some are easily solved
While transformer- based models are commonly optimized for downstream performance [38, 32, 64], theoretical investigations of transformer capabilities in realistic parameter regimes have been limited.
"Corresonndece:: chsanford@google.co
baharef@google..co
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

Input X
Transformer f
Targel f(X)
1/2
Embedding
Veriex tokens
1/3
Graph G
1/4
Self-Attention
V/
U2
0/
MLP
0/
Belf-Attention
US
1/2
Edge tokens
12, Vg
MLP
V/y 0l
Task: Are U2 and d4 connected!?
Ug; U7
Self-Attention
UG; 0g
17, 0l
Task tokens
#*2 174
Yes
Figure 1: The graph encoding scheme employed in our theoretical and empirical analysis that presents a graph reasoning task (e-g. connectivity) as a tokenized input to a standard transformer model.
We analyze the capabilities of standard transformer models to solve graph reasoning tasks by employing graph tokenization scheme similar to [42]; see Figure I for a graph encoding example. We generalize the insights of [71] established that graph connectivity can be computed in more depth-efficient manner with transformers than GNNs-to broader families of graph reasoning tasks. We also study the representational impacts of blank tokens, which can be thought of as a theoretically-tractabee version of either chain-of-thee of-thouh-t prompting [82], scratch space [61], or pause/filler tokens [29, 65].
We conduct an extensive study of graph reasoning problems with transformers from both theoretical and empirical perspectives. We summarize our principal contributions as follows:
We introduce novel representational hierarchy of graph reasoning tasks that formalizes reasoning capabilities of transformers in several realistic parameter scaling regimes. This includes two graph reasoning task maasses-which we refer as the parallelizable and search tasks and include well-known algorithmic tasks like connectivity and shortest path respectively.
We prove that logarithmic-depth transformers are necessary and sufficient solve parallelizable tasks in highly parameter-efficiat larger networks. We distinguish both of these classes from an easier family of lasky, such as node count and edge existence-by by showing that retrieval tasks can be efficiently computed by single-layer transformers, while parallelizable and search tasks cannot.
manner; similar constructions for search tasks employ much
3. We empirically validate GNNs on tasks that require the analysis long-range dependencies, including parallclizable tasks like connectivity. Our experiments suggest that GNNs perform better on simpler tasks that require only local analysis of neighboring nodes in low sample-complexity regimes, benefiting from their well-aligned inductive bias.
representational contrast by showing that transformers outperform
Related work
Fundamental capabilities of transformers. Early representational research [88, 62, 81] estab- lished the universality of transformers by simulating Turing machines step-by-step, albeit in an unrealistic polynomial-deph scaling regime. These universality results were extended to bounded- depth transformers with chain-of of-thought tokens [56. 52], but with a persistent gap between positive and negative results. A more fine-gra fine-grained theoretical approach established the limitations of bounded- size transformers by relating them to threshold circuits, implying that L-complete tasks like graph connectivity are unsolvable by constant-depth transformers [55, 54, 57]. However, these circuit complexity reductions are not bidirectional and their positive results pertaining to classes of regular languages [31] reveal little about when tasks like connectivity can be expressed.

---

The closest analytical framework to ours characterizes transformers as distributed computing protocols by quantifying the informational bandwidth of their self-attention units. This line of work sharply separates transformers from other architectures and provides width and depth separations [70, 71]. The ability of transformers to simulate finite-state automata logarithmic depth provides a further roadmap for how transformers efficiently leverage parallel computation [48].
Recent work [18] similarly focuses on understanding the capabilities of transformers solve graph algorithms, but they focus instead on looped transformers, where constant-size transformer model is iterated up a polynomial number of times in the size of the input graph. While their constructions for tasks like graph connectivity are more parameter-effin efficient than our own, this comes at the cost of very high depth, which presents both run-time and learnability concerns. Our depth-efficient constructions emerge by simulating parallel graph algorithms, rather than well-knows serial algorithms, such as Dijkstra's.
Empirical analysis of transformer reasoning capabilities. Multiple empirical investigations ex- plore the algorithmic capabilities of transformer-baat models [91, 47, 46]. Graph reasoning problems have been used to evaluate capabilities of transformer- basse LLMs [24, 80, 87, 74, 33] including works with graph-specifie GNN adapters [14, 63). In the empirical part of our study, we the GraphQA dataset which was evaluated initially on LLM prompting appraoches and later on GNN-auumented prompts [62] to validate complexity hierarchy and compare transformers with GNNs and prompt-based LLMs on a selection of graph reasoning tasks.
Transformers and graph neural networks. GNNs provide useful benchmark for model expres- sivity on graph inputs. For instance, the inability of GNNs to efficiently solve "global structure" tasks like subgraph connectivity made evident by connection to the CONGEST distributed computing model [51]. A further connection [59] to the Weisfeiler-Lehman (WL) isomorphism heuristic [83] captures the inability of feature-less GNNs to distinguish certain graph instances [84]. The feature- less assumption is burdensome and representationally costly; GNNs with randomly intialized node features are known to be universal [2]. See Appendix D for a further discussion of the representational limitations of GNNs.
Graph transformers [22, 68, 58] integrate the transformer architecture with graph-structured data. While GNNs can simulate the WL test [1], transformers can simulate GNNs and exceed their WL limitations [90]; they are strictly more expressive than 2-WL [42]. Despite our focus on standard transformers, our empirical results in Section 4 include comparisons a wide range of GNNs.
3 Hardness taxonomy of transformer graph reasoning tasks
We provide our core result: rigorous quantification of the hardness of graph reasoning tasks for transformer-baset models. While graph reasoning tasks, like other algorithmic problems, can be categorized into well-known computational and circuit complexity classes (c.g. TC L. NL, NP. NP), the relationship between membership in these classes and the hardness of solving a task with a parameter-efficiee neural network is not immediately obvious. Our hierarchy bridges the gap between these worst-case computational classes and the representational capabilities of bounded-size transformers of different parameter scaling regimes. These regimes include transformers whose depth L scales with the input sequence length N; this contrasts with most theoretical results, which study on the constant-depth regime.
Our positive and negative theoretical results employ the transformer model of [71], which is presented in Appendix A.I and assumes that the embedding dimension m grows less rapidly than than the sequence length N and that the multi-layer perceptrons (MLPs) are arbitrary functions. The result is a model of a transformer as a bounded-capacity communication protocol. functions of each individual embedding vector can be computed, but the interactions between these vectors are restricted by the low-rank of the attention matrix. The relevance of this model is motivated by the rapid scaling in the context lengths of modern transformers in recent years and the high ratio of MLP parameter count to the embedding dimension each operates on.
this model, arbitrary
This model also permits the inclusion of blank pause token inputs of [29], which provide additional computational power to the transformer model by extending the computational "tape" without introducing new information about the input.
3

---

Task class
Example tasks
Complexity
Parallelizable
Retrieval ($3.3)
Node
D1
LDP
LDW Search
I.
Edge count
D1
LD
m Ollog N)
Edge existence
D1
Node degree
D1
D1 Retricval
Parallelizable ($3.1) L = (log N)
Connectivity
LD
Cycle check
LDPN LDW
O(V)
Bipartiteness
LDPn LDW
Search ($3.2)
Shortest path
LDW
L Olog N)
Diameter
LDW
(a) The complexity hierarchy
(b) Example tasks and their complexity.
Figure 2: summary of the theoretical hierarchy of Section 3 that visualizes which type of graph reasoning tasks be solved in which transformer scaling regime (Depth1 (D1), LogDepth (LD), LogDepthWide (LDW) and LogDepthPause (LDP)).
These results divide the tasks that empirically investigate in Section 4 into three difficulty families based on the hardness of solving the task with parallel computation.
1. Retrieval tasks including node count, edge count, edge existence, and node degree- are tasks that can intuitively be solved by a single lookup step or global aggregation. These are the easiest tasks in our framework, and we show in Section 3.3 that these retrieval tasks can be computed by a single-layer transformer with small embedding dimension. (In contrast, all other examined tasks cannot be solved in that regime.)
Parallelizable tasks including connectivity, connected nodes, and cycle check from the exper- imental results and host of other graph reasoning tasks, such bipartiteness, planarity, and minimum spanning forest-are non-trivial tasks that can solved efficiently parallel compu- tation setting. Section 3.1 establishes that these tasks can be solved by bounded-size transformers with logarithmic depth.
Search tasks-including shortest path and other tasks like diameter and directed reachability- comprise harder family of tasks that are less easily solved by parallel algorithms. In Section 3.2, we prove that these tasks belong in equivalence class and exhibit large-model scaling regimes where they can be computed.
The representational hardness of these classes is quantified by several results that determine whether transformers that obey different parameter scaling rules can compute them. We define the following scaling regimes for the depth L, embedding dimension m, and number of "pause" tokens N' of family of transformers as function of the size of the input graph, N O(V + EE))
Depth1 (D1): Single-layer multi-headed transformers with small embedding dimension m O(log N) without any pause tokens.
LogDepth (LD): Transformers with depth I, = O(log N), embedding dimension m O(Ns) for any fixed > 0, and no pause tokens.
LogDepthPPuse (LDP): Transformers with the same depth and width constraints LogDepth, with at most N' = poly(N) blank "pause" tokens appended to the input sequence.
LogDepthWide (LDW): Transformers with depth L O(log N), embedding dimension m ((11/2+e), and no pause tokens.
Our positive and negative results that relate scaling regimes and graph reasoning tasks are displayed in Figure 2. We present high-level result summaries in the following sections with proofs in Appendix.
The most technically significant results concern LogDepth models and are provided Appendix These bounds consequences of Theorem I, an improved analysis of the relationship between

---

transformers and the massively parallel computation (MPC) distributed computing model of [39]². This connection between MPC and transformers a sharp improvement of similar result by [71]. Theorem 1 (Simplified version of Theorem 8). For constant ó, e > O, any R-round MPC protocol with N machines with O bits of local memory each can be simulated by transformer of depth = O(R) and embedding dimension m = O(N+te).
Results pertaining to Depth1 are stated in detail and proved in Appendix C. In addition, we discuss the triangle counting task (and the more general clique counting task) in Section 3.4, where we show a distinct result for much smaller depth (I. = Oloo log N)) that includes pause tokens.
3.1 Parallelizable tasks and LogDepth transformers
We define the family of parallelizable tasks to consist of graph reasoning tasks that are L-complete and are equivalent to graph connectivity in ((1)-rounds, as proved by [60]. This family includes (but is not limited to): graph connectivity, minimum spanning forest, cycle detection, st-connectivity, number of connected components, graph bipartiteness, planarity testing, and one-cycle vs two-cycles testing. While graph connectivity and minimum spanning forest were shown to be computable by logarithmic depth transformers with small polynomial width (LogDepth) by previous work [71], this poses broader questions: Are all parallelizable graph reasoning tasks computable by transformer of logarithmic depth and small embedding dimension? And do sub-logarithmic--ee transformers exist that solve any parallelizable tasks?
We first show that all parallelizable tasks can be solved in two logarithmic-depth scaling settings. Theorem 2. For any parallelizable task, there exists transformers in LogDepthPause and LogDepth that solve the task.
Theorem is stated formally as Theorem 18 and proved in Appendix B.2.1. Both components the theorem are a consequence of a novel relationship between the MPC model and transformers (Theo- rem 1) and the analysis of MPC protocols for graph reasoning tasks by [60]. The LogDepthPause result is the direct implication of an ((1) MPC equivalence (Theorem 9) between all paralleliz-
able tasks and an MPC protocol that solves the connectivity task (Theorem 11). The LogDepthWide
bound consequence of Theorem 15, which shows that all languages in NC² (including all lan- guages in L and NL) can be evaluated by an MPC protocol with Ollog N) rounds and with local memory O ( [60].
We further prove the conditional optimality of logarithmic depth.
Theorem 3. Conditional on Conjecture 13, any transformer that solves some parallelizable task with width mHd O and pause tokens N' poly((N) must have depth L Vloog N).
This result (stated formally as Theorem 19 a combination of the conditional depth lower bound on graph connectivity by [71] and the (11)-ou equivalence between all parallel tasks.
3.2 Search tasks
Search tasks are similarly defined to be those that are NL-complete and equivalent to shortest path in O(o)-rounds of MPC and include shortest path, strong connectivity, st-reachability, radius, diameter, and median. Like before, the -rouud MPC equivalence translates to an ((1)- equivalence in transformers. We give a similar positive result for LogDepthWide transformers; whether these tasks can be solved by LogDepthPause transformers is unknown.
Theorem 4. For any search task, there exists transformer in LogDepthWide that sovles the task.
This theorem, which is restated in Appendix B.2.2 as Theorem 21, is also an immediate consequence of Theorem 15.
While the minimum depth of a transformer with small embedding dimension that solves a search task is not identified, prove that the minimum depth needed to solve some all search task is approximately equivalent in Theorem 22.
MPC is a theoretical model of the MapReduce computational paradigm that distributed computation among a large number of machines with restricted local memory size and communication bandwidth. We formally introduce the MPC model in Appendix B.I.
5

---

3.3 Retrieval tasks and Depth1 transformers
Graph tasks whose algorithms consist of a single look-up or aggregation step can efficiently solved by single-layer transformers. This result assumes that the graph G (V, EE) is encoded as some input sequence X of length = O(IV + [E)) that expresses each edge and vertex a single token. This encoding scheme is detailed in Appendix C.
Theorem 5. For any retrieval task (including node count, edge count, edge existence. and node degree) there exists a transformer in Depth1 that solves the task.
We formalize this statement in Theorem 36 and prove it their in Appendix C. These rely on proving the existence of a useful input MLP & that precomputes embeddings with useful structure for all retrieval tasks.
In contrast, we show that collection of parallelizable and search tasks cannot be efficiently solved by transformers in Depth1.
Theorem 6. Any single-layer transformer that solves the graph connectivity, shortest path, or cycle detection task has width satisfying mHH (.(N).
The proof of the formal counterpart of this statement (Theorem 38) appears in Appendix C.2 and is a consequence standard communication complexity argument. more generalized result than Theorem was proved by [57], which establishes that all problems outside of wwich include all L-complete and NL-complete languages, and hence, all parallelizable and search tasks-canno be solved by constant-depth transformers with polynomial width because they cannot be computed by TC" (constant-depp depth threshold circuits). We nonetheless include this theorem to demonstrate a clean lower bound that applies to very simple input graph instances.
3.4 Triangle counting
We finally construct depth--fficient transformers for triangle counting due to the MPC algorithms of [11]. Unlike previous positive results, which applied uniformly across all graphs instances of bounded size, the complexity of the corresponding transformers for triangle counting a function of the arboricity of the input graph. When the arboricity grows aub-polyoomially with N-as is graphs-no no pause tokens are necessary. Unlike the parallclizable and search classes of problems, strictly sub- lobllogait depth is attainable with pause tokens, even for worst-case graphs.
the case for
Theorem 7. There exists transformer that computes the number of triangles in any input graph of arboricity a and has embedding dimension m O(N)), depth L = Ollog log N), and pause tokens
N [O(aN--9 ifa 2(N'
otherwise.
This result is special case of Theorem 23, more general result about clique counting that appears in Appendix B.2.3.
Theoretical conclusions. These results provide tight characterization of the the reasoning capa- bilities of transformers whose depth, width, and input padding conform to different scaling regimes. They strengthen the established connection between transformers and massively parallel computation (MPC) [71] and generalize the resulting representational bounds to broader categories of graph tasks. We conclude that the logarithmic-depth regime is apt for for considering tasks in and NL, which had previous illuminated the limitations of transformers with constant depth and a limited number of chain-of-thoure offtthuugh tokens [56]. While expressivity does not imply learnability, these theoretical benchmarks sharply characterize the fundamental limitations of transformers and coincide with experimental results conveyed in the subsequent section.
Our theoretical model of a transformer has certain limitations, namely the universality of the multi- layer perceptron units. When maximally exploited (e.g. by solving NP- problems within each MLP), this assumption exaggerates the computational capabilities of transformers. However, the
'The arboricity is the minimum number of spanning forests needed to cover the graph, which grows at most linearly with the degree of the graph.

---

local computational complexity of the MPC algorithms employed in this paper tend to be strongly sublinear the size of the graph imput (see, e.g. the connectivity algorithms of Andoni et al. [4]), which implies the existence of compact ReI.U circuits for each of the model's MLPs. Furthermore, the ratio of model parameters that belong to MI.s in state-of-the be high, which suggests that it is reasonable to assume that MLP units in our theoretical model are algorithmically rich. We would be interested in pursuing further theoretical research that combine the computational model [54] and the communication model of [71] to assess the capabilities of transformers whose MLPs are represented as bounded-size boolean circuits.
language modelsis known to
4 Empirical graph reasoning capabilities
We further illuminate the reasoning capabilities of transformers by conducting an empirical in- vestigation of the abilities of variety of neural architecture and training settings to learn graph algorithmic tasks. We use the GraphQA benchmark tasks [24] for our experiments. We evaluate standard autoregressive transformers both small models (at most 60M parameters) trained from scratch and fine-tuned (FT) T5-11B model (with IIB parameters) [66]. For the fine-tuned models, we explore task-specific fine-tuning and contrast those results with graph neural networks (GNNs) and prompting-bast based methods on pre-trained LLMs.
These experimental results validate key tenets of our theoretical results and demonstrate the utility of transformers' algorithmic reasoning capabilities. Our principal empirical conclusions are as follows:
1. Transformers excel at global reasoning tasks. Transformers outperform GNNs tasks that require efficiently aggregating information about distant nodes a graph, such as connectivity and shortest path.
2. GNNs uncover local graph structure with few samples. While transformers capable of efficiently expressing all graph learning tasks under investigating, the structural limitations of GNNs provide them with favorable inductive biases for intrinsically local tasks, such cycle check and node degree, and permit them to outperform transformers in a low-sample regime.
3. Trained transformers outperform LLM prompting. Transformers trained to explicitly solve graph reasoning tasks consistently attain greater accuracy across tasks than variety of prompting strategies applied to more recent larger LMs.
comprehensive evaluation of each GraphQA task on every training setting appears Appendix E, in addition details about transformer training, the GraphQA benchmark, and alternative GNN and prompting approaches.
4.1 Transformers excel at global reasoning tasks
As indicated in Section 3, graph reasoning algorithms can be categorized based on the extent to which they entail aggregating "local" information about nodes and their immediate neighbors or modeling "global" connections between nodes separated by a long distances. This section investigates the following question about transformers and long-distance distance reasoning:
When do transformers outperform GNNs on tasks that require global reasoning?
We consider two tasks that require reasoning across long distances in graph instance: evaluating connectivity and computing the shortest path between a pair of nodes. Neither of these tasks can be solved by only investigating the neighbors of the source and sink node, which therefore implies that some analysis of global graph structure is necessary.
Figure 3a displays the accuracy of variety of trained transformers and GNNs on the connectivity task contrastsing the performance of all such models when trained on 1,000 and 100,000 graph connectivity instances. In the most restricted sample complexity regime, trained GNNs are consistently more accurate than the small transformer; however, increasing the number of training samples yields far more substantial improvement in the performance of the small transformer, which outperforms all GNNs trained on 100,000 samples. Notably, the pre-trained transformer, fine-tuned on just 1000 training instances, nearly solves the connectivity task. This suggests significant enhancements due to the larger model size and the data-rich fine-tuning phase. Figure 3b plots the training and test error of ten small transformers trained on connectivity datasets of increasing size and reveals sharp and
7

---

# of training samples
Model
IK
100K
Accuracy
0.95
GCN [44]
83.8
83.8
MPNN [28]
94.0
94.4
Train
GIN [84]
93.8
94.0
0.9
Test
60M transformer
92.9
98.0
10
10a
104
10
11B transformer (FT)
98.4
Number of Training Samples (log scale) (b) Connectivity classification accuracy of 60M transformers by training set size.
(a) Connectivity classification accuracy for trained transformers and GNNs.
Figure 3: Accuracy of a variety of trained transformers and GNNs on the connectivity task.
continual improvement in accuracy. The fine-tuned T5 transformer has similar accuracy to the most sample-rich small transformer and exceeds that all GNNs.
On the other hand, Table I demonstrates that the MPNN GNN models outperform small trans- formers when trained to compute the shortest path, even on larger training datasets. However, the fine-tuned T5 model has far higher accu- racy than all alternatives, even when trained only 1000 samples.
# of training samples
Model
1K
100K
GCN [44]
50.2
55.0
MPNN [28]
66.8
72.6
GIN [84]
54.0
58.6
60M transformer
57.4
97.1
Theoretical interpretation: Because connec- tivity is the prototypical example of a task in the parallelizable class and thus be efficiently implemented by LogDepth transformers with very small width (Theorem 2), the fact that small transformers succeed in solving nearly all con- nectivity instances is illuminating but not sur- prising. In contrast, message-passing GNNs are unable solve connectivity similarly depth- and width-effieiert manner due fundamental capacity limitations."
11B transformer (FT)
92.8
Table I: Transformers vs GNNs on shortest path: Fine-tuned large transformers outperform other transformers and GNNs, even the alternatives are trained much larger training sets.
Shortest path belongs to the search class of graph reasoning tasks and is NL-complete. Theorem implies that shortest path is computable by LogDepthWide transformers, which are likely to require very large embedding dimension to be learnable by finite samples. This task only be computed in a depth- and parameter-efficient manner a variety of search tasks, including all-pairs shortest-path and diameter, performance on shortest path reinforces the theoretical intuition that solving shortest path requires a very large number of model parameters.
well (Theorem 22). The fact that only the pre-trained model has nearly optimal
4.2
GNNs uncover local graph structure with few samples
While small transformers outperform GNNs on graph reasoning algorithms that entail analysis of long-range graph structure, their empirical successes are not uniform. Here, we investigate the following question:
When do GNNs outperform transformers on graph reasoning tasks?
Figure 3b and Table I demonstrate that GNNs outperform small transformers in the low-sample regime, despite the sufficient expressivity of transformers. This gap in performance, which is reinforced for the node degree and cycle check tasks in Table 2, suggests that GNNs have beneficial
*See Appendix A.2 for a discussion of prior work on theoretical relationships between GNNs and both the Weisfeiler- graph isomorphism test [84] and the CONGEST distributed computing model and their implication that GNNs cannot solve connectivity in parameter-efficiet manner.

---

Retrieval Edge existence Node degree
Paralkliizble Tasks
Search Tasks
Subgraph Counting
Method
Edge
Counectivity Cycle
Shortest path
Triungle counting
ZERO-SHOT [24]
21.7
12.4
44.5
14,0
84,9
76.0
11.5
1,3
ZERO-COT [21]
14.6
9.4
33.5
10.4
73.5
32.3
33.6
12.7
FEW-SHOT [24]
25.5
12.0
36.8
174
79,4
37.4
22.7
3.0
[24]
27.6
12.8
42.8
29.2
45.2
58.0
38.6
COT-BAG (24)
37.3
28.0
40.4
60M transformer-I
100.0
100.0
67.6
31.5
92.9
92.1
57.4
33.4
60M transformer- 100K
100.0
100.0
96.1
91.7
98.0
98.0
97.2
40.5
11B transfortter (FT)
100.0
45.0
100.0
68.8
98.4
98.0
92.8
26.0
Table 3: Comparison of GraphQA task accuracies of transformers explicitly trained for graph reasoning and LLMS with variety of prompting strategies.
inductive bias for learning graph reasoning tasks that can be solved by attending exclusively to local heuristics.
Just as the bounded kernel size of con-
Node Degree
Cycle Check
volutional neural networks (CNNs) enables the sample-efficient learning of relevant textures and gradients for image analysis, message-passing
Model
1K
100K
1K
100K
GCN [44]
9.8
9.4
83.2
83.2
MPNN [28]
99.4
99.8
99.0
100.0
GNNs are unable send messages instantancously across multiple edges, which simplifies a search of the space of "one-hop" graph algorithms and represents a positive inductive bias. In contrast, the ability of transformers to send information between any pair of the alternative inductive biases suggested by the input positional encoding- induces a steeper sample complexity to learn node degree.
GIN [84]
36.2
37.8
98.8
83.2
60M transformer
31.6
91.7
97.1
98.0
11B transformer (FT)
68.8
98.0
Table 2: Transformers vs GNNs on cycle check and node degree: GNNs are favorably biased for local structure.
input
Theoretical interpretation: While model expressivity is necessary for learnability, it is not suffi- cient. The locality constraints of message- passseggg GNNs likely provides a favorable inductive bias for learning tasks like node degree with an exclusively on local structure that makes learning these tasks possible in sample-efficient manner. While cycle check is more representationally difficult for GNNs than transformers in the worst case (see Appendix A.2), the random graphs sampled for the GraphQA benchmark have very small cycles (Figure 7) and do not resemble the large-diameter worst-case instance.
4.3 Trained transformers outperform LLM prompting
Large language models (LLMs) are regularly evaluated by their reasoning abilities, and it remains an open research question determine what kinds of training data best teaches models to solve logical problems. We investigate the extent to which LLMs can already perform graph reasoning tasks without being trained explicitly to do so.
Do transformers trained explicitly to solve graph reasoning tasks outperform prompt-tuning approaches on much larger LLMs?
In Table 3, we contrast the capabilities of trained transformer models with several prompt-based ap- proaches querying LLMs. Task-specific transformers including the fine-tuned 1 IB transformers- consistently dominated the prompt- based approaches, despite the vast difference in parameter count and the almost certain presence of graph reasoning in the LLM's corpus.
Theoretical interpretation: While the representational capabilities of LLMs to solve reasoning tasks much greater than that of small transformers, this performance gap suggests that their effective reasoning capacity is much weaker and that it may be improved by a richer training corpus that includes synthetic tasks.
Finally, we observe that the near-perfect performance of trained transformers on the node count, edge count, and edge existence is consistent with the representational easy of those tasks, as suggested by the existence of efficient Depth1 transformer implementations.

---

5
Conclusion
This paper provides a comprchensive evaluation of transformer models" graph reasoning capabilities, shedding light on their effectiveness across diverse graph reasoning tasks. By introducing a novel representational hierarchy, the study distinguishes between retrieval, parallelizable, and search reasoning tasks and offers insights into the performance of transformers varying levels of granularity. The empirical investigation reveals that transformers exhibit strong performance in graph-based reasoning problems, often matching or surpassing specialized graph models. Furthermore, the study highlights transformers' exceptional ability to capture global graph patterns effectively, showcasing their capability in understanding long-range range dependencies, critical factor in solving tasks involving global graph structures. Overall, this work crystallizes precise representational trade-offs that reflect the fundamental reasoning capabilities of transformers and demonstrates that the tasks used to quantify those capabilities are indeed learnable in sample-
and parameter-efficient manner.
While the hierarchy introduced by this work effectively separates graph algorithmic tasks into distinct equivalence classes with significant implications for their computability by transformers, several questions remain for future research. We focused on graph reasoning tasks due to their relevance to the broader context of transformers, GNNs, and parallel algorithms. However, the complexity classes presented here could potentially be extended to a wider range of algorithmic problems. While our assumption of unbounded-sing MLPs provides strong lower bounds, further research into whether parallelizable tasks can be represented by transformers with bounded-size MLP units would complement this existing work. Broader experimental results that empirically evaluate the scaling laws would more directly assess the relevance of representational theoretical results to learnability.
References
[1] Anders Aamand, Justin Y. Chen, Piotr Indyk, Shyam Narayanan, Ronitt Rubinfeld, Nicholas Schiefer, Sandeep Silwal, and Tal Wagner. Exponentially improving the complexity of simulat- ing the weiseeiler-lhmmnn test with graph neural networks, 2022. Cited on page 3.
[2] Ralph Abboud, Ismail IIkan Ceylan, Martin Grohe, and Thomas Lukasiewicz. The surprising power of graph neural networks with random node initialization, 2021. URL attps://arxxx arg/abs/2000 01179. Cited on page 3.
[3] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. GPT-4 technical report. arXiv preprint arXiv:2303.088:
2023, Cited on page 1.
[4] Alexandr Andoni, Zhao Song, Clifford Stein, Zhengyu Wang, and Peilin Zhong, Parallel graph connectivity in log diameter rounds. In FOCS, October 2018. Cited on pages 7, 17, and 18.
[5] Rohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa. Paige Bailey, Zhifeng Chen, et al. Palm 2 technical report. arXiv preprini arXiv:2305. 10403, 2023. Cited page 42.
[6] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In JCLR, 2014. Cited on page 1.
[7] Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Zonzalz- Vinicius Zambaldi. Mateusz Malinowski, Andrea Tacchetti. David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv: 1806.006., 2018. Cited on page 1.
[8] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query processing. JACM, 64(6), oct 2017. Cited on page 19.
[9] James Bergstra and Yoshua Bengio. Random search for typer-parametee optimization. JMLR, 13(2), 2012. Cited on page 41.
[10] Maciej Besta, Nils Blach, Ales Kubicek, Robert Gerstenberger, Michal Podstawski, Lukas Gianinazzi, Joanna Gajda, Tomasz Lehmann, Hubert Niewiadomski, Piotr Nyezyk, and Torsten Hoefler. Graph of thoughts: Solving elaborate problems with large language models. AAAI, 38 1769,, March 2024. Cited on page 1.
10

---

[11] Amartya Shankha Biswas, Talya Eden, Quanquan C. Liu, Slobodan Mitrović, and Ronitt Rubinfeld. Massively parallel algorithms for small subgraph counting, 2022. Cited on pages and 20.
[12] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. NeurIPS, 2020. Cited on pages and 42.
[13] Quentin Cappart, Didier Chételat, Elias B Khalil, Andrea Lodi, Christopher Morris, and Petar Veličković. Combinatorial optimization and reasoning with graph neural networks. JMLR, 24 (130):1-61, 2023. Cited on page 1.
[14] Ziwei Chai, Tianjie Zhang, Liang Wu, Kaiqiao Han, Xiaohai Hu, Xuanwen Huang, and Yang Yang. GraphLLM: Boosting graph reasoning ability of large language model, 2023. Cited on page
[15] Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Ré, and Kevin Murphy, Machine learning on graphs: model and comprehensive taxonomy. JMLR, 23(89): 2022. Cited on page 1.
[16] Sam Coy and Artur Czumaj. Deterministic massively parallel connectivity. In STOC, STOC '22, June 2022. Cited page 19.
[17] Antonia Creswell, Murray Shanahan, and Irina Higgins. Selection-inference: Exploiting large language models for interpretable logical reasoning. In ICLR, 2023. Cited on page 1.
[18] Artur Back de Luca and Kimon Fountoulakis. Simulation of graph algorithms with looped transformers, 2024. URL https://arra http///axxiv..rr//////2...00 01107. Cited on page 3.
[19] Jeffrey Dean and Sanjay Ghemawat. Mapreduce: Simplified data processing on large clusters. In OSDI 04: Sixth Symposium on Operating System Design and Implementation, pages 137-150, San Francisco, CA, 2004. Cited on page 18.
[20] Jacob Devlin, Ming-Wes Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv: 1xXi::8110004055 2018. Cited on page 1.
[21] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
Cited on page 1.
[22] Vijay Prakash Dwivedi and Xavier Bresson. A generalization of transformer networks to graphs. arXiv preprint arXiv:20/2.00699 2020. Cited on page 3.
[23] Paul Erdös and Alfred Rényi. On random graphs. Publicationes Mathematicae Debrecen, 6: 290-297, 1959. Cited on page 41.
[24] Bahare Fatemi, Jonathan Halcrow, and Bryan Perozzi. Talk like graph: Encoding graphs for large language models. In ICLR, 2024. Cited on pages 3, 7, 9, 40, 41, 42, and 43.
[25] Fabian Frei and Koichi Wada. Efficient circuit simulation in mapreduce. ArXiv, abs/1907.01622. 2019. Cited on page 20.
[26] Roy Frostig, Matthew James Johnson, and Chris Leary. Compiling machine learning programs via high-level tracing. Systems for Machine Learning, 4(9), 2018. 8. Cited page 41.
[27] Mohsen Ghaffari, Fabian Kuhn, and Jara Uitto. Conditional hardness results for massively parallel computation from distributed lower bounds. In FOCS, 2019, Cited on page 19.
[28] Justin Gilmer, Samuel S Schoenholz, Patrick Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry, In ICML, 2017. Cited on pages 1, 8, 9, 42, and 43.

---

[29] Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, and Vaishnavh Nagarajan. Think before you speak: Training language models with pause tokens. In ICLR, 2024. Cited on pages 2, 3, and 16.
[30] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprini 14Xiv:1410.4001 2014. Cited on page 1.
[31] Yiding Hao. Dana Angluin, and Robert Frank. Formal language recognition by hard attention transformers: Perspectives from circuit complexity. TACL, 10:800-811 810, 2022. Cited on page 2.
[32] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203. 2.0.::2003/55566 2022. Cited on page 1.
[33] Bowen Jin, Gang Liu, Chi Han, Meng Jiang, Heng Ji, and Jiawei Han. Large language models on graphs: A comprehensive survey. arXiv preprint arXiv:2312.02788. 2023. Cited on page
[34] Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. NIPS, 2015. Cited on page 1.
[35] Norman P. Jouppi, Cliff Young. Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre-luc Cantin, Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, C. Richard Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Daniel Killebrew, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Matt Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang. Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit. SIGARCH Comput. Archit. News, 2017. Cited on page 41.
[36] John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ron- neberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Videk, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, (96(7873))8383-355555 2021. Cited on page 1.
[37] Lukasz Kaiser and Ilya Sutskever. Neural GPUs learn algorithms. In ICLR, 2016. Cited on page 1.
[38] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361 2020. Cited on page 1.
[39] Howard Karloff, Siddharth Suri, and Sergei Vassilvitskii. Model of Computation for MapRe- duce, pages 938-948. Cited on pages 5 and 18.
[40] Nora Kassner, Oyvind Tafjord, Ashish Sabharwal, Kyle Richardson, Hinrich Schuetze, and Peter Clark. Language models with rationality. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, EMNLP, December 2023. Cited on page 1.
[41] Mehran Kazemi, Najoung Kim, Deepti Bhatia, Xin Xu, and Deepak Ramachandran. LAM- BADA: Backward chaining for automated reasoning in natural language. In ACL, 2023. Cited on page 1.
[42] Jinwoo Kim, Tien Dat Nguyen, Seonwoo Min, Sungjun Cho, Moontae Lee, Honglak Lee, and Seunghoon Hong. Pure transformers are powerful graph learners, 2022. Cited on pages 2, 3, and 31.
12

---

[43] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Cited on page 41.
[44] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprini IrXiiv 2016. Cited on pages 1, 8, 9, 42, and 43.
[45] Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. NeurlPS, 35:22199- 22213,, 2022. Cited page 42.
[46] Nayoung Lee, Kartik Sreenivasan, Jason D Lee, Kangwook Lee, and Dimitris Papailiopoulos. Teaching arithmetic to small transformers. In ICLR, 2024. Cited on pages and 3.
[47] Yuxuan Li and James L. McClelland. Systematic generalization and emergent structures in transformers trained on structured tasks, 2022. Cited on page 3.
[48] Bingbin Liu, Jordan T. Ash, Surbhi Goel, Akshay Krishnamurthy, and Cyril Zhang. Transform- ers learn shortcuts to automata, 2022. Cited on page 3.
[49] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In CVPR, 2021. Cited on page
[50] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. Cited page 41.
[51] Andreas Loukas. What graph neural networks cannot learn: depth vs width. ICIR, 2020. Cited on pages 1, 3, and 39.
[52] Eran Malach, Auto-regressive next-token predictors are universal learners, 2023. Cited on page 2.
[53] Amil Merchant, Simon Batzner, Samuel S Schoenholz, Muratahan Aykol, Gowoon Cheon, and Ekin Dogus Cubuk. Scaling deep learning for materials discovery. Nature, 624(7990):80-85. 2023. Cited on page 1.
[54] William Merrill and Ashish Sabharwal. A logic for expressing log-precision transformers, 2022. Cited pages 2 and 7.
[55] William Merrill and Ashish Sabharwal. The parallelism tradeoff: Limitations of bog-precision transformers. TACL, 11:531-545, 2023. Cited pages 2 and 32.
[56) William Merrill and Ashish Sabharwal. The expressive power of transformers with chain of thought, 2023. Cited on pages 2 and 6.
[57] William Merrill, Ashish Sabharwal, and Noah Smith. Saturated transformers are constant- depth threshold circuits, 2021. Cited on pages 2 and 6.
[58] Erxue Min, Runfa Chen, Yatao Bian, Tingyang Xu, Kangfei Zhao, Wenbing Huang, Peilin Zhao, Junzhou Huang, Sophia Ananiadou, and Yu Rong. Transformer for graphs: An overview from architecture perspective, 2022. Cited page 3.
[59] Christopher Morris, Yaron Lipman, Haggai Maron, Bastian Rieck, Nils M Kriege, Martin Grohe, Matthias Fey, and Karsten Borgwardt. Weisfeiler and Leman go machine learning: The story so far. JMLR, 18655-15865555555 2023. Cited on pages and 40.
[60] Danupon Nanongkai and Michele Scquizzato. Equivalence classes and conditional hardness in massively parallel computations. Distributed Computing, 35(2):165-183, January 2022. Cited on pages 5, 18, 19, and 20.
[61] Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114 2021. Cited on page 2.
13

---

[62] Jorge Pérez, Pablo Barceló, and Javier Marinkovic. Attention is turing complete. J. Mach. Learn. Res., 22(1), jan 2021. ISSN 1532-4435. Cited on pages 2 and 3.
[63] Bryan Perozzi, Bahare Fatemi, Dustin Zelle. Anton Tsitsulin, Mehran Kazemi, Rami Al-Rfou, and Jonathan Halerow. Let your graph do the talking: Encoding structured data for LLMs, 2024. Cited on pages 3, 42, and 43.
[64] Jackson Pett, Sjoerd van Steenkiste, Ishita Dasgupta, Fei Sha, Dan Garrette, and Tal Linzen. The impact of depth and width on transformer language model generalization. NAACI, 2024. Cited on page
[65] Jacob Pfau, William Merrill, and Samuel R Bowman. Let's think dot by dot: Hidden computation in transformer language models. arXiv preprint arXiv:240.115758 2024. Cited on pages and 16.
[66] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with unified text-to-text transformer. JMLR, 21(1):5485-555 2020. Cited on pages 1, 7, and 42.
[67] Machel Reid, Nikolay Savinov, Denis Teplyashin, Dmitry Lepikhin, Timothy Lillicrap, Jean- baptiste Alayrac, Radu Soricut, Angeliki Lazaridou, Orhan Firat, Julian Schrittwieser, al. Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context, arXiv preprint arXiv:2403.055530, 2024. Cited on page 1.
[68] Yu Rong, Yatao Bian, Tingyang Xu, Weiyang Xie, Ying Wei, Wenbing Huang, and Junzhou Huang. Self-supervised graph transformer on large-scale molecular data. NeurIPS, 33, 2020. Cited on page 3.
[69] Tim Roughgarden, Sergei Vassilvitskii, and Joshua R. Wang. Shuffles and circuits (on lower bounds for modern parallel computation). J. ACM, 65(6), nov 2018. Cited page 19.
[70] Clayton Sanford, Daniel Hsu, and Matus Telgarsky. Representational strengths and limitations of transformers, 2023. Cited pages 3, 31, 32, and 36.
[71] Clayton Sanford, Daniel Hsu, and Matus Telgarsky. Transformers, parallel computation, and logarithmic depth, 2024. Cited pages 2, 3, 5, 6, 7, 16, 18. 21, 22, 23, 31, 32, and 39,
[72] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE transactions on neural networks, 20(1):61-80, 2008 Cited on page 1.
[73] Noam Shazeer. GLU variants improve transformer. arXiv preprint arXiv:2002.05202, 2020. Cited on page 41.
[74] Kaya Stechly, Matthew Marquez, and Subbarao Kambhampati. GPT-4 doesn't 't know it's wrong: An analysis of iterative prompting for reasoning problems, 2023. Cited on page 3.
[75] Gemini Team, Rohan Anil, Sebastian Borgeaud, Yonghui Wu, Jean- Saan-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M Dai, Anja Hauth, et al. Gemini: family of highly capable multimodal models. arXiv preprint arXiv:2312.
2023. Cited on page
[76] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov. Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288 2023. Cited on page
[77] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention all you need. In NeurIPS, 2017. Cited on pages 1, 16, and 42.
[78] Petar Veličković and Charles Blundell. Neural algorithmic reasoning. Patterns, 2(7), 2021. Cited on page 1.
14

---

[79] Petar Veličković, Adrià Puigdoménech Badia, David Budden, Razvan Pascanu, Andrea Banino, Misha Dashevskiy, Raia Hadsell, and Charles Blundell. The CLRS algorithmic reasoning benchmark. In ICML,, 2022. Cited on page 1.
[80] Heng Wang, Shangbin Feng, Tianxing He, Zhaoxuan Tan, Xiaochuang Han, and Yulia Tsvetkov. Can language models solve graph problems in natural language? In NeurlPS, 2023. Cited on pages 3 and 42.
[81] Colin Wei, Yining Chen, and Tengyu Ma. Statistically meaningful approximation: a case study on approximating turing machines with transformers, 2021. Cited on page 2.
[82] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thouglee prompting elicits reasoning in large language models. NeurIPS, 2022. Cited on pages 1, 2, 16, and 42.
[83] Boris Weisfeiler and Andrei Leman. The reduction of graph to canonical form and the algebra which appears therein. nli, Series, 2(9): 1968. Cited on pages 3 and 40.
[84] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks?, 2018. Cited on pages 1, 3, 8, 9, 40, 42, and 43.
[85] Andrew Chi-Chir Chi- Yao. Some complexity questions related to distributive computing(prelmmnnay report). STOC, page 209-213, New York, NY, USA, 1979. Cited on page 36.
[86] Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Tom Griffiths, Yuan Cao, and Karthik Narasimhan. Tree of thoughts: Deliberate problem solving with large language models. NeurIPS, 2024. Cited on page 1.
[87] Ruosong Ye, Caiqi Zhang, Runhui Wang, Shuyuan Xu, and Yongfeng Zhang. Language is all graph needs, 2023. Cited on page 3.
[88] Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi, and Sanjiv Kumar. Are transformers universal approximators of srquence-to-sequenee functions?, 2019. Cited on page
[89] Wojciech Zaremba and Ilya Sutskever. Learning to execute. In ICLR, 2015. Cited on page 1.
[90] Bohang Zhang, Shengjie Luo, Liwei Wang, and Di He. Rethinking the expressive power of GNNs via graph biconnectivity. In ICLR, 2023. Cited pages and 3.
[91] Yi Zhang, Arturs Backurs, Sébastien Bubeck, Ronen Eldan, Suriya Gunasekar, and Tal Wagner. Unveiling transformers with lego: synthetic reasoning task, 2022. Cited on page 3.
[92] Hattie Zhou, Azade Nova, Hugo Larochelle, Aaron Courville, Behnam Neyshabur, and Hanie Sedghi. Teaching algorithmic reasoning via in-context learning. arXiv preprint wwXi:22/11.0906. 2022. Cited page 1.
[93] Hattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin, Omid Saremi, Josh Susskind, Samy Bengio, and Preetum Nakkiran. What algorithms can transformers learn? a study in length generalization. In ICLR, 2024. Cited on page 1.
A Theoretical preliminaries
For some vector v R.V let
softmax(v)
EN exp(v:) (esp(tt))....xp((uu) exp((u)) e RN
Let eq E mh denote the ith elementary vector, i (1,..., 1) E Rm and 0 (0...., 0) RRmm Let [n] nL.
15

---

A.1 Transformer models
We use a similar theoretical definition multi-layer transformer model to the one employed by [71]. We use bounded communication theoretical model of the standard bidirectional transformer of [77], which assumes that the principal limitation of the transformer's representational power is the low rank of the self-attention matrix. Several theoretical assumptions are necessary to model transformers in this regime:
the interleaved element wiie multi-layer perceptron (MIP) units compute arbitrary func- tions;
the embedding dimension m and number of heads per layer are much smaller than the sequence length N; and
all model parameters, inputs, and intermediate products can be represented with (log N)- bit numbers.
These assumptions are justified in greater detail by [71].
Furthermore, also model transformers having N' additional "pause token" inputs, which are embeddings that contain no information relevant information about the input instance, but which provide longer "work tape" that be utilized for computational purposes [see e.g. 29, 65]. While structurally similar to chain-of-thoo tf-tuughhhhh reasoning [82], these pause tokens are not determined by input. multiple auto-regressive passes over the transformer and do not encode useful information Such pause tokens exist both in the theoretical results of Section (as blank tokens at the end of the sequence) and in the empirical results of Section (as placeholders between the graph representation and the task query for graphs that can be represented in fewer tokens than the maximum sequence length).
Definition 1. Let Transformer H.H.L denote the family of all bidirectional transformers with embed- ding dimension m, number of heads H, and depth L, which operate on input sequences on length N.N" N with N' blank pause tokens appended to the ends. Any transformer f E Transformer H. is function of the form f Nxd + R for some input dimension d, which parameterized by query, key, and value matrices
N.N'
Qe,. KeN, Ve, E RR for E [L]. h E [H],
and arbitrary dementt-wss. MLPs with positional embeddings Φ², ...., o² and a with
R x N + Rm
8 R
N
- for f {1...., L),
+ :R m
x N -R
where for sequence Y of length N N',
(Y (0'(1n (y1, 1),..., . (UN+NN +
To evaluate f(X) some input sequence X (ZI...., IN) Nxd, we define intermediate embeddings yu ...., y L |N(++N")xm follows:
The initial embedding is computed by applying the first MLP @" to all elements of the input X, along with N' "blank" inputs:
yd = ( = (0" Oz 8" (0. + 1)..... (0, + N)).
The intermediate embeddings Y for E (l....,,, L} are computed by applying a unit of multi-headed attention (parameterized by Qe,, Ke,,, Ve, for all h [H) to the previous embedding y followed by element wise application of the MLP d². That is,
y²= of Σ softmax (0(x"-1) (NKT o(x
$If N' = 0. denote the family as Transformer H...
16

---

The output f(X) E R is computed to be the first N outputs of (Y That is,
f(X) (v .(Y, (Y
While theoretical results pertain the bidirectional regime (where masking is applied to the self-attention layer), all results in Appendix C and all lower bounds in Appendix apply to autoregressive transformers as well. Our empirical results utilize causal masking.
Furthermore, an L-layer bidirectional transformer that operates on sequences of length N with N' pause tokens can be simulated by and L-layer autoregressive transformer with O (N +N")) pause tokens. In the regime where N' = poly(N) and = (log N), any positive results for bidirectional models likewise apply to autoregressive models.
A.2 Graph reasoning tasks
We exclusively consider graph reasoning tasks that apply to undirected and unweighted graphs G (V, E) of bounded size, i.e. [V] [E] O(N) for some size parameter N. We define the tasks used for experimentation as follows:
Node count: Given graph G, compute V..
Edge count: Given graph G, compute [E]
Edge existence: Given graph G and vertices u, v E V, return {(u, v) E E}.
Node degree: Given graph G and vertex u E V, return deg(u) = [u, v) E E).
Given graph G and vertices u, E V, return if there exists a path of edges between and and otherwise.
Connectivity:
Cycle check: Given graph G, return if there exists cycle of any length 3 and otherwise.
Given graph G and vertices u, v E V, return the smallest number of edges that forms a path between u and v if one exists and -1 otherwise.
Shortest path:
Triangle counting: Given graph G, return the number of triangles in the graph: ((u, w) (u, u), w)), (u, w) E B.].
These tasks are foundational to computer science and are solved by famous polynomial-time algo- rithms, such Dijkstra's 's algorithm for shortest path and Kruskal's 's for spanning trees. Several of these tasks reap significant algorithmic benefits from parallel computing models, including graph connectivity, which can be evaluated in a logarithmic number of rounds by employing an "iterative merging" strategy [4].
The amenability of some of these tasks to parallel computing is the core principle underlying our theoretical results on transformer model capacity and the resulting contrasts with GNNs. For instance, the iterative merging algorithm for connectivity but message- message-passing passing GNNs cannot do without a substantial width scaling (see Appendix D). Further- more, this parallel computing algorithm is widely believed to be optimal, and crystallization of this as Conjecture 13 is the bedrock of our transformer optimality conjectures.
be simulated by logarithmic-deye -eeth transformer,
The multi-layer results of Appendix B are prrreseettationaaansisit the bounds apply to any fixed encoding of vertices and edges as a transformer input sequence X E Nd The input representation for Appendix C must satisfy the more specified node/edge encoding scheme, which represents each vertex and edge as a single embedding, followed by a query embedding (with optional blank embeddings needed). This encoding scheme is reflected by Figure I and closely resembles the graph instance encoding used for the experimental results
Throughout the paper, we partition these and other graph reasoning tasks into three representational categories: retrieval, parallelizable, and search tasks. The retrieval category contains only four the tasks used for experiments:
'The empirical encoding scheme uses two tokens not one to encode each edge and has fixed size N. For all graphs whose encodings do not require all N tokens, the remaining tokens are blank placeholders that precede the query tokens.
17

---

Retrieval tasks include node count, edge count, edge existence, and node degree.
On the other hand, the other categories reflect two equivalence classes introduce by [60]:
Parallelizable tasks defined to be L-complete and equivalent to connectivity in O(1) rounds of MPC. These tasks include connectivity, cycle check, planarity testing, minimum cut, bipartiteness testing, minimum spanning forest, connected components, one-cycle versus two-cycles (see Conjecture 13), and # connected components.
Search tasks are defined to be NL-complete and equivalent to shortest path in ((1) rounds of MPC. These tasks include shortest path, strong connectivity (for directed graphs), all-pairs shortest path, median, diameter, radius, directed cycle detection, and st-reachability.
Triangle counting does not appear in any of these classes and is separately analyzed in Section 3.4.
B Multi-layer transformers and paralleizableessarcc graph reasoning tasks
In this appendix, we formalize and prove all results in Sections 3.1 and 3.2 that pertain to the parallelizable and search categories of graph reasoning tasks.
The primary technical tool used to establish these results is an improved relationship between the MPC model of distributed communication of [39] and our theoretical model of a transformers (Appendix A. This result is presented informally as Theorem 1, and formally as Theorem 8. Because graph reasoning tasks are well studied in the MPC model of computation [e.g. 4, 60), this theorem enables the transfer of those positive results to transformer architectures. Similarly, negative results that pertain to the MPC model, including those conditioned on the well-known one-cycle versus two-cycle conjecture (Conjecture 13), imply negative results for transformers.
Theorem 8 (Formal version of Theorem I; transformers simulate MPC). For constants 0 < 5 < 8' < and ? > 0, an R-round deterministic (y, 6)-MPC protocol with n inputs can be sim- ulated by a transformer f Transformer H.H.L with depth L O single heads H 1, embedding dimension m = 0 Onn"), context length N and blank chain-of-thouge tokens N' = =max(0, 0(n-t>-8)-1) n).
N.N'
We formally introduce the MPC distributed computing model in Appendix B. along with the one-cycle versus two-cycle conjecture and a collection of positive results from [60]. In Appendix B.2 we formally present the task-specific graph reasoning results introduced in Sections 3.1 and 3.2 and prove them as implications of Theorem 8. We finally contextualize and prove Theorem 8 in Appendix B.3 by modifying the proof strategy of similar result [71] and by showing that MPC protocols can be simulated by a weaker model of distributed computation.
B.1 MPC preliminaries
The massively parallel computation (MPC) model of [39] formalizes distributed computing frame- works such as MapReduce [19] as theoretical models that are amenable to rigorous analysis. MPC pertains to a regime where an input that consists of n "words" is distributed across very large number of machines q (e.g. q = n2.55). each of which contains a bounded local memory (e.g. s zs n where computation on individual machines is inexpensive but communication between machines is costly. We use the definition of MPC of [4], which quantifies the complexity of a protocol by the local memory O(n²). the global memory sq- = O(n1+7), and the number of communication rounds R.
Definition 2. For global and local memory constants 7.0 > 0 and input size an R-round (r, 6)- MPC protocol specifies a distributed computing protocol over ( machines, each of which contains a local memory of size O(n)).
An input to the protocol, which is encoded as a length-n sequence of Olog -bi words, distributed across the local memories of the first [n/s] machines.
In each of the R rounds, each machine computes an arbitrary function its local memory at the time, which specifies at most 8 words to be transmitted other machines.
Messages are simultaneously transmitted (subject to the constraint that each machine sends and receives at most s words of information). and each machine's new local memory is set equal to the messages received.
18

---

After the final round, the output of the protocol is a concatenation of the local memories of the first h/ss] machines.
We say that an MPC protocol computes some function ʃ : Zig + Ziz if for any E Zg encoded as input the protocol, the output of the protocol is f(X).
B.1.1 MPC and graph reasoning tasks
In this section, we introduce previously known results about the abilities of Massively Parallel Computation protocols to solve graph reasoning tasks. The novel results presented in the subsequent section are the primarily the immediate implications of these results and Theorem 8.
MPC round equivalence for parallelizable and search tasks These results largely reflect the contributions of [60], which establish hierarchy of graph reasoning tasks that is reflected in our distinction between parallelizable and search tasks. They show that all parallelizable tasks are equivalent to connectivity in O(1) rounds of MPC and that all search tasks are likewise equivalent to shortest path. (See their Figure 1.) Concretely, they prove the following for all graphs G = GV, EV
with I + E = (n)).
Theorem (Theorem 4 of [60]; round-equivalence of parallelizable tasks). If there exists an R- round (7, 8)-MPC protocol for any parallelizable lask-including graph connectivity, st-connectivity, cycle detection. formula evaluation, planarity testing, graph bipartiteness, connected components, minimum spanning forest, and minimum cut, one-cycle versus two-cycle testing -foorfoooor some ? > O and 8 E (0, 1), then there exists an R' -roudd (?', 8)-MCC protocol for any other other parallelizable task where R' = R + (1) and 7 = max(7,35
Theorem 10 (Theorem 5 of [60]; -ouudeqquivalence of search tasks), If there exists an R-round (r, 8)C protocol for any search task iass-incuuiin st-reachabilityy (for directed graphs), strong connectivitity, directed cycle detection, shortest path, all pairrs shortest path, diameter, radius, and median- for some >> O and E (0, 1), then there exists an R' -f-round (r', 8)MMPCC protocol for any other other search task where R' = + O(1) and 7' max(7,2) 2).
The equivalance of Theorem has more immediate implications for the round complexity of paralleliz- able tasks than Theorem 10 does for search tasks because the round complexity of graph connectivity is well-understood to be Olog n.) and thought to be optimal. We first present a deterministic MPC positive result for graph connectivity.
Theorem 11 (Theorem 6.2 of [16]; log-round connectivity MPC algorithm). For any Y >> and 5 E (0, 1). there exists a deterministic O(log n) -round (7, 8)-CC protocol that solves graph connectivity on any graph G = (V, F)) of size [V] + |F| = O(n).
Hence, all parallelizable tasks can be solved with a logarithmic number of MPC rounds with arbitrarily small polynomial local memory.
Corollary 12 (Log-round parallelizable MPC algorithms). For any > 0 and ó E (0, and any parallelizable task, there exists deterministic (log n)-round (n', 8PC protocol that solves the task on any graph G = EV of size [V] + E = (n))for
m,x(7,3).
The optimality of these logarithmic-round protocols is suggested by conjecture about the hardness of distinguishing between two graphs with n vertices and n edges, one of whose edges are arranged in single cycle of length n and the other in two disjoint cycles of length 2. This is the well-known "one-cycle versus two-cycle conjecture," " which is widely employed as a condition for distributed computing hardness [see e.g. 8, 69, 27].
Conjecture 13 (One-cycle versus two-cycle conjecture, see e.g. [27]). For any 7 > and E (0, 1). any (7, -MC protocol that distinguishes a single length-n n cycle from two disjoint length- nt cycles uses R = Mlogg n) rounds.
Under this conjecture, Theorem 9 immediately implies the optimality of Corollary 12.
Corollary 14 (Optimality of log-round parallelizable MPC algorithms). Conditional on Conjec- ture 13, for any > 0 and 8 E (0, 1). any (7, 8)PM protecol that solves a parallelizable graph task on all graphs G = (V, EE) of size [ E = O(n) uses R Q(log n) rounds.
The round complexity of search tasks is less understood, and unknown if search tasks can be solved by O(log -round (7, -MPC protocols if 5 E (0, f].
19

---

MPC protocols for problems with bounded circuit size More general MPC constructions are known for problems that solved by bounded-size boolean circuits, which include both parallelizable and search tasks. The well-known NC' classes of Boolean circuits that take N inputs and have poly (n) gates and depth (log' n) have been shown to be computable by bounded-round MapReduce- like computational protocols [25] and by MPC protocols in particular [60].
Theorem 15 (Theorem of [60]; log-round circuit MPC algorithms). For any problem in NC
and any Y > O and ā E (2. 1), there exists deterministic O(log' n)-round (71, 87PM protocol that solves the problem.
Since L and NL are known to belong NC², the following corollary an immediate consequence.
Corollary 16 (Log-round parallelizable and search MPC algorithms with high local memory). For any parallelizable or search graph reasoning task and any & > and & E ($) 1), there exists deterministic (log rrouud 6yPP protocol that solves the task on all graphs G = (V, of size [ + E = (N))
Note that these results pertain exclusively to the "large local memory regime," where each machine has memory at 8 = wy)). Therefore, this does not guarantee the existence Ollog ni rround MPC solution for any search task or for any parallelizable task with y < 1.
MPC protocol for triangle counting Finally, the triangle counting task can be solved in the MPC framework by utilizing a special case of parallel algorithm for clique counting. These pertain to graphs with bounded arboricity a, a quantity that corresponds to the branching factor of a node that bounded by the degree of the graph; these apply arbitrary graphs by noting that [V].
Theorem 17 (Theorem 1.5 of [11]; loglog- goooog triangle counting MPC algorithm). For any k 2 3. E (0,1), and 7 > O, there exists an O(log log nr-oound (7, 5)-MPC protocol that computes the number of k-cliques in any graph G = (V, E) with [V] + E O(n) and urboricity O(ni/((-22)
B.2 Positive and negative graph reasoning results for multi-layer transformers
We state formalized versions of the statements of Sections 3.1, 3.2 and 3.4 and prove them by invoking Theorem 8 jointly with the relationships between MPC and graph reasoning of Appendix B.I.I.
B.2.1 Parallelizable task results (Section 3.1)
For the duration of this section, the class of parallelizable tasks includes all of those that deemed equivalent to graph connectivity in O(1) rounds of MPC by [60], as stated in Theorem 9.
We first present a statement that formalizes the existence of logarithmic-depth transformer construc- tions for solving parallelizable tasks.
Theorem 18 (Formal version of Theorem 2; log-depth transformers compute parallelizable tasks). N 'N' For any E E (0, 1) and any parallelizable task, there exists a transformer f E Transformer"" m. H,HLL such that f f(X) computes the task where X E RRN is some encoding of any graph G = (V, E) with |VI+ E = O(N) and f has depth L = Olog N) and heads H = O(1) and embedding dimension and pause tokens N' satisfying either
LoggeethPPass:: = O(N)) and N' = O(N4-()) where è' E (0,c); LogDepthWide: m O(N)) and N' = O, iff 2.
*
Proof. The first bullet is an immediate implication of Corollary 12 and Theorem 8 with y = 3. 8' = e, and c'. The second bullet follows from Corollary 16 and Theorem 8 with 7 = 5 à and
8' e.
We then establish that sub-logarithmic-eptt solutions to any parallelizable task are impossible without having linear embedding dimension m or super-polynomin number of pause tokens N'. under the assumption that the one-cycle versus two-cycle conjecture holds.
Theorem 19 (Formal version of Theorem 3; log-depth optimality for parallelizable tasks). Condi- tional Conjecture 13, for any E (0, 1) and 7 0 and any parallelizable task, if there exists
20

---

N.N N.N' transoommer f Transformer H.H.L that solves the task and has width mHH O(N) and pause tokens N N' O(N1+1), then its depth satisfies L St(log N).
Proof. The proof is consequence of Corollary 14 and result of [71] that proves the to simulate transformers with MPC protocols, an inversion of Theorem We restate that result as follows.
Theorem 20 (Theorem 3.4 of [71]; MPC simulates transformers). Fix any transformer f E N,N'
Transformer, m.H.L. with width mH ((N)) for some 8 (0,1) and total sequence length N N' O(N++2) for some y 2 0. Then, for any 8' E (6, 1) and of = + 2 + 8', there exists an O 40+7)) -round ( protocol that simulates f.
Consider a transformer f E Transformer N.N
m,L. that solves the task with width mH = O(N)) and total sequence length N N' O(N++7 for some constant (0, 1) and 1. Then, there exists an Oc,y (T.) -ooun (1 + 2y + Vc, -PPM protocol that solves the parallelizable task. If
Conjecture 13 true, then 22log N).
L
B.2.2 Search task results (Section 3.2)
We present the main result of Section 3.2 and show an equivalence between the minimum depth transformer needed to solve search tasks in tasks includes tasks that are equivalent to shortest path O(1) MPC rounds (Theorem 10).
manner. As before, the class of searchable
Theorem 21 (Formal version of Theorem 4; LogDepthWide computes search tasks). For any N.N" Transformer m,H,L. such that f(X) computes the task where X E TRN is some encoding of any graph G = (V, F) with [V|+|F] = O(N), and f has depth I, Olog N), heads H = O(1), embedding dimension m ( and no pause tokens (N = 0).
E E (2,1) and any search task, there exists a transformer
Proof. As before, the proof is an immediate consequence of Corollary and Theorem 8.
While both search and parallelizable tasks computable logarithmic depth of considerable width, the minimum depth transformer width (N)) ) for small e that computes search tasks unknown. Despite this deficit, we can still establish the representation similarity of all search tasks by showing that their minimum depths vary by at most a constant additive factor.
Theorem 22 (Depth-equivvllence of search tasks). Suppose for some e E (0, and 7 0 there NN' N.N' exists transformer f E Transformer m. H.H with embedding dimension m = O(N) and total sequence length N + N' O(N++7) that computes the search task on all graphs G (V E) of size [V|+ + E = O(N). Then, for any other search task, there exists some transformer f' e Transformer N. N H.H.L. with embedding dimension m (m), depth L L + O(1), and pause tokens N' = N' + ((N3) that computes that search task.
Proof.
This statement is an immediate consequence of Theorem 10 and Theorem 8.
B.2.3 Clique counting task results (Section 3.4)
We prove the existing of giving more general result that counts the number of k-cliques in any graph of bounded arboricity. Theorem 23 (Generalization of Theorem 7: loglog-depth computes clique counting). For any fixed (0, 1) and k 2 there exists transformer f Transformer m. H. with embedding dimension m O(n)), ) heads H. O(1), depth (log log n), and chain-of offiunhf- thought tokens
transformer that solves the triangle counting task
N.N'
sO N 2 if ((Ne/(k-3)
N'
0
otherwise.
that counts the number of k-cliques all graphs G = (V, F.) of arboricity a and size [V + [E] O(N).
21

---

tokens Theorem 7 follows immediately from taking i = 3.
Proof.
This the immediate implication of Theorem 8 and Theorem 23.
B.3 Proof of Theorem 8
Our principal theoretical result establishes that any MPC protocol with sublinear local memory can be simulated by transformer with sublinear embedding dimension.
Theorem (Formal version of Theorem I; transformers simulate MPC). For constants O < Ô < an R-round deterministic (r, 6)-MPC protocol with imputs can be sim- N.N' N. ulated by a transformer f E Transformer m,H.I. with depth L O(R), single heads H = 1, embedding dimension m = Onn"), ), context length N = n, and blank N' ma (+7-8) n).
8' < and 7,
This offers an improvement on Theorem 3.1 of [71], which only guarantees that MPC protocols with local memory s = O(n 1/4-r) (or with 8 < })) can be simulated by transformers with sublinear embedding dimension. This distinction is significant because several positive results for the MPC protocol (e.g. the ability to solve all problems in L and NL in a logarithmic number of MPC rounds) require= s = S2(N1/22 local memory, and hence could not be shown to simulated by transformers of sublinear embedding dimension previously".
Including an allowance of N' blank pause tokens permits the simulation of MPC protocol with y 2 ie. where number of machines grows super- linerllinearly with n. If y < 8, then the protocol can be simulated without pause tokens (i.e. N' = 0) for sufficiently large input sizes n.
To prove Theorem 8, we define a restriction of the MPC computational model that disallows each machine from communicating with more than k other machines each round of the protocol.
Definition 3. For constants 5. p >> 0, an R-round (7, 6, p)-MPC protocol on input sequences of length n a (7, 8MPMPC protocol (Definition 2) that obeys an additional constraint on the number of outgoing and incoming messages. Namely, for some capacity k O(n²), in each round, every machine can send its local memory to and receive information from most distinct & machines.
Theorem 8 is an immediate consequence of Proposition 24 whih establishes that any (7, 8) MMC protocol can be simulated by a (7,6, PMPM protocol and Corollary 35iich shows that any 8, P)-PCC protocol can be simulated by transformer.
Proposition 24 ((1, 6, PM-MC simulates (7, 8)-MPC.. For constants > 0 and p E (0, 3) if
I can be computed by an R-round (7, -MMP protocol, then there exists O R(++2) -rounnd (1, 1,,8, PPP- protocol that computes
well.
Corollary 25 (Transformers simulate (1,8,p PMPMC For constants d (0,1) and 7,P > 0, an R-round deterministic (7, 8, P)-MPC protocol with n inputs can simulated by a transformer N. NN Transformer m. H.L. with depth L R+ 1, heads H 1, embedding dimension O( log n). context length N TI, and blank chain-of bfrin-of-thought tokens N' = max((,, -
8' "a e for some small constant e (e.g. = min( T "-A))) By Proposition 24, we can simulate the target R-round (7, 8MPPC protocol with an R' -ound (%,,, -MPC protocol for
Proof of Theorem 8. Let min( 3
R(1 72) min((8 5) 82)
We apply Corollary 25 to conclude that this latter protocol can be simulated by a transformer of depth L = R' and embedding dimension
m 10 Onn').
For this theoretical model the transformer to non-vacuous, the transformer must have embedding dimension m = d(Nd). Without this, any function over X E ig xid could be solved by a single-layer transformer that concatenates all inputs into single vector in an attention unit and passes that as input to an MLP that solves the problem.
22

---

We prove Proposition 24 in Appendix B.3.1 by simulating single round of a standard MPC with multiple rounds of restricted MPC, where messages are sent intermediate "neighborhoods" which contain collections of machines with similar destinations-44 of increasing fine granularity. We prove Corollary 25 in Appendix B.3.2 by a minor adaptation of the proof of Theorem 3.1 of [71].
B.3.1 Proof of Proposition 24
Fix an R-round (y, 5)-MPC protocol и with imput size n, q = OO machines, and O(n)) local memory. To prove Proposition 24, it suffices to show that single round of MPC communication
can be simulated an O (1+7)² -round (7, 6, pM-MCC protocol.
To formalize the communication procedure to simulate, we let Outbox = (Outboxj.... Outbox,) denote encoding of the outgoing "message packets" from each source machine that obeys a' local memory constraints. Concretely,
Outbox; = (Msg, Dst): Src = i, Dst E [a]] s.t.
Msgi S s.
MegEOutbox.
Let Inbox = (Inbox Inbox,) denote the same collection of message packets, organized by their destination machines.
Inbox, (Mag. Src, Dst) Outboxsre Dst =i}
Mag S s.
NagEInbox,
It suffices to prove Lemma 26.
Lemma 26 ((7, 5, P)-MPC simulates one communication round of (y, 8)-M)., If 5 there
2"
exists an O (1+7)² )-round (y, P)-MPC protocol that takes as input any Dutbox and returns the corresponding Inbox.
Proof. We define r = O (17) intermediate steps and prove that each of those can be simulated. The intuition is that each an intermediate step routes each packet (Msg, Src, Dst) machine that belongs to the same "neighborhood" as Dst. Each step maps each packet to neighborhood of smaller radius than the step before, until all packets have been transmitted their proper destination location.
We define tree of neighborhoods as follows, Fix some branching factor é ((n//2) and number of intermediate steps Log 0( For any step t = O,..., r and neighborhood index
j b. Nbha = { -
we define
-j- + + ....... (-))((()))
and observe that it satisfies the size constraint Nbhad; S E"- We let Nbhd' (Dst) denote the unique neighborhood Nbhd', satisfying Dst E Nbhdy. We say that Nbhd < Nbhd',, if j < j' (and equivalently, for all i E Nbhd', and i' Nbhd < i'). Let
Nbhd 1+1 Descendants' (Nbhd)) {Nbhd" (i) ; Nbhd
(+1 Children(Nbhd') (b ,bbha,
Parent (Nbha,) Nbhd [//e]*
Ancestor (Nbhd?) Nbha"()) for E Nbhd
for some
Note that the following are true of neighborhoods.
The initial "step O" neighborhood contains all machines (i.e. Nbhdf [q). and the final
"step r" neighborhoods contain single machine (i.e. Nbhdy {j} for j [q]).
For any t < r and [bz], Nbhd,, is the disjoint union of all sets in Children(Nbhe) and Chi (Children(Nbdd)) < l.
23

---

Step 0
Step Mhnds
Step 5 Wonds
Step r Ahads
itndd
machines per
mochines Wobd
o/2² muchines
mochite Hold
Nbhdy Machine Dutbox
Nbhdj Machine Outbox
Nbhdj
Nbhdj
Machine Dutboxj
Machine 2 Outbox!
Nbhdy
Machine q/e Outbox 9/c
Nbhd
Nbhd 2 f+1
Nbhd
Nbhd,
Machine Outbox
Machine
Machine g Dutbox,
Outbox
Figure 4: The neighborhood routing structure.
{Nbhai..... Nbhaf,, comprise disjoint union of [g].
For any Dst E [g]. there exist unique sets Nbhd"(Dst),
(Dsd"((stt) that satisfy
Nbhd" (bsd"(Dst) C... Nbbdd
and (Doht Parent (Dst)).
We define collection of MPC machine states as "intermediate outboxes" Outbox' (Outboxf,.... Outbox!)) for each step represent an assignment of message packets to ma- chines in the same fth-level neighborhood as the packet destination. That is, require that each Outbox satisfy
Outbox! SMc, Dst) i Nbhd' (Dst))
We say that Outbox' are valid intermediate outboxes for Outbox if:
1. Outbox' satisfies Equation (1);
2. there is a one-to-one mapping between packets in Outbox and Outbox": and
3. local memory constraints are maintained up to factor of two
Msgl S 2s.
Eeg
For the sake of simplicity, we assume that the encoding Msg also contains all relevant metadata about the packet Src and Dst. That is, only track the message size iMsg].

---

Note that Outbox satisfies the conditions for Outbox", and the only sequence of embeddings that satisfies the conditions for Outbox' is Inbox. An inductive argument that applies Lemma 27 r times completes the proof.
Lemma 27 ((7,, 8, p)- -MPC simulates one intermediate step). For any {o,.... 1) and p < there exists O ( (?i, p)-MPC protocol that takes as input any satisfactory Outbox' and returns some satisfactory Outbox"*1,
Proof. The protocol operates in phases:
1. The pre-computation phase, where relevant message size metadata is computed using Or - t) rounds of communication.
2. The message-passien ppssingg phase, where all messages are propagated in t rounds of commu- nication in order to convert Outbox' to Outbox't1,
Since r- = -0 the bound on total number of rounds is satisfied.
The algorithm maintains the invariant that communication oceurs within 1-level neighborhoods Nbhdý, without any mixing between neighborhoods; this is possible because of the assumed validity of Outbox', which implies that all messages whose packets appear in Nbhd,, of Outbox' have ultimate destinations in Nbhdf. Concretely, if (Msg, Src, Dst) Outbox and E Nbhd then Dst E Nbhd
We first explain the routing strategy for the message- machines that each message packet will be routed to and proving that this itinerary meets the conditions needed to be executed by an (r - -t)-round (y, 6, p)-MPC protocol. We then describe how the metadata necessary for the itinerary computations be obtained during the pre-computation phase.
phase by describing an itinerary of
Message-pasee paaaggeppasinggggooo phase. We first introduce some packet notation to track all relevant metadata about any message in the /th intermediate step. Fix particular input Outbox'.
Let (Msg, Src, Dst, Src') denote a packet that contains message Mag and meta- data concerning its "global" source Src and destination Dst (i.e. (Msg, Src, Dst) E Outboxgre: Inboxpet) and its "local" source Src' from within Outbox (i.e.
(Msg, Src, Dst) E Outbox'
We write e Outbox if Src and Nbhd if Outbox for some Nbhd.
Let SrcNbba (P) Nbhd" (Src') represent the neighborhood of size fr-r contains (i.e. P SrcNbhd (P)) and DstNbhd' (P) Wbhd"=1 (Dst) denote the neighborhood of size gr-t-1 that contains the ultimate destination Dst. Because P E Nbhd', if and only Dst E Wbhdf. it follows that DstNbha' (P) SrcNbha'*(P).
Let PP| =
|Msgl be the total number of bits needed to encode the packet.
We establish a lexicographical ordering that depends first on Src' and next on Dst. That is, we say that P' for some P' (Msg', Src', Dst', Src") if Src" Src', or Src" = Src* and Dst' < Dst.
We develop packet scoring function 2 (P), which in turn induces an itinerary function (P)(P) E [g] that assigns an intermediate machine to hold packet after communication steps. These functions are carefully chosen in order to ensure that the local memories of each individual machine are bounded by Oss) and that the number machine each sends messages to and receives messages from bounded by O(E²). Critically, we ensure that 14-T (P) E SrcNbha (P);; that is, we initially rearrange packets within solely within the smallest neighborhoods Outbox and gradually propagate packets more widely. That way, each packet obeys trajectory of the following form over t MPC
25

---

rounds:
8t. (P) = =Src' E SrcNbhd (P) (P) = b4.51 (P) E SrcNbhd -- (P)
(P) E SreNbhd ++1 (P) = (P) E DstNbhd' (P).
4++
To define these functions, first define partial sums of message sizes in order later determine an itinerary of machines that will be routed to in between Src* and some destination machine in DstNbhd' (P). The first term, EqualDstSum" 4. (PPmmmpPP (P), sums the size of all "lesser" packets that share destination neighborhood DstNbhd' (P) and a 7th level input neighborhood SrcNbhd'. (P):
EqualDstSuu" 4T (P)
Σ
P
F'ESrelibid " (P)
DetMibdd Det) (P) F'<P
The second term, LessDstSum '7 (P); sums the size of all packets that share input neighborhood but have "smaller" destination neighborhood than
LessDstSum (P) (T LessDstSum (Strottdu DstNbhd' (P)),
where
LessDstSum' (SrcNbhd,
(SraDDstSum(SrrNbad DstNbhd)
Σ
JP/|
P' D'EBredbbd DatMbad (F') <DD)<Dba
We now define the packet scoring and itinerary functions for any E ft.
[2s min S (P) + "essssstSumm"(PP + EqualDstSun" (T (P)
72 1,,
2ss Din (P) EqualDstSSun
7=t.
2 =^7(P)
bd (P)
2s
We prove a series of claims to establish that the packet scoring and itinerary functions are properly defined. Claim 28 (Itinerary range). For any t E (t....,r). the functiin satisfies
"r (P) DstNbbhd
6- (P) E
l.
As an immediate consequence, (P = Src² for P (Msg, Src, Dst, Src*).
Proof. We first bound the scoring function zt,, Note that LessDat.Sum! (P) + EqualDDs.Sum""
<
Σ
PP| PP|
Pre (P)
SrcNNbaa AF (P)] 2s - IP/.
Therefore, for 7 > t,
3 (P) E [2s min (rrcNbbd":7(P)) 2s (min SrcNbbd (P) |SrcNbhd (P))) [P]]]
(2)
and
(P)( E [min SrcN (P), min SrcNbhd (P) (SrcNbhd'
which proves the first case of the claim. The second case follows by observing that
EqualDstSun' ((P) < s |DstNbha' (P)) PP|.
Were not true, there would exist at least one machine i E DstNbhd' (P) that must receive more an quantity of messages at the end of the entire round of the protocol (i.e. EmegeInbox, |Mag] >> 8).
which contradicts the MPC assumption.
D
26

---

Claim 29 (Gaps between scores), Pf # P2 and (T) - (P2). then
=t,- + |P S (P2).
Proof. First, let t t. Consider the case where SreNbhd' (P1) # SreNbha (P2). By Claim 28 and our assumption that (P1) S (P2), it must be the case that SreNbhd 1/ (P1) (reNbhd'r((22) Hence, we have the following by applying Equation (2).
LT (P2) - -R,,((1)
2 2s (min SrcNbhd (P2) - (min SrcNbhd (Pi) + SrrNbhd"M(PR - Prl))
PPll-
Otherwise, SrcNbha (Pi) = SrcNbhd -7 (P2), then
br (P2) - 2r (P1) = (LessDstSum"1 (P2) + EqualDatSun ff (P2)) (LessDatSum (Pt) EqualDstSuum 4 (Pt)))
Σ
P'
PP/
P'ES2
P'ES
for packet subsets S2 (P1) By further inspecting the respective LessDstSum" and EqualDstSum terms, we observe that S C S2 and P1 E S2 S1. The claim immediately follows.
The argument for the case = is nearly identical.
Claim 30 (Local memory bound). For any E N,
Σ ())
S
2s
T TE rt,
38
TE 1e4,1,....,,rt
Proof. The case T r is an immediate consequence the inductive assumption that Outbox satisfies the desired intermediate properties.
For all other cases, let (PI....,P,, Pn denote all packets with b--7 (Pt) and let 2 (P1) S (Px) without loss of generality. We use Claim 29, the assumption that all |P S s, and the boundedness of 2 (P,)) from Claim 28 conclude the proof.
P < (P(PP) - (P.) + |Pxl
< 1. (P.) - -4T((P)) +
288 T == t,
38 T T>L. L.
Claim 31 (Intra-class distance preservation). If Pi and Pa satisfy SrcNbbd Srclbhd (P2) and DstNbha' (Pt) = DstNbhd' (P2), then
2r (Pt) A0 (P2) 2 fr+l (P1) 2
Proof. Since SrcNbha 4. (P1) SrcNbba T Srclbbdd (P2) and therefore,
+ (P2), follows that SraNbba!:((Pi)
(P1) 2h. (Pz) EqualDstSum (Pi)
EqualDstSSu (P2)
Σ "'ESreNbhd" ( (P:)
PP
(3)
DatWbbdd Dpt" (D')=DatModd (P1) Pr
24r+1(pi) + EqualDatSun' 1r (Pi) EqualDstSun' 1.7 ((2)
Σ
IP'L.
P' D'EBreNhad'rr (
DatNbhd Dat))
Dattbndd (P1) P.
27

---

Because P2 SrcNbha -- (Pi), the defined packet ordering implies that any P' E PP). must satisfy P' E SrcNbba (Pt). Therefore, Equations (3) and (4) are equal and the claim holds. f
Claim 32 (Distinct recipients bound). For any b, 1600r (P) (P =b} 34.
Proof. Within each root neighborhood Nbhdj, there exist at most destination neighborhoods in DstNbbd for P E Nbhd5-
Fix some such DstNbhd and let PI....,P,, Pn. denote all packets with ber+ (P) = b and DstNbbd DstNbhd. Without loss of generality, assume that 2 (P1) .... z (Pr).
Because all such packets belong to the same machine step r -- - (i.e. (b,+)(P;) b for all i E [n]), they belong share the same source neighborhood of size (--T-1 (i.e. SrcNbhd (P,) SrcNbba (P))). By Claim 31 and the definition of 6t.T.
b¹ (P.) 6t.5 (P1) S +
(P.) - (P))
28
+1+ ( (P:) -//,++1 (P1))
2 (Px) - bz.++1 (P,) =
Therefore, there are at most three possible values of b-7 (P:).
The claim follows by considering each the l destination neighborhoods separately:
( (P): b +1++1p (P) =b}
Σ K
b (P) :
b, DstNbha' (P) DstNbbd))
DatMbbd
S 32.
Claim 33 (Distinct senders bound). For any b, ( 6t (P)( = 6} 36
Proof. Within each Nbhdj, there exist at most L distinct pairs of destination neighborhoods DstNbbd' (P) and source neighborhoods Wbha (P) for E Nbhd"".
As before, we fix some Dstäbhd and SrcNbhd and let Pı...., Pn. all satisfy ((x((P)) = b. DstNbbd' = DstNbhd, and SreNbhadr+1 SrcNbhd. Using the same argument, we show that
(b E [n]]] < 3.
We conclude by considering all such pairs.
As result of Claims 30, 32, and 33, conclude that each packet P (Msg, Src, Dst, Sre') be equipped with some itinerary
Src = 6 (P), ger (4..., (P((P) E DstNbba'
that properly translates an instances of Outbox' to Outbox and does so without ever requiring local memory more than 3s O(N²) any intermediate step any machine send or receive messages from more than 3/2 = (N)) other machines. This itinerary can be executed using an t)-round (7, 6, MMCC protocol.
Pre-computation phase. It remains to show that each b4T can be computed for each packet. To do so, we prove that there exists an O(r -roud (y, 8, -MPC protocol that ends with each machine i knowing EqualDstSum's (P) and LessDst tSum fir (P) for each E Outbox; and E (t....,r) r.. We design an MPC protocol that uses the tree structure to propagate information about individual child neighborhoods to their parents and vice versa. We describe recursive relationships that elucidate how to compute the two salient quantities.
First, we introduce a useful intermediate term. Let
EqualDstSun (i, DstNbnd)
Σ
Σ P'EDutbax; Det "etNuad'(p')==a) Datt
PPI.
d'ENoba" (i) (<1
28

---

denote the sum of all packet that are contained by "lesser" machines that share source and destination neighborhoods. Note that EqualDstSun (P) can be computed for any Outbox; locally by machine i given prior knowledge of EqualDstSun' phase need only compute the latter term.
DstNbhd' (P)). Thus, the pre-computation
We also introduce term that represents sum of the sizes of all packets that share source and destination neighborhoods:
NbhdSum' (SrcNbhd, (StNWb)
Σ
P//.
P' @BrcNbbd DatMbad ( DDDatNbd
Now, we provide the recurrences for any (or for any SrcNbhd satisfying [SreNbhd] > EqualDstSum" 4.7 (1, DstNbbd)
EqualDstSum h. (i,, DstNbbd)) + EqualDstSum" f7 (min Nbhd +1))+ DstNbbd)
= EqualDstSun' 4T++ (i, DstNbbd) +
MbbdSum'(Srcchaaa DstNohd),
Ehcrbadcchiddreee (Bbnd" (8)
Sre (+)
NbhdSum' (SrcNbhd, DstNbhd)
WbhdSum (5)
Sretibid' Childree(SSrrbblae
LeesDstSSu'(SrcNNbir DstNbhd)
Σ
LessDstSum (Srrcct, DstNbhd),
SreHbba' c (Sheléren(Srrfhhad))
(6)
When the terms EqualDstSun DstNbhd), (oondSum'(bbhd (t), DstNbhd), and LessDstSum' (Nbha" (i), DstNbhd) can be computed locally within machine
We follow tree-like communication pattern compute all relevant sums. Each machine i E [d] computes
[EqualDstSum DstNbbd) 7 2 I, Dstäbhd e Children(Nbba (1))
and
{ LessDDtSSmm' (Nbhd" (i), DstNbhd) 2 DstNbhd Children(Ubhd (i))
by completing r propagate-up rounds, aggregation rounds, and propagate-down rounds.
The propagate-up rounds compute the neighborhood-wide message-size summations NbhdSum' (Nbhd" (i), DstNbhd) and LessDstSum' (Nbhd" (i), DstNbhd) in each machine satisfying min Nbhd (i) for each and DstNbhd.
The aggregation rounds accumulate NbhdSum terms of the same level into specific EqualDstSum terms.
The propagate-down rounds iteratively compute and share the EqualDstSum and LessDstSum terms with all relevant machines.
Propagate-up rounds: Fix some neighborhood Nohd After propagate-up rounds, the goal to compute the terms NbhdSum's (rreNbdd, (SreNbd, DstNbhd) and LessDst.Su'' (SrcNbhhd, DstNbhd) for each relevant destination neighborhood Dstbbbd E Children(Nbhd,) and source neighbor- hood SrcNbhd Descendants" (Nbian within single machine in each source neighborhood, min SrcNbhd. We argue that this is possible inductively.
Before performing any computation (that is, after "round 0"), each machine i individually com- putes NbhdSum's (Nbhd" (i), DstNbbd) and LessDat.Sm'' ( (i), DstNbhd) by aggregating the messages encoded in its own representation of OutboxŞ.
29

---

We assume that the procedure works specified for r - r rounds of communication. Fix some SreNbbd"-1 Descendants (Nbhd)). Then, for every SreNbhd" ChildrenSrelWhhd"" the quantities
DstNbbd)) DstNbbd e Children((bbdd))
CaraDDDstSuummSrrcbba DstNbhd) DstNbbd Children(NNbhd))
have already been computed and stored in min SreNbhd'. By the recurrence relations of Equa- tions (5) and (6), NbhdSum' (SrounndSSd DstNbhd) and LessDstSum' (SrcNbhd""1 DDtNNhd) DDstbbh are functions of those quantities. Thus, suffices to have each machine min SrcNbhd" machine transmit its relevant terms to min SrcNbhd" A round of MPC communication that transmits such messages involves each machine sending most one message of size and receiving most & messages, each of size (E).
Inductively, ensure that all neighborhood sums computed after propagate-up rounds. Because each machine handles at most distinct messages having total size (Ee)) per MPC round, this protocol does not violate the bounded message size and bounded distinct message constraints (so long as C < s), which can be guaranteed for sufficiently large so long as l = ((n
Aggregation rounds: After the completion of the aggregation rounds, each machine computes terms of the form
(EqualDstSumfT 47 (min Nbhd +1 (t), DstNbbd) DstNbbdd E Children(NNbdj))
from relevant NbhdSum terms if = min Nbha (1). By the recurrence, it is sufficient for machine i following e distinct terms
WibhdSum'(Srrcbbii (
DstNbhd) SrcNbbd Children [bhnd" (i)), Children(Nbhdd))
Since all machines i already knows such terms for SrcNbhd Nbbd (1), it can obtain the remaining NbhdSum' terms by simultancously sharing information with its "cousin machines:" min SrcNbhd, for all SrcNbhd E Children (ooirreeenNddddieee This can be handled by a single round of communication where each "(r + letel neighborhood representative" machine forwards its sums sums up to l other first representatives, for total messaging cost of ((e).
We separate rounds to repeat this process for each 7 t.
Propagate-down rounds: LessDstSum' SNunDddd (Nbhd"(i), (i),-) term at each machine i. The relevant LessDstSun' terms have already been computed by each respective min Nbhd" (i) machine and can be propagated to machine i by using r - rounds of tree-propagation through intermediate min Nbhd (i) machines.
remains to compute each EqualDstSun (i, and
The same is possible for EqualDstSun fT terms, although the individual terms need to be added in order to follow the recurrence. We propagate the terms in the same way as the LessDstSun' terms, but we take special care to carry out the extra additions. This can be accomplished simultaneously to the other propagate-dow down rounds. This protocol involves each first-child node sharing at most distinct messages, each of size at most O((r- - t)).. As before, every node sends and receives most O((r - t) < s words.
After these 3(r f) rounds have elapsed, each machine i computes b-7 (P) for each P E Outbox Using this itinerary, the machines routes tuples of the form
(P, b- (b.)..(.....(P))))
to the respective machine (4-(P) in round - r. Due to the arguments presented at the start of the section, this procedure terminates with each (Mag, Sre, Dst, tuple being held by some machine i such that the resulting Outboxc+ is valid, and the procedure involves at most O(r = 0 1+7 rounds of (r, 8, MMPC computation.
B.3.2 Proof outline of Corollary 25
Corollary 25 (Transformers simulate P))PCP) For constants E (0,1) and 7.P > O, an R-round deterministic (r, 5, PMPC protocol with n inputs can be simulated by transformer Transformer N.N' N.N' m. H.H.I. with depth L R+ heads H 1, embedding dimension m = 5 log
context length N- n. and blank chain-of- oftthuugh tokens N' = max((, O(n ( n).
30

---

The proof of Corollary 25 involves an adaptation to the proof of Theorem 3.1 of [71]. To avoid restating the proof in its entirety, we provide a brief outline of the proof of Theorem 3.1 and explain which modification is necessary.
Theorem 3.1 is consequence of Lemmas B.4, B.5, and B.6 of [71], which establish that there exist single-layer transformers that simulate the initialization, a round of computation and communication, and the output formatting of any fixed (7, 8)-MPC protocol. The input and output steps of (7, 8), and (7, 6, P)-PCC protocols are identical, only Lemma B.5 needs to be examined.
To simulate single round of MPC protocol with transformer, all local computations simulated in the element-wise multi-layer perceptron (MLP) units, and all communication handled in single multi-headed self- aiffaateetion layer (Lemma B.7) Since (7 6, p)MPPC protocols add no restrictions related to local computation, the former can be simulated in exactly the same manner with identical MIPs,, and it remains to analyze the construction of Lemma B.7. We restate Lemma B.7 and provide an replacement lemma that suffices to prove Corollary 25.
Lemma 34 (Lemma B.7 of [71]: multi-headed attention simulates MPC communication). For any R-round MPC protocol with local memory and q machines and any round r E [R 11. there exists 9:0 single-layer transformer E Transformer m. H,1 with H Olog log and m Oss log q). which, given as input length-q encoding of each machine 's outgoing messages in round r, returns an encoding of each machine's incoming messages in round r +
Lemma (Single-headed attention simulates bounded-message MPC communication). For any R- Rordund MPC protocol with local memory q machines, and a k-machine communication limit and any round r E [R- - 1), there exists single-layer single-headed transformer f Transformer 4.0 m.H with H and m O(K's log 9), which, given input length-q encoding of each machine" outgoing messages in round returns an encoding of each machine's 's incoming messages in round r 1.
Lemma 35 is an immediate consequence of Lemma 3.2 of [71], their main technical result, which already applies to the regime with limits on the number of machines in communication.
By replacing Lemma 34 with Lemma 35, applying the remainder of the proof of Theorem 3.1 of [71], and letting k- = (n²), the proof of Corollary 25 is complete.
C Single-layer transformers and graph reasoning tasks
This appendix presents the results of Section 3.3, which separates the collection of graph reasoning tasks into those retrieval tasks that can be efficiently solved by single-layer parameter-efficient transformers-inchuee
node count, edge count, edge existence, and node degree-and those parallelizable or search lasks that require deeper constructions-ineluee path, cycle check, and triangle count. Taken together, these results establish that the single-layer transformers of the Depth1 1 regime are capable of solving simple aggregation- basedd tasks, but that their known limitations in capacity communication protocols of [70] apply to non-trivial graph reasoning tasks.
connectivity, shortest
We specific a particular node/edge encoding of an input graph G = (V, E) and graph reasoning task using a consistent encoding scheme that closely resembles the encoding used in our graph reasoning experiments and those of [42]. This encoding is distinguished by the fact that each node and vertex of the graph G is represented by exactly one token, rather than the pair tokens utilized in our experiments. This choice ensures that any trivial pre-processing of graph inputs (e.g. using a positional embedding to associate each edge token pair) need not count towards the lingle-layer transformer model.
Definition 4. The nodeledge encoding of graph G = (V, E) with V S [n] and V + and graph reasoning task P is sequence
E
N -1
x x X = (rı,..., σN) E Nxd
where d = 5 and each
x; (x} ot is isVeeseeeeesssee isEdge, isTask;) (0, x 10,
satisfies the following conditions:
31

---

For each v E V, there exists exactly one i E [N 1] with (2. 0, 0,0).
For each (u, v) E, there exists exactly E [N 1] with x; (u, v, 0, 0,1
The token n encodes particular instance of the task P. by encoding isTasky = 1 with optional edge or node encoding. That is, for tasks without arguments (such as triangle count), z = (0, 0, O, 0, 1). For tasks with a single node argument v E [nx] (such as node degree), NN (v, 0, 1). For tasks with a pair of node arguments u, E [m] (such as shortest path and connectivity), IN = (u, U, 0, 1,
All other tokens satisfy I; (0, 0, 0)
We say that single-layer transformer f E Transformer solves task on graph G if the output corresponding to the task description f(X (G, P))N encodes the output of the task. Since f is a single-layer transformer, we can write this output as
f(X)N v Σ softmax ( oX)V,
for element-wise multi-layer perceptrons
Φ Rdd + IR
R +
broadcasted across each input (i.e. <(X) ( ..... ((EN)) R Nxm> and weight matrices
QI..... QH Ky..... KH, Vi...., VH E E m=
Throughout, we assume that parameters in the transformer model and intermediate numerical quantities can be written using (log N -bit floating point numbers. This assumption can be satisfied for the positive results of Appendix C.1 and necessary to obtain the negative results of Appendix C.2.
We permit the Hlement-wise MLPs á and v to be arbitrary functions for the negative results, while restricting them be MLPs that can be approximated using bounded-size multi-layer ReLU networks for the positive results. While we do not make these ReLU networks explicit, we restrict ourselves to simple operations that can be computed using linear transformations and the application of smooth univariate functions.
Finally, we acknowledge that the negative results in are largely superseded by those of [55], which establishes that L-complete languages (including graph connectivity and cycle check) cannot be efficiently solved by constant-depth transformers, let alone single-layer transformers. We include these bounds anyway to mark a contrast with our positive results; draw further connections to the communication complexity lens transformers; and exhibit simple task instances (G, P) that require greater depth, including constant diameter and constant degree graphs.
C.1 Positive results for single-layer transformers
Theorem 36 (Formal version of Theorem 5; Depth11 computes retrieval tasks). Fix any graph reasoning task among node count, edge count, edge existence, and node degree and any graph size N. Then, there exists single-layer single-headed transformer E Transformer mansformmemm.... with embedding dimension m Ollog N) that solves the task all graphs G (V, E¹) of size [ E < N -1 formatted as nodefedge embedding sequences.
N
Proof. We prove that single head of atlf-attention with input and output MLPs can solve these retrieval and aggregation tasks in parameter- parameter-efficient manner by first carefully designing universal input MLP Φ Rd + IR'h for some = O(log N) to produce embeddings that encode useful graph properties. Then, we define task-specific query, key, and value matrices Q, K, V :E R and output MLPs 1 Rm - R that produce the correct answers. While we do not explicitly account for preee-precisio computations, all of the operations utilized can carefully implemented to respect Ollog N bit floating-pot point numerical representations using the technical approaches of [70, 71].
32

---

Shared sinusoidal embedding MLP. We denote the embedding output of the input MLP as (xx+) = (isTask, isVertex, isEdge, ('x E T
for some x'(x;) Rd + 22m for some m' = O(log N) and m = 2m' + 3. For some fixed a1....,, am? [0, 1] to be determined, let
(aat)
isVertex; =
(x;) = 5(a),
if isEdgg, = 1, otherwise,
0
where is sinusoidal embedding MLP for nodes with
(v) (sin(2 v),, cos ()) sin(2nam cos( Rmmm and & is an edge embedding satisfying
(8)
m'
E(u, r)) m' + n (n(() + +v))).
We first show that the node embeddings are approximately orthogonal. By employing standard trigonometric identities, we obtain
m cos(2 v)),
7(u)Tn(1)
Σ
and note that [lm(v) m'. We use standard concentration argument to prove that (ı7( nuu] < m' if o with high probability.
Claim 37 (Nean-itthogonality of embeddings 1)). There exist coefficients a1, am E [0, 1] that comprise the embedding [m] R of Equation (8) such that
In(u) nT()| s 2 2/mm log n, if +
Proof. We employ the probabilistic method. Consider m' iid random variables a am ~ Unif([O, 1)) and let r represent the respective node embedding. Fix some arbitrary E [n]] with f and note that
m
(u) ())
( = Σ cosl cos (2Ta, - u)).
For any j [m'', the integrality of implies that
E ( v))] 0.
Hoeffding's ' inequality provides the following bound:
4m' log
1
Pr [n((uTTTe 2 2/ m logn cxp
2m'
n
By applying a union bound all (7) choices of u and v, we have the following:
n(n - 1)
Pr Vu, v E [n], u = u: In(u) T (7)) 2 2 m' logn
1.
2n²
Hence, there exists a satisfactory set of coefficients ai,... am'
For some 7 satisfying Claim 37, let X mex, In(u) (n(u))(oo) < 2 logn. By taking
m' Olog n) sufficiently large, we guarantee that S me' for any constant c c 2.
We then bound all relevant inner products between vertex and edge embeddings for sufficently large m' (and sufficiently small x). We assume throughout that u, u v, v' are distinct and note that {(u, v) E(v, u) (and omit symmetric inequalities).
33

---

[n((e)11 m'.
(9)
m
(n(u) (()) S X
(10)
m' + (n((u(TT(ni m =0.
(n(u)T((u - ml|
(11)
m' + ( m(()) m'(n(u) "n(')) + ((())((()))) S m - S 4x S m
2m'x
In(w) v(v',
(12)
m (nnn)T((())
4
m²² (2m' + 2n(u) T (())) - 2m' + nu) n(u))² (
[[[(,, v)ll 2ml²
(m' nuu) (ou)Tn() n/(1)2
Om'n(u) 1T())
2m'x
ml
m' - S 44 4
(13)
m' + 17( (T)TT(())))))))))))()))))))))()
m²² nqu)) +((0')(+()))) n(u) ( m/(1)
((v)T((()) m
[(u, ((),,, -mm m'l
(m' + n())) + (((()) - m mnn mt)n [((()
(m' + ( (()
()))
m 2 x + m'x²
m'
- 4x 4 m'
(14)
(m' x)2
m m2 (n(u) T (n(")) + 77 T m)((0))))))))))) + (((u))n(u)) + n(o)
K(u, u)) E(u', "((',,22))
(m' + m ((1)) (m + nn(()
4m 16x s m
(15)
(ml' x)2
Therefore, conclude the following bounds:
m' m
n(w) E((') u'), E(u, v) " o')
4 4
3m
5xmL
[1(()) v(u) Tu)),((, v), E(u, E( o') E
4
4
7m'
9m
[kEu, v)11 { E
4 4
We now apply the above bounds to prove that each task can be solved by a single-headed transformer with weights Q, K, V Rmxm, output MLP sb 1 + E. and shared input MLP & discussed previously.
Node count task. If P encodes the node count task, we specify weights matrices Q, K, V in order to ensure that QT ((N)) m'er": ; K' ((x;)) (isVertex; + isTask;) ei; and VT (bx;;) isTask, el 10 Then, the following true of exponentiated keylquery inner products and scalings products of value vectors:
em
friverree = or N.
<Qp ((x;)) =
otherwise.
m'
ee
ifi
otherwise.
Note that QT (xxx) the only relevant query embedding the output f(X)x; :; see Equation (7).
While we do not specify the entries of Q, K, V. they clearly linear transformations.
34

---

The output of the softmax is then
softmax ( (K((((())))))) o(x)) E (K(
Ei= exp(o(xx)1QX TQKT o(x;))
em
e (1+ +1 (N - |V| 1)) 61-
Let
yn = (softmax (Ø(#N) (QK (x)) (()V) ER
denote the first coordinate of the softmax output. By taking m' 2 log( (N), we guarantee that
1
UN E
1+
I+
S
5 + [V 1+ [
By letting the output MLP & approximate the function (x2) ensure that [(X)x = [V
1 for E [1, + +2, we can
Edge count task. We similarly let ("T(TT"()))))) m'e1; K ((x,) (isEdge, + isTask,) eii and
V ((xx) isTask, ej. By identical analysis of the attention matrix and & construction, ensure that f(X)x = |E].
Edge existence task. Under the node/edge encoding, we assume that the edge existence task is encoded as nN 2 0, 1, for some 2i V and should return f(X)N
weight matrices to ensure that Q" 1 {x N x E E}. We choose
o'(xx) =
x KT)(I;) o' (æ;). and (T 2(1 isTask;)e. By applying Claim 37 and letting m = O(log N) to be sufficiently large, the following is true the query/key inner products:
exp(Ø(eN) ((x)))()))))))))))())()) =xxp(1((=*x=*>))) 2 e 7m//4
if {f
fah: 2
exp(ő(zn) QK d(x;)) < 5.m' 5mm014 < 8N
1 7m//4
otherwise.
We can therefore analyze the softmax output y/ to obtain the following bound:
UN (exp([]((mh:==*) - ( (3) E E + 2N 8N
I 7m/ /4
E})
21 (x
E E) E) s1 E E} + :/4
1+1
E E}
2exp
(exp(|
(1)) E]
Un
exp(1l((*),,
(1
E}) + N
e
1
8N
21 {
xx)
E }}
1 xx) E E}
1 1 (1
xx)
E
E} +
4
Hence,
3 a 4
if
(x) E. (x) E if
UN E
6
Therefore, it suffices to design a threshold output MLP v that satisfies
{ 21 1'
(=))
4:
in order to distinguish between the two possible output ranges. This can be easily constructed by taking a linear combination of two ReLU neurons.
35

---

Node degree task. We assumee that the task is encoded as NN = (æ)y. 0, and should return f(X)N = deg(=l)) == K 2) E E. We use weight matrices with Q" ('(((xx) d' (zxx)= = n(xx); KJ ((x;)) = (z;); and V ((z)) isTask; This ensure that the following is true about the query/key inner products for sufficiently large m':
exp(o(#N) ((x)) = em
if N aNy E {
xx(((=n)'QR' ((z)())T)))))))))) S em
otherwise.
4N
We similarly ensure that the following holds about the softmax output yn-
cm'
1
UN S em
(x) +2)
deg(2 +
em
Un 2 (deg(z 2)em' +N.
em
AN
deg(2 +
We then use the similar approach employed in the node count task to choose an output MLP that approximately computes d(z) 1/4 2
We thus conclude that there exist single-layer transformers that solve all of the described tasks. 11
C.2 Negative results for single-layer transformers
Theorem 38 (Formal version of Theorem 6; Depth1 cannot compute search or retrieval tasks). Fix any graph reasoning task among graph connectivity, shortest path, and cycle detection. Any single-layer transformer f Transformer N m., with O(log -bib precision that solves the task on all graphs G (V, E) of size [V] + |E| S N 1 formatted as node/edge embedding sequences has width satisfying mH = (NNN log N).
Our negative results generalizes and applies the approach of [70] to prove negative results for single- layer transformers by communication complexity reductions. The bounds hinge on the following fundamental fact about the hardness of a two-player game where two agents jointly attempt to compute a set disjointness quantity that depends on both of their inputs with bounded communication.
Fact 1 (Disjointness communication complexity lower bound [85]). Suppose Alice and Bob are given inputs a, {0, 13" and wish to jointly compute DisJ(a, b) max; a,b; by alternately sending single-bit messages to one another. Any deterministic protocol that computes DIsJ(a, b) requires at least r rounds of communication. or bits of information.
We first generalize Theorem 7 of [70] to show that no transformer can efficiently solve an embedded disjointness problem without having width that scales linearly in r. We prove the theorem and later apply to it prove negative results about relevant graph reasoning tasks. To demonstrate that the graph reasoning tasks do not require pathological input graphs to be hard, we exhibit particular input graph instances with constant graph diameter or constant degree where the task cannot be efficiently solved.
Lemma 39 (Generic Depth1 communication complexity negative result). For some sequence length, fix two disjoint subsets A, c [N -1,, and consider a single-layer transformer I e Transformer N H.1 with O(log bbi precision that solves set disjointness, i.e. f(X)x = Disi(a, b) for any input X where XA is a function of Alice's 's input a E {0, 13", XB is a function of Bob input b- E {0, 1 and X(N])(AUB) is fixed regardless of and b. Then, f has width satisfying mH 00o///////////0 N).
Proof. Consider any transformer I that solves DISJ as specified in the theorem statement. We show that this implies the existence of a 0(mH/ log N)-round communication protocol that solves DIsI(a, b) for any inputs a, E (0, 13". An application of Fact immediately proves the theorem statement.
36

---

If such a transformer f exists, then the following is true for some o, 1h and Q, K, V:
DisI(a, b) =
Σ softmax (d(xx)) (XXV,,
Z exp(Ln.a) + exp(L.. ZA.INI((AUB) exp (II(LA)IN)))A exp(In.A) + exp( LB,B) + exp(/A.(N\\(AB))
= 16
for partial softmax and normalization terms" " defined as follows for S c [N] and h [H]:
Zn Eies
e e
(xp((()))() o(x:))
Lh.S = log Σ
exp(dd(x))
E R+.
The definition of input instances X implies that Alice can compute Zn,A and LA,4 function of her input a: Bob can similarly compute BB and Lb,B from b; and Z,, (NNUB)) (N.(N)((AUB)) and all implementation details of f are known by all players. Therefore, Bob can compute DisI(a, b) by an OmmH log -roun protocol where Alice sends him (Zh,A: La,A) bit-by-bit.
remains to apply Lemma 39 to each graph reasoning task by defining graph instance encodings X that encode DisI(a, b) in the solution the task for some ((N).
Proof of Theorem 38. For each task, we provide pair of "hard instances:" one with constant degree and one with constant diameter, in order obey different notions of graph simplicity.
Graph connectivity task. For both instances, on any disjointness input b E {0, 1}", we define graph G (V, E) with [V] + E O(r) whose edges encode the input, i.e. E Ela, b). We define three fixed disjoint sets of potential edges E En. E, with E + |E + E.. O(r) such that (b) C FB is function of b.
F. (a) u U (b) U E., where F.(aa C FA a function of only Alice's input a and
We define enumeration of all vertices in V and potential edges in FA EB, E., We first fix their sizes [V], I, EAl EB E.| and then index the vertices and edges in the order V, ÉA, EB, E.. That is,
V {l...., [v....,IV..
E. = {(u; 0;) E 8.}, for S. = [IV] + I,.... | [.I)
E = ((4, vx) E A}. for {|V] + E. + + VV + E. + [Al}
Eg = {(4,, v.) : B}, for B = -[IVI [ + |A + 1, IV.....IIIII E, + |ΕAl + [Bs]
This implics that the following transformer input X e Nxd for = + | [ + 1 is valid node/edge encoding such that inputs XA is function of a, XxB is a function of 6, and X (IN](AUB) is constant:
For i V, x. (i, 0, 1,0,0) encodes fixed vertex.
For E S., V; (u, v. 0, 1, 0) encodes a fixed edge.
For E A, represents edge (us, vx) it exists:
(u;, 02 0, 0,0) if (u,, E Ex(a),
0; (0, 0,
otherwise.
"Teee terms are designed in order to facilitate computation with log(N)-bir foating-poine numbers. Note that each Zn,s is convex combination value vectors V,, d(xz), which means that Za.s requires no more bits of precision accurately approximate than V2, o(2,). Similarly, each T.,.s is within an O(log N) additive factor of max.es δ(œx) ) Q. o(æ.). Finally, the output of the softmax term for head h a convex combination of Zi Zi. and Z Zx.[NT)XAUDR) which makes accurate computation of each output possible without requiring greater precision.
37

---

For i E B, represents edge (u,, 1/) if it exists:
(u: Vi 0, 1,
if (u,, e.) E En((), otherwise.
2;
(0, 0, 0, 0)
zx vu 1, encodes the task token for some fixed (u, v) E V2.
Constant-diameter instance: We define a graph G of diameter most 8 that encodes an disjointness instance a, b E {0, 1 in an instance of connectivity.
Let [V| 3r+2, and let nodes and +r+2 denote the "source" and "sink" node respectively. That is, N = (1, 3r + 2, 2, 1,
Edges between the source node and nodes {2...., + 1} and between the end node 3r +2 and {2r + 2, ......... + always are included. That
E, = {(L. i ( r 1}} U [(3r 2,0) : {2r + ,,..., 1}}.
Alice's input is encoded edges (i + 1,
for [r]. That is,
Ea(a) = {(i + 1iitr 1): a; = 1] C E, ((1 ( ((++,,tr+
Bob's inputs are similarly encoded as
(b) {(i +r = EB {(i ((i 1,1 2r +r [r]]-
We visualize this construction of in Figure 5.
There exists a path between node and node 3r + 2 if and only if there exists some E [r] such that (i 1,i+r ++ 1), (i (i++++ 1,1+ 2r 1) E, which corresponds a; b, 1. Thus, the graph G
is connected if and only if DisJ (a, b) = 1. Any transformer / that computes
f(X)x N 1 [1 and + connected inG)
also solves disjointness. Since N = V + |._ + | + BB| + 0(r), we conclude the proof of hardness of solving graph connectivity this instance by applying Lemma 39.
Q1
b1
2
5
8
3
6
9
11
ag
7
10
Figure 5: The constant diameter graph construction for r = 3, = (1,0, and B = 1,0), The source and sink 11 are connected which is equivalent DisI(A, B) by construction.
Constant-degree instance: We can define degree-3 graph G' that similarly encodes disjointness instance a, To do so, we modify the previous construction by replacing the fixed edges E., with two binary trees, each of depth Ologrr), between the source and end nodes as roots and Alice and Bob's nodes incident to Ea and En respectively as leaves. The remainder of the construction the encoding of Ea(a) and (b) and the connectivity analysis identical. Since binary tree with r leaves has O(r) nodes and edges, the graph can be similarly encoded as length-N transformer input for N (rr). See Figure for visualization.
38

---

b1
b2
S
X
04
Figure 6: The degree 3 graph construction for r 4, A (0, 1,0, == (1, The source node and sink node are connected, which is equivalent to DISI(A, B) = by construction.
Shortest path task. We can modify the graph connectivity constructions G' to create decision variant of shortest path, rather than graph connectivity. Let D(G) be the length path between the source and sink node in each connectivity construction, and note that DGG) diameter instance and DGG) = Ollog r) for constant-degree. We design new graph size ((r) then appends path of D(G) node D(G) if they are connected and D(G) + not.
for the constant-
vertices to G. Then, the shortest path between the source and sink
If there exists a transformer f' solves shortest path on graphs of the form G", then there exists minor modification that solves graph connectivity on graph G.
Cycle check task. We again modify the graph connectivity constructions. We produce G' by adding single edge to G between the source node and the sink node 3r + 2, which ensures that G' has a cycle if and only f' can only solve check check if there exists transformer f that solves connectivity.
connected between the source and sink nodes. Therefore, a transformer
D Representational gaps between transformers and GNNs
Our experiments in Section 4 highlight the differences in graph reasoning abilities between vanilla transformers with a naive input graph tokenization and graph neural networks (GNNs). These distinctions can be understood as the consequences of model capacity or inductive bias between transformers and GNNs. This appendix contrasts the novel analysis of the capacities of vanilla transformers in Section 3 with previously established limitations on GNNs. We present two theoretical tools for deriving negative results on GNN capabilities: CONGEST distributed computing model and the CeiisfileerLeemaee isomorphism test (WL-test). We discuss the results implied by these frameworks and contrast them with transformer capabilities and limitations.
D.1 Limitations of GNNs via CONGEST analogy
The bidirectional relationship between transformers and the massively parallel computation (MPC) distributed computing model of [71] was partially inspired by a similar analogy between GNNs and the CONGEST model by [51].
The MPC and CONGEST distributed computing protocols differ in their models of how messages are passed between machines. While MPC protocols permit any machine send message to any other machine subject to capacity constraints, CONGEST protocols operate restricts machines to send messages exclusively to and from neighbors. As consequence, two nodes in CONGEST graph that are separated by path of length p cannot share information with one another without ((p) rounds of communication; no similar notion of "long-range communication" exists for MPC.
graph topology that
All passsng GNNs where each node initially knows only its own features can be simulated by CONGEST protocol whose rounds scales linearly in the depth of the GNN [51]. This reduction implies lower bound on solving several parallelizable and search tasks discussed in Appendix A.2.
Theorem 40. Any graph neural network I with width (message size) m and depth that computes any of the following tasks n n-node graphs has the following size lower bounds:
39

---

Subgraph connectivity, minimum spanning forest, minumum cut, shortest path: Lym
(Vvn).
. Cycle detection, diameter computation: Lm - (2()).
If I. Oloog N), then for all tasks, = -.))..
In contrast, the quantitative bounds Section 3 establish sharp trade-off's between transformers and GNNs for parallelizable tasks and suggest a possible equivalence for search tasks.
All parallelizable tasks including (subgraph) connectivity, minimum spanning forest, minimum cut, and cycle detection ccan be solved by transformers of depth L O(log n) and width m = (n²)) for any constant (0. 1) due to Theorem 2. In contrast, Theorem 40 requires that similar-depte
-an
GNNs have width m (1)) and a GNN of comparable width requires depth L 22n
On the other hand, search tasks, such as shortest path and diamter, are only guaranteed to be solvable by transformers of depth (log n) and width ( (for graphs with |E| = n²) by Theorem 4. This statement compares to the GNN negative results of Theorem 40.
D.2 Limitations of GNNs via the Weisfeiler-LLman test
A relationship between GNNs and the Weisfeiler-Leman heuristic graph isomorphism test [83] (WL test) further establishes representational limitations of message-paseen passing GNNs. This connection and the rich literature surrounding it is presented in greater detail by [59].
The I-WL test a permutation-invariat isomorphic that works by first labeling each node with the empty set @ and then repeatedly replacing each label with a multiset of its neighbors' labels. A hicrarchy of WL test variants exists where the k-WL test maintains a label for each k-tuple of vertices. The failure models of these heuristic solutions are well-understood; critically, the 1-WL test cannot distinguish between connected and disconnected graphs.
test for predicting whether two candidate graphs are
The abilities of message-pasee paaagggng GNNs without unique node identifiers to determine whether two graphs are isomorphic are limited by the graphs distinguishable by the 1-WL test [84, 59]. As an immediate consequence, such GNNs cannot solve graph connectivity at all, unlike transformers, which can do so with logarithmic-dpthh parameter-efficien representation. The relationship is bidirectional; message-passing GNNs (and transformers as well) admit an efficient approximation of the 1-WI. test.
The effectiveness of these bounds is tempered by the assumption that no node includes identifying features, which is easily overcome by standard GNN models. The analogy is further limited by the fact that graph embeddings of transformers must have some (possibly arbitrary) node identifier as input in order to tokenize graph using the node/edge encoding without losing the ability to associate each node with its incident edges. However, the juxtaposition of the 1-WL and CONGEST-bare limitations the abilities of GNNs to solve connectivity- tasks suggests fundamental gap in capabilities between models that apparent in multiple theoretical lenses.
E
Experimental Details
E.1
Datasets
We evaluate model the diverse graph reasoning tasks presented in GraphQA [24]. We used the public code of the dataset available at https://gi thub. htt//goolleeeeeeeeee google-research/trees
/graphqq. The code to generate the datasets is licensed un- der the Apache License, Version 2.0. The tasks the dataset range in difficulty and encompass the following categories:
Graph-level: node counting (counting the number of nodes graph), edge counting (counting the number of edges in graph), cycle check (determining whether a graph contains cycle), and triangle counting (counting the number of triangles in graph).
Node-level: node degree (calculating the degree of given node in graph).
40

---

connectivity (finding if there is path from one node to another), edge exis- tence (whether given edge exists graph, and shortest path (finding the length of the shortest path from one node to another).
Edge-level:
The graphs used in the experiments in this paper and the corresponding graph reasoning tasks taken from [24]. There are 1, 000 graphs in the original train set, 500 graphs in the dev set, and 500 graphs in the test set. The graphs are generated randomly using KénéiiRééyi (ER) random graph model [23]. Graph size ranges from 5 to 20 nodes.
Train set statistics. Average number of nodes: 11.90; average number of edges: 37.01; average node degree: 5.43.
Test set statistics. Average number of nodes: 12.37; average number of edges: 39.79; average node degree: 5.70.
While random instances of graph reasoning tasks provide valuable assessment of the task complexity on realistic graphs, they do not nec- essarily reflect the "worst case" graph inputs that convey negative results like Theorem 6 and Theorem 3. For example, the reduction that es- tablishes that cycle check is "as hard as" graph connectivity and the consequential logarithmic- depth hardness results hinge the considera- tion of graph instances with n nodes and poly- nomial cycle length. However, as witnessed by Figure 7, the shortest cycles observed 1000 instances of GraphQA cycle check is almost al- ways of length three, and only 3.2% instances larger. As consequence, identifying the existence of a cycle on the GraphQA dataset is inherently local, which is reflected by strong performance by heuristic-based GNN solutions (Table 2) despite the fact that efficient GNNs for worst-case cycle check do not exist (Theorem 40).
800
600
400
200
no cycle
4
Figure 7: Histogram of minimum cycle lengths for cycle check instances.
For our experiments on the effect of the scale of the number training data points in the final results we obtain, the open-source code of GraphQA available to generate larger training dataset of 100K examples. We follow the original instructions and parameters to create this larger training dataset.
E.2 Implementation Details
Model Hyperparameters. We fixed the number of iterations 1,000,000 and train standard decoder- only transformers with
layers, m 768 embedding dimension, H 12 heads, learning rate 5- 10 and dropout 0.1. These models have approximate parameter count of 60,000,000.
We used random search [9] over the following of hyperparameters select a universal architecture for all tasks: The range provided for the learning rate and dropout rate are [10-1 10-1 and [0, 0.5). The number layers and embedding dimension m is selected from L E [4, 6, 8, 10, 12, 14, 16) and m E { {192, 384, 576, 768, 960, 1152, 1344, 1536]. We employed the GLU [73] activation as non-linearit..
Model Selection. We implemented our model JAX [26] and used Adam W [43, 50) as the optimizer. Optimal hyperparameters for each task and model were determined by training the GraphQAyrad dataset and evaluating performance on the GraphQA dataset. The results presented the paper based the held-out GraphQATest dataset.
Hardware Acceleration. All experiments were conducted using Google's TPUv3 and TPUv5e accelerators [35].
41

---

E.3 Baseline Results
To rigorously evaluate the performance of transformers on graph reasoning tasks, we compare them against three established categories of baselines:
1. Prompting- methods. These methods provide the LLM with a textual descriptions of the graph and question within the prompt. We consider the following variations and copy the results from the original papers:
ZERO-SHOO In this approach, the model is given task description and immediately asked to produce the desired output. No additional examples or demonstrations are provided. FEW-SHOT. This approach provides the model with few examples of the task and their desired outputs [12]. Unlike traditional training. these examples are included directly in the prompt, allowing the model to learn and adapt during the inference.
(CoT) prompting [82] provides examples each showing step-by-step reasoning, teaching the LLM to generate its own thought processes for tackling new tasks. ZERO-COT. Zero-shot CoT [45] builds upon Chain-of- Thoughht (CoT) prompting by eliminating the need for training examples. The LLM generates its own step-by-step reasoning process using a simple trigger phrase like "Let's think step by step".
COT. Chain-of-
COT-BAG. BAG prompting [80] extends COT to improve the performance of LLMs on graph- related tasks by appending "Let's construct graph with the nodes and edges first" to the prompt.
Graph-based methods. These models are specifically designed to process graphs as input and are trained task-specific. They leverage the connections between nodes to learn patterns and make predictions, making them ideal for tasks where a graph is involved. We use GCN [44], MPNN [28], and GIN [84] from this category. GoaphToken [63] is GNN-based model that processes the graph and feed the output of the GNN as soft-tokens to an LLM. We consider both
GNN models with and without identity tokenizations, as the former is known to be theoretically limited by WL tests, while the latter poses a "fairer" comparison with the positional encodings of transformers.
3. Transformer models (Ours). The last class of model are task-specific vanilla transformer models [77]. The 60M transformer-Ie model is the one described above trained on 1, 000 training examples from the GraphQA training set. To investigate the impact of training data scale, we generated a larger dataset containing 100, 000 examples, ensuring the same distribution as the original training set by using the official GraphQA code and trained 60M transformer- 1O0K on that. The //B transformer (PT)-/K K is vanilla transformer model that is started with a pre-trained checkpoint of '5 [66] and is fine-tuned on the IK training dataset. We also include two fine-tuned PaLM 2 [5] transformers of size XXS and XS. Similar to prompting baselines, this model receives textual description of the graph as input to leverage its textual reasoning capabilities.
The results for ZERO-SHIOT, ZERO-COT, FEW-SHOT, COT, and COT-BAG are taken from Fatemi et al. [24]. Results for SOFT- and GraphToken soureed from Perozzi et al. [63].
We independently evaluated GCN, MPNN, and GIN models on these tasks. We used the original architectures proposed in their respective papers and performed hyperparameter tuning on the GraphQA Dew dataset.
Dew
E.4 Further Experimental results
Table 4 presents a comprehensive comparison of the graph reasoning capabilities across various baseline models and our proposed transformer architectures. The results highlight several key findings. which we summarize below:
Transformers Exhibit Strong Performance on Graph-basee Reasoning Problems. While trans- formers are not explicitly designed for graph reasoning tasks like graph-based models, they demon- strate surprisingly strong performance in this domain. The results of this study indicate that trans- formers, despite their versatility as general architecture, can often match or even surpass specialized graph models on variety of graph reasoning benchmarks.
Transformers Excel at Retrieval Tasks. As proved in Theorem 36, retrieval tasks can be solved by transformers. The obtained results confirm that such tasks relatively easy for transformers as they
42

---

Retrieval Tasks Edge
Parallelizable Tasks
Search Tisks
Subgraph Counting
Samples count
Edge
degree
Cycle
Shottesi path
Triangle counting
sHot
17.4
37.4
22.7
58.0
38.6
28.0
52.1
40.4
GCN (oprivrrant) (44)
1K
47.0
9.8
838
832
50.2
4.0
GCN (ilemity tokeniztioon [44]
IK
3.5
838
83.2
GCN (dlenity tnkenization) [44]
100K
42.2
93.2
91.3
MPNN (cquivariant) (28)
1K
19.4
16.2
09.2
99.
945
99.0
66.8
3066
MPNN (dlcuiity xekeniztioo) [28]
IX
35.5
948
98.6
MPNN (idestity Ndkenization) [28]
100K
1000
933
99.8
(IN (equiontiant [84]
1K
71.2
71.2
96-2
938
98.1
$4.0
90.4
(BN (ilcniity idlennraiiu)) [84)
1X
37.8
93.4
976
GEN (iletiily idlenizaiin)) (84)
100K
1000
94.0
98.6
GrugliT.kkc (63)
1X
99.6
42.6
73.8
96.2
93.2
95.6
63.8
34.8
50M mansdormer
IK
100.0
100.0
57.6
31.5
97.1
57.4
33.4
90M mansoormer
100K
100.0
100.0
96.1
91.7
98.0
97.2
40.5
2 XXS marnfeemee (FT)
IK
100.0
31.0
98.0
00.4
29.0
transfommer (PT)
IK
100.
50.6
96.6
96.3
00.0
12R Inndoomne (PT)
98.0
22.8
Table 4: Comparison of various methods in different categories on graph reasoning tasks of GraphQA. Here, we categorize the tasks using the taxonomy proposed in Section
Train Test
Node count
Edge count
Edge existence
Node degree
0.8
0.8
0.9
0.8
Accurucy
0.6
0.6
0.8
0.4
0.4
0.2
0.2
0.2
10a
10a
10
10a
10a
10a
10
10a
10a
10a
10a
10a
10a
10a
10
10c
iitn
Cycle check
Shortest path
Triangle counting
0.8
0.8
Accurccy
0.6
0.6
0.4
0.4
0.2
0.6
0.2
0.9 10"
10a
10at
10
10a
10a
10
10a
10a
104
10a
102
10a
10a
10
Training Samples
Training Samples
Training Samples
Training Samples
Figure 8: Comparison of train and test scaling on all tasks.
obtained the full accuracy on most of such tasks. One exception here is the node degree task that GNNs outperform transformers but still transformers perform relatively well. We discuss why GNNs outperform transformers well for this task.
Larger Transformers Excel at Solving Search Tasks. As discussed in Theorem 4, transformers effective for search tasks, albeit requiring a larger number of parameters compared retrieval tasks. This empirically evident in the comparison between Transformer- 1K and Transformer- 1K (pretrained). It's worth noting that the pretrained transformer used here has 11 billion parameters, a significant increase from the million parameters in Transformer- I.
Transformers Excel at Capturing Global Patterns. An interesting observation here is the perfor- mance gap between Transformers and GNNs across tasks with varying emphasis on local versus global graph structure. Notably:
43

---

Retrieval Tasks
Parallelizable Tasks
Search Tasks
Subgraph Counting
Method
Samples
Node count
Edge count
Edge exiseence Node degree
Connectivity
Cycle check
Shortest path Trianglc counting
transformer IK
100.0 100.0
67.5
31.2 (1.11
96.2 (0.64)
56.7
26.6 (0.73)
(0.00)
(0.00)
100.0 (0.00)
(11.80)
(0.35)
(0.14)
(0.66)
(0.72)
Table 5: Mean accuracy (and standard deviation) of trained 60M parameter transformers over five random seeds.
1. Local Structure: The node degree task, which relies heavily local node information, is best handled by MPNN, a GNN-based model.
Global Structure: In contrast, tasks like connectivity, triangle counting and shortest path, which require understanding global graph patterns, dominated by Transformer models. Notably, vanilla Transformers achieve remarkable 45% relative improvement over even much larger LLMs augmented with GNN-generated soft prompts (GraphToken) on the shortest path task. This showeases the exceptional ability of Transformers to capture long-range dependencies, a critical factor in understanding global graph structure.
E.4.1 Sample complexity ablations
To develop a more comprehensive understanding graph reasoning tasks learnability by small transformers, we train variety of transformers for 1,000,000 steps each task range of sample sizes. In Figure 8, we demonstrate how the model performance improves as a function of sample complexity. By doing so, witness the relative hardness of each task in terms of the marginal benefit new samples.
Edge count and node count "easy" retrieval tasks that can be solved perfectly with as few as 100 samples.
Edge existence attains near-perfect train and test classification accuracy as the number of training samples approaches 100,000.
Connectivity, shortest path, and node degree demonstrate sharp improvement in evaluation error function the sample size. These models perfectly fit the training set in most sample size regimes, but yield a closer correspondence between training and testing error when trained on 100,000 samples.
Cycle check and triangle count have persistent gaps between training and testing error and overfit even in the large sample setting.
E.4.2 Experimental stability
While lack computational resources train all models multiple times to obtain error bars, we repeated the full experiments on 60M-parameter transformers with 1000 and 100,000 training samples each task with five different random seeds in order to estimate the standard deviation of the resulting task accuracy and displayed those results in Table 5. With the exception of the node degree experiments trained 100,000 samples (which included single far-outlier), all tasks and sample regimes had no more than two percentage points of standard deviation. Critically, this implies the robustness of the superiority of trained transformers over GNNs and prompting methods "intrinsically global" tasks, such as graph connectivity.
44

---

NeurIPS Paper Checklist
1. Claims
Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Answer: [Yes]
Justification: The empirical and theoretical claims discussed accurately represent the detailed theoretical analysis and the wide-ranging experimentation on graph reasoning benchmarks.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made in the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or
NA answer to this question will not be perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results
be expected to generalize to other settings.
is fine to include aspirational goals as motivation as long is clear that these goals are not attained by the paper.
2. Limitations
Question:
Does the paper discuss the limitations of the work performed by the authors?
Answer: [Yes]
Justification: Theoretical limitations are discussed in the presentation of the results in Section and detailed more comprehensively in Appendix A. We discuss limitations of experimental results in Section 4.
Guidelines:
The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
The authors encouraged create separate "Limitations" section in their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification. asymptotic approximations only holding locally). The authors should reflect how these assumptions might be violated in practice and what the implications would be.
The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on few datasets or with few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
The authors should reflect on the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution low or images are taken in low lighting. Or speech-to-text system might be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an impor- tant role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
3. Theory Assumptions and Proofs
45

---

Question: For each theoretical result, does the paper provide the full set of assumptions and complete (and correct) proof?
Answer: [Yes]
Justification:
The theoretical results follow all of the criteria. The proofs are in Appendix.
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated or referenced the statement of any theorems.
The proofs can either appear in the main paper or the supplemental material, but they appear in the supplemental material, the authors are encouraged to provide short proof sketch to provide intuition.
Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix supplemental material.
Theorems and Lemmas that the proof relies upon should be properly referenced.
4. Experimental Result Reproducibility
Question: Does the paper fully disclose all the information needed to reproduce the main ex- perimental results of the paper to the extent that affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?
Answer: [Yes]
Justification: We comprehensively detail the models used and the training hyper- parametessssss in the appendix. The training dataset is generated by a publicly available source code.
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, a No answer to this question will not perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.
specific model and empirical evaluation, may
While NeurIPS does not require releasing code, the conference does require all submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) If the contribution is primarily a new algorithm, the paper should make it clear how reproduce that algorithm. (b) If the contribution is primarily
model architecture, the paper should describe the architecture clearly and fully.
(c) the contribution is a new model (c.g., a large language model), then there should either be way to access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should possible for other researchers to have some path to reproducing verifying the results.
46

---

5. Open access to data and code
Question: Does the paper provide open access to the data and code, with sufficient instruc- tions faithfully reproduce the main experimental results, described in supplemental material?
Answer: [No]
Justification: While code is not made available, the data be generated using the GraphQA dataset linked in the appendix. Full training details are made available, which makes the code easily reproducible. The code will be open sourced upon acceptance of the paper.
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurlPS code and data submission guidelines (https://nips cc/
for more details.
While we encourage the release of code and data, we understand that this might be possible, so "No" is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for new open-source benchmark).
The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (httpa: / httppsscccppblcc/ppecceecc
for more details.
The authors should provide instructions data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. only subset of experiments are reproducible, they should state which ones are omitted from the script and why.
At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible in supplemental material (appended to the paper) recommended, but including URLs to data and code is permitted.
6. Experimental Setting/Details
Question: Does the paper specify all the training and test details (e.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
Answer: [Ys]]
Justification: All training and evaluation details and model hyper-parameter included in the paper appendix.
Guidelines:
The answer NA means that the paper does not include experiments.
The experimental setting should be presented in the core the paper level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, or as supplemental material.
7. Experiment Statistical Significance
Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Answer: [Yes]
Justification: The main claims of the paper are supported by error bars and analysis present in Table 5.
Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by emror bars, confi- dence intervals, or statistical significance tests, least for the experiments that support the main claims of the paper.
47

---

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
The method for caleulating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
The assumptions made should be given (c.g., Normally distributed errors).
It should be clear whether the error bar is the standard deviation the standard error of the mean.
is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have 96% CI, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out range (e.g. negative error rates).
If error bars reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on the com- puter resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
Question:
Answer: [Yes]
Justification: The type of the accelerator used in the experiments is in Appendix.
Guidelines:
The answer NA means that the paper does not include experiments.
The paper should indicate the type of compute workers CPU GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental rums as well estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make into the paper).
9. Code Of Ethics
Question: Does the research conducted in the paper conform, in every respect, with the NeurlPS Code of Ethics https: ttttps:///eurigeee /ww.rieu..../// Appublic/EthccGuutte
Answer: [Yes]
Justification: We reviewed the guidelines and found no relevant violations to our work. Since the experimental datasets are synthetically generated, privacy concerns are moot.
Guidelines:
The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.
If the authors answer No, they should explain the special circumstances that require deviation from the Code of Ethics.
The authors should make sure to preserve anonymity (e.g., there a special consid- eration due to laws regulations in their jurisdiction).
10. Broader Impacts
Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
Answer: [NA]
Justification:
The paper is focused reasoning capabilities of transformers using theoretical and empirical evaluation. To the best of our knowledge, there no socictal impact for the work.
Guidelines:
48

---

The answer NA means that there is no societal impact of the work performed.
If the authors answer NA or No. they should explain why their work has no societal impact or why the paper does not address societal impact.
Examples of negatíve societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (c.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of MI.).
11. Safeguards
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Question:
Answer: [NA]
Justification: This because the datasets used are synthetically generated and reflect random graphs, no risks of data leakage present.
Guidelines:
The answer NA means that the paper poses no such risks.
Released models that have high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make best faith effort.
12. Licenses for existing assets
Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?
Answer: [Yes]
The papers are cited, the link to the source codes used is states along with their license.
Justification:
Guidelines:
The answer NA means that the paper does not use existing assets.
The authors should cite the original paper that produced the code package dataset.
The authors should state which version of the asset used and, if possible, include URL.
The name of the license (c.g., CC-BY 4.0) should be included for each asset.
49

---

For scraped data from a particular source (e.g., website). the copyright and terms of service of that souree should be provided.
assets are released, the license, copyright information, and terms use in the package should be provided. For popular datasets, paperssi thcode com conddatasets has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
If this information is not available online, the authors encouraged to reach out to the asset's 's creators.
13. New Assets
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [NA]
Justification: No new assets introduced in this paper. We have used public data and no code has been released yet.
Guidelines:
The answer NA means that the paper does not release new assets.
Researchers should communicate the details of the dataset/code/model part of their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent was obtained from people whose asset is used.
At submission time, remember anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsourcing and Research with Human Subjects
Question:
For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification: No human subjects were involved.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Including this information in the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then as much detail as possible should be included in the main paper.
According to the NeurlPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
Answer: [NA]
Justification: No human subjects were involved.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
50

---

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.
51


Reviews:
[{"review_id": "1otYR7BQ1B", "reviewer": "Reviewer_CKNh", "summary": "This paper studies the reasoning capabilities of transformers by characterizing their representational power to execute graph algorithms. Theoretically, the authors employ a general transformer model previously studied by Sanford et al. (2024), which assumes that the local MLPs can represent arbitrary functions and thus may have unbounded parameters. Using this transformer model, the authors investigate depth, width, and number of extra tokens required for algorithm execution. This leads to a representational hierarchy of graph reasoning tasks. In particular, by relating the transformer model to the MPC distributed computing model, the authors show that logarithmic depth is both sufficient and necessary to solve parallelizable graph tasks. Empirically, the authors carry out well-designed experiments to demonstrate their theoretical results.", "questions": "- Have you tried experiments on much larger graphs? There is a huge gap in the parameter count of transformers and the size of graphs used in the current experiments.\n- A related work [1] studies execution of graph algorithms using a looped transformer architecture. There, the authors prove that a transformer layer with constant depth and width can simulate a single algorithmic step of a graph algorithm for any input graph size. Consequently, by looping the same layer repeatedly, the resulting transformer model (having constant parameter count) can execute several graph algorithms. The authors should discuss the difference between their theoretical framework and that considered in [1]. Because it seems that the looping mechanism might help the transformer model to gain more efficiency in terms of parameter count.\n\n[1] Simulation of Graph Algorithms with Looped Transformers. Artur Back de Luca, Kimon Fountoulakis. ICML 2024.", "limitations": "The authors should explicitly discuss about the limitations due to the assumption on local MLPs can represent arbitrary functions. For example, would this be a potential reason for the huge gap between the input sequence length (size of graph) and the transformer size (parameter count) in the experiments? The authors should comment on how likely will the assumption lead to a theory-practice gap, and possible future avenues to close this gap.", "rating": 7, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- Understanding the reasoning capabilities of transformers is a highly important problem, both in theory and in practice. The results in this paper add new insights from the prospective of algorithm execution.\n- The technical result on MPC simulation in this paper is a notable improvement from the previous result in Sanford et al. (2024). It is interesting to see that using extra tokens can significantly reduce the required embedding dimension.\n- The experiments are well designed. The paper is well written. Overall I think this is a good paper with clear contributions.", "weaknesses": "- As the authors mentioned at the end of the paper, the assumption of unbounded-size MLPs provides strong results. At the same time, this is an apparent gap between theory and practice. I think that making such assumption is fine. Just raising this point as a limitation of the current theoretical framework.\n- The graphs used in the experiments are super small (5 to 20 nodes) compared to the size of transformers (60M and 11B). Since, theoretically, the required depth and width are sublinear with respect to the input size, this empirical setting creates a huge gap between theory and practice. It would be nice if the authors carry out additional experiments on larger graphs, or limit the number of parameters in the transformers to a few thousands.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We thank the reviewer for their detailed responses and their close attention to our assumptions.\n\n> As the authors mentioned at the end of the paper, the assumption of unbounded-size MLPs provides strong results. At the same time, this is an apparent gap between theory and practice. I think that making such assumption is fine. Just raising this point as a limitation of the current theoretical framework.\n\n> The authors should explicitly discuss about the limitations due to the assumption on local MLPs can represent arbitrary functions. For example, would this be a potential reason for the huge gap between the input sequence length (size of graph) and the transformer size (parameter count) in the experiments? The authors should comment on how likely will the assumption lead to a theory-practice gap, and possible future avenues to close this gap.\n\nWe acknowledge the limitation of unbounded-size MLPs, and we are happy to include further discussion about this assumption. \n\nWhile the assumption when maximally exploited (e.g. solving NP-hard problems within each MLP) represents a significant theory-practice gap, we believe that the assumption is fairly well motivated for the kinds of problems that we discuss. The MPC protocols for tasks like graph connectivity do not involve solving hard computational problems in each machine (see e.g. [8]), which means the resulting transformer MLPs could be represented by a fairly simple circuit. This in turn translates to a ReLU network of small size. \n\nWe think the theory-practice gap can be ameliorated by future theoretical work that models an MLP as a circuit with $o(N)$ gates and examines whether the results investigated here are possible in that regime. This would maintain theoretical elegance while ruling out computational exploitation of the current assumption. Because tasks like graph connectivity can be solved with relatively simple MLPs, we suspect that this is not the root cause of needing larger models for learnability. However, we’d be interested in exploring the trade-offs of MLP and self-attention parameter sizes in future work.\n\nWe also think that it’s a fairly reasonable assumption because MLP parameters regularly make up a large fraction of total trainable parameters in modern transformers and thus reflect significant representational capability. Furthermore, it is important to note that this limitation of the positive results conversely improves the generality of the negative results.\n\nWe propose adding a brief discussion on the previous topics. Would this satisfy the reviewer’s concerns? \n\n> The graphs used in the experiments are super small (5 to 20 nodes) compared to the size of transformers (60M and 11B). Since, theoretically, the required depth and width are sublinear with respect to the input size, this empirical setting creates a huge gap between theory and practice. It would be nice if the authors carry out additional experiments on larger graphs, or limit the number of parameters in the transformers to a few thousands.\n\n> Have you tried experiments on much larger graphs? There is a huge gap in the parameter count of transformers and the size of graphs used in the current experiments.\n\nWe appreciate the question. In the context of this paper, our principal goal was to compare the relative difficulty of solving different tasks with different models. With its pre-existing LLM benchmarks and wide range of tasks, the GraphQA dataset was a particularly good fit for that study. While the graphs in GraphQA have a small number of vertices, they are frequently dense graphs, and often require several hundred tokens to be passed as input to specify each graph. Much larger graphs would be more difficult to tokenize in the current framework, and future work may need to explore other forms of graph encoding. We would like to see further work that examines how transformer capabilities scale as the size of the graphs increase, but that will require a different dataset and likely different approaches to sampling random graphs.\n\nWe acknowledge that our transformers often have many more parameters than the sizes of the graphs, and that our theoretical results suggest that this need not be the case *representationally*. However, over-parameterization is likely necessary from a learnability perspective. While the theoretical results clearly state that small models suffice for graph connectivity, more parameters may be necessary to obtain useful gradients.\n\n> A related work [1] studies execution of graph algorithms using a looped transformer architecture. There, the authors prove that a transformer layer with constant depth and width can simulate a single algorithmic step of a graph algorithm for any input graph size. Consequently, by looping the same layer repeatedly, the resulting transformer model (having constant parameter count) can execute several graph algorithms. The authors should discuss the difference between their theoretical framework and that considered in [1]. Because it seems that the looping mechanism might help the transformer model to gain more efficiency in terms of parameter count.\n\nWe recently became aware of this work and plan on discussing this in our related work section. It provides an excellent point of comparison to our work. From the parameter-count perspective, we agree that this regime offers a parameter-efficient model for solving tasks like shortest path. However, their approach does so by simulating procedures like Dijkstra’s algorithms step-by-step, which means the effective “depth” of the resulting models would be polynomial in $N$ and critically avoids taking advantage of the parallel processing capabilities of transformers. In a practical sense, we suspect that it would be very difficult to train a looped transformer model given the large number of required loops. \n\n[8] Alexandr Andoni, Clifford Stein, Zhao Song, Zhengyu Wang, Peilin Zhong. Parallel Graph Connectivity in Log Diameter Rounds.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "0dW6tNLIy7", "reviewer": "Reviewer_RdpW", "summary": "In this work, the authors propose a new representational hierarchy for standard transformers in terms of computing algorithms over graphs. To this end, the authors relate transformers to the massively parallel computing model (MPC), thus establishing the connection to several graph algorithms. The empirical study validates the theoretical results. In particular, the authors compare transformers to graph neural networks (GNNs), as well as training small transformers from scratch, fine-tuning large-scale pre-trained language models and LLM prompting.", "questions": "- Do I understand correctly that the graph data is provided to the LM-based models  as text, whereas the 60M transformer and the GNN baselines receive the graph information in terms of a custom tokenization (in the case of the transformer) or encoding (in the case of the GNN)?\n- Do I understand correctly that the GNNs are not trained with node identifiers but the 60M transformer is (following TokenGT)?", "limitations": "The limitations were adequately addressed.", "rating": 7, "confidence": 4, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "- The motivation for this work is strong and the study is timely. In particular, studying the representational capacity of transformers on graphs is important and useful both for studying the capabilities of transformers in general as well as for tasks explicitly modeling data as graphs.\n- The paper is written clearly and concise. In particular, I appreciated the “Theoretical interpretation” parts below each empirical result which helps navigating the empirical study in the context of the theoretical results.\n- The empirical study is tightly linked to the theory. For example, the presented theoretical results have implications on the tasks in GraphQA, the benchmark used in the empirical study and the empirical study backlinks to the corresponding theoretical result.", "weaknesses": "- There is an ambiguity in the empirical results in 4.1 and 4.2. I searched the experimental details in the main paper as well as Appendix E.3 and believe that the authors use standard GNN baselines without added positional encodings (also see my question to confirm this). However, note that the authors use transformers with a tokenization following TokenGT (https://arxiv.org/abs/2207.02505), which leverages positional encodings (in particular, node identifiers). Now, the authors for example say in L290-291 that GNNs do not have the sufficient representational capacity to compute graph connectivity. At the same time, the authors attribute the positive results in 4.2. to the inductive bias of GNNs (e.g., L319). I think these two claims should be distinguished. GNNs with node identifiers are universal (see e.g., Abboud et al. 2020, https://arxiv.org/abs/2010.01179) but arguably still possess the inductive bias mentioned in L319, namely that they exclusively aggregate information via the 1-hop neighborhood. Further, it is known in the graph learning community that GNNs with added positional encodings perform much stronger on long-range tasks; see Tönshoff et al. 2023, https://arxiv.org/abs/2309.00367). I suggest to compare to both GNNs with node identifiers as well as without and to clearly distinguish claims about expressivity from those of inductive bias.\n- The authors state that standard deviation is not provided due to high runtime costs. However, I would appreciate if standard deviation could be provided at least for the smaller models, that is, the GNN baselines as well as the 60M transformer to obtain an understanding of the variance of the presented results.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We appreciate the reviewer’s attention to detail and questions about our experimental assumptions and rigor.\n\n>There is an ambiguity in the empirical results in 4.1 and 4.2. I searched the experimental details in the main paper as well as Appendix E.3 and believe that the authors use standard GNN baselines without added positional encodings (also see my question to confirm this). However, note that the authors use transformers with a tokenization following TokenGT (https://arxiv.org/abs/2207.02505), which leverages positional encodings (in particular, node identifiers). Now, the authors for example say in L290-291 that GNNs do not have the sufficient representational capacity to compute graph connectivity. At the same time, the authors attribute the positive results in 4.2. to the inductive bias of GNNs (e.g., L319). I think these two claims should be distinguished. GNNs with node identifiers are universal (see e.g., Abboud et al. 2020, https://arxiv.org/abs/2010.01179) but arguably still possess the inductive bias mentioned in L319, namely that they exclusively aggregate information via the 1-hop neighborhood. \n\nWe thank the reviewer for pointing out this apparent contradiction. Our previous statement on L290-291 was unclear, and we propose to amend it to state the following:\n\n\"In contrast, message-passing GNNs are unable to solve connectivity in a similarly **depth- and width-efficient** manner due to fundamental capacity limitations.\"\n\nWe agree that MPNNs with node identifies are able to solve graph connectivity (owing to GNN universality), but the proofs of [2] (which we discuss in Appendix D) specify the impossibility of solving connectivity with GNNs of small-polynomial width and depth. The universality and inductive bias results, therefore, do not present a contradiction with the representational hardness results in the bounded-width regime. Taken together, these results suggest that favorable inductive biases of small GNNs will be unable to surmount the representational barrier presented in [2]. \n  \n> Further, it is known in the graph learning community that GNNs with added positional encodings perform much stronger on long-range tasks; see Tönshoff et al. 2023, https://arxiv.org/abs/2309.00367). I suggest to compare to both GNNs with node identifiers as well as without and to clearly distinguish claims about expressivity from those of inductive bias.\n\nWe conducted further experimentation to validate that the inclusion of node identifiers did little to improve performance on a subset of the tasks. We can augment Figures 3a and Table 2 with additional rows reflecting different GNNs with node identifiers:\n\n| Model | Connectivity (1k samples) | Connectivity (100k) | Cycle Check (1k) | Cycle Check (100k) | Node Degree (1k) | Node Degree (100k) | \n| --- |  --- | --- | --- | --- | --- | --- |\n| GCN with identity tokenization | 83.8 | 93.2 | 83.2 | 91.2 | 8.8 | 42.2 |\n| MPNN with identity tokenization | 94.0 | 93.8 | 98.6 | 99.8 | 38.8 | 100.0 |\n| GIN with identity tokenization | 93.4 | 94.0 | 97.6 | 98.6 | 37.8 | 100.0 |\n\nNotably, in the case of connectivity, these represent very similar performance to their counterparts without node identifiers (with the exception of the GCN with 100k samples), and none come close to attaining the 98.0% accuracy for a 60M transformers with 100k samples. We intend to add these plots and a discussion of them to future versions of the paper.\n\nWe appreciate the citations shared with us regarding GNN universality and positional encodings and will include them in a future version of the paper.\n\n> The authors state that standard deviation is not provided due to high runtime costs. However, I would appreciate if standard deviation could be provided at least for the smaller models, that is, the GNN baselines as well as the 60M transformer to obtain an understanding of the variance of the presented results.\n\nThank you for your suggestion. We have conducted additional experiments to provide standard deviation for GIN and Transformer 60M models with 1k samples. After training five times with different random seeds, we observed an average accuracy of 93.64 with a standard deviation of 0.385 for GIN and an average accuracy of 92.705 with a standard deviation of 0.483 for the transformer 60M model. These closely resemble our singleton experiments in the submission. We are prepared to extend this analysis to other models if the reviewer believes it would enhance the paper.\n\n> Do I understand correctly that the graph data is provided to the LM-based models as text, whereas the 60M transformer and the GNN baselines receive the graph information in terms of a custom tokenization (in the case of the transformer) or encoding (in the case of the GNN)?\n\n> Do I understand correctly that the GNNs are not trained with node identifiers but the 60M transformer is (following TokenGT)?\n\nYes, both are correct. \n\n[2] Andreas Loukas. What graph neural networks cannot learn: depth vs width.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "BzG3CtwMPO", "reviewer": "Reviewer_43vz", "summary": "This paper investigates the algorithmic reasoning capabilities of transformers on graph problems and introduces a novel hierarchy that categorizes tasks into solvable classes under different scaling regimes of transformers. In addition, the authors perform experiments on GraphQA to validate their theoretical analysis.", "questions": "See the Weaknesses section.", "limitations": "Authors write about limitations fairly.", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "1. **Theoretical Aspect**: It provides a novel hierarchy that categorizes graph problems based on the scale of transformers required to solve these problems, providing insights into their algorithmic reasoning capabilities.\n2. **Empirical Validation**: This paper supports its theoretical analysis with some experiments on the GraphQA benchmark.", "weaknesses": "1. **Limited Generalizability**: The theoretical results are based on specific assumptions, parameter scaling regimes, and tasks, which might not be directly related to all real-world scenarios or practical applications.\n2. **Lack of Guidance for Practice**: Beyond the insight that deeper and wider transformers have greater capacity, what guidance can this paper provide to practitioners?\n3. **Some Impractical Settings**: The settings of blank tokens appended to the input sequence are not related to the practical scenarios.\n4. **Need for Further Empirical Evaluation**: The experimental results of this paper are only performed on the GraphQA benchmark. More experimental results are needed to validate the theoretical results on real-world tasks.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We thank the reviewer for their comments and attention to the utility of the theoretical analysis.\n\n> Limited Generalizability: The theoretical results are based on specific assumptions, parameter scaling regimes, and tasks, which might not be directly related to all real-world scenarios or practical applications.\n\nWhile it is the nature of theoretical works to be reliant on specific (often artificial) regimes, we did our best effort to define concise tasks and use transformer formalisms that resemble modern models, while providing a foundation for subsequent work to build on.\n\nIn particular, the parameter scaling assumptions employed were chosen to be consistent with their counterparts in both publicly available SOTA networks and theoretical models. Our principal scaling assumption---that the context length $N$ is much larger than the embedding dimension $m$ (e.g. $m = N^{0.1}$) , which is in turn much larger than the number of heads $H$ and depth $L$ (e.g. $L = \\log N$)---is validated by models like Llama 3 405B (where $H = 128$, $L = 126$, $m = 16,384$, and $N = 128,000$). Furthermore, comparable theoretical results [3,4,5] all consider regimes where the context length is the primary quantity of interest and all other transformer parameters grow at a strictly lower rate than that.\n\nWe discuss the arbitrary MLP assumption in our response to Reviewer CKNh, which may also be relevant.\n\n> Lack of Guidance for Practice: Beyond the insight that deeper and wider transformers have greater capacity, what guidance can this paper provide to practitioners?\n\nThe primary goal of this paper is to understand empirically and theoretically the complexity of different tasks. While we don’t give prescriptive insights for training transformers, we hope that the framework introduced includes intuitions that help practitioners understand which tasks (graphical, linguistic, or otherwise) that transformers can be expected to learn.\n \nFor instance, we establish theoretically that transformers have immense parallel computational potential (which is evident in the efficient theoretical constructions and positive learnability results for tasks like graph connectivity), which may suggest to practitioners that with the correct style of hints, they can go beyond the step-by-step reasoning that is used for chain-of-thought reasoning. Tasks like graph connectivity may be transferable to NLP settings and suggest that certain types of multi-step reasoning or synthesis of information across passages should be learnable. In contrast, search-type problems (like shortest path) are evidently more difficult, and suggest that practitioners should expect language models to struggle to navigate through complex chains of reasoning where the individual “hops” are not self-evident. \n\n> Some Impractical Settings: The settings of blank tokens appended to the input sequence are not related to the practical scenarios.\n\nThe study of blank tokens is an area of active research. Many recent papers–theoretical and empirical–have investigated the utility of including blank tokens as “scratch-pad” tokens [6] (where models are evaluated auto-regressively and can output intermediate tokens of their choosing) or “pause” tokens [7] (where the blank tokens provide no new information, but can extend the computational powers of the architecture). We believe it is worthwhile to point out the theoretical benefits of including a large number of these tokens. At the same time, we also investigate other scaling regimes (e.g. the LDW regime) where pause tokens are not included.\n\n> Need for Further Empirical Evaluation: The experimental results of this paper are only performed on the GraphQA benchmark. More experimental results are needed to validate the theoretical results on real-world tasks.\n\nWe restrict our focus to the GraphQA tasks because it provides us with a concise setting that provides revealing separations between different classes of models and has a close connection to theoretical settings. We would be interested in seeing future works study other problems, but we think these kinds of synthetic tasks improve the clarity and completeness of our paper’s message. Furthermore, the tasks we study are fundamental and often occur as subroutines of other problems, such as shortest path for navigation.\n\n[3] Bingbin Liu, Jordan T. Ash, Surbhi Goel, Akshay Krishnamurthy, Cyril Zhang. Transformers Learn Shortcuts to Automata\n\n[4] Alberto Bietti, Vivien Cabannes, Diane Bouchacourt, Herve Jegou, Leon Bottou. Birth of a Transformer: A Memory Viewpoint.\n\n[5] Clayton Sanford, Daniel Hsu, Matus Telgarsky.Transformers, parallel computation, and logarithmic depth.\n\n[6] Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, Charles Sutton, Augustus Odena. Show Your Work: Scratchpads for Intermediate Computation with Language Models.\n\n[7] Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, Vaishnavh Nagarajan. Think before you speak: Training Language Models With Pause Tokens.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:
We thank the reviewers for their close reading, detailed feedback, and recognition of the value of this work. Their questions and critique help clarify and improve the messages of this paper. 

While we respond to each author’s comments in their corresponding rebuttal, we would to highlight in particular the fact that we ran several new experiments based on the feedback we received from Reviewer RdpW:
- We adapted our GNN experiments to have identity node embeddings and contrasted those results with featureless GNNs in response to a question about GNN identifiers.
- We reran some of our 60M transformer and GIN experiments with multiple random seeds in response to a question about standard deviation.

We appreciate all of the work that went into the review process, and we look forward to further discussion.

Meta-review: This paper studies the reasoning capabilities of transformers by examining their expressiveness in graph algorithms. Theoretically, the authors investigate the depth, width, and number of extra tokens required for algorithm execution and give a representational hierarchy of graph reasoning tasks. In particular, the authors demonstrate that logarithmic depth is both sufficient and necessary to solve parallelizable graph tasks. Moreover, they conduct some experiments to verify their theoretical findings.

The reviewers found the paper to be technically sound and impactful, with a recommendation for acceptance after addressing some weaknesses and concerns. This work will contribute to the understanding of transformer reasoning capabilities over graph structure.
Decision: Accept (poster)