Manuscript Offprint
arXiv:2610.32104Putting Transformer Theories to the Test
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Several formal theories have been developed to characterize the capabilities and limitations of the transformer architecture, each employing different abstractions that capture different features of the architecture. Due to the differences in their underlying assumptions and conceptual frameworks, these theories can disagree in their predictions about what tasks transformers find easy or hard. We map out seven theories of transformer capability (Star-free, AC , TC , C-RASP, MPC, BAPO, and Sensitivity) and translate their results into a common matrix of predictions across a suite of tasks covering different computational structures. We provide new theoretical results to complete this matrix. We then evaluate theoretical predictions through controlled experiments measuring in-distribution sample complexity, length generalization, and pretrained language model performance. We find that no single theory explains the observed pattern of successes and failures. When a theory does not capture the transformer behaviors relevant to a task, its predictions break down; for instance, we show that the k-hop induction task is predicted hard by C-RASP because it does not model content-dependent attention, but we train small transformers on this task that length-generalize. Similarly, theories assuming hard attention like AC and BAPO predict binary majority to be hard, for which we also find success in practice. Together, our results point to several specific features that a theory of transformers must capture: soft rather than hard attention, dynamic content-dependent retrieval, bounded computation at each position, an account of learnability and inductive biases, and a combination of upper and lower bounds.
1 Introduction
Since its introduction by Vaswani et al. (2017), the transformer architecture has seen enormous practical success, becoming the workhorse of modern artificial intelligence. In response to this rapid advance in empirical performance, a variety of different theoretical research has emerged to try to explain the capabilities and limitations of the transformer architecture (Strobl et al., 2024; Hahn, 2020; Merrill, Sabharwal, and Smith, 2022; Weiss, Goldberg, and Yahav, 2021; Schnabel et al., 2025; Sanford, Hsu, and Telgarsky, 2024, among many others). With this improved understanding, research can be guided towards the most promising modified architectures and learning algorithms (e.g., Merrill et al., 2026). A theory is most valuable when it can explain and make predictions about real-world phenomena (Popper, 1959; Kuhn, 1962), for instance, if a theory of transformers accurately predicts which tasks they will solve in practice. However, given the complexity of real-world neural networks, theoretical analyses of transformers have used different abstractions and assumptions leading to different hardness predictions for different tasks. As a result, it is not always clear which theories or abstractions we should keep in mind when reasoning about the behavior of transformers.
In this work, we seek to shrink the gap between transformer theory and practice by comparing
Part of this work was done while interning at Microsoft Research.
predictions from seven different theoretical frameworks against the empirical performance of small task-specific transformers as well as frontier language models. For this comparison, we identify a collection of common tasks that are predicted easy or hard for transformers across theories, including Boolean problems like majority and parity, graph problems like reachability, and syntactic problems like Dyck string recognition. Where existing analyses are lacking, we provide new theoretical results and constructions.
At a high level, our results illustrate that no theory fully captures the behavior of either small task-specific transformers or of large pretrained language models. Across theories, predictions that a problem is hard tend to be much more accurate than predictions that a problem is easy. This highlights a weakness of current theoretical practice: “easy” predictions tend to be a result of handcrafted constructions, but there is no guarantee that training can identify these constructions. Moreover, certain theoretical frameworks only provide loose upper bounds, so their easy predictions only say that a task is not ruled out. Conversely, a correct hard prediction does not imply a correct explanation for the failure. For example, transformers fail to fit even their training data on PARITY, which points to an optimization barrier rather than the expressivity limits behind several theories’ hardness predictions. Additionally, positional encodings strongly affect whether a transformer length-generalizes, and our experiments show that different encodings are needed for different tasks; current theory does not account for these inductive biases. This motivates future theoretical focus on learnability and inductive biases, an area that has seen only limited progress relative to the work on expressivity (Hahn and Rofin, 2024; Huang et al., 2025a; Golowich et al., 2025). Our experiments also show that pretrained LLMs behave differently from small transformers trained from scratch, which suggests that a theory of LLMs must also account for their data and training, not only the architecture.
At a more granular level, each theory captures some features of transformers and omits others, and our experiments show that its predictions tend to fail when performance depends on a feature it omits. For example, theories that assume hard attention (Hao, Angluin, and Frank, 2022; Yang, Chiang, and Angluin, 2024; Barceló et al., 2024) cannot express global aggregation, so they predict that tasks such as MAJORITY are hard, yet transformers learn these tasks and even length-generalize. In contrast, the popular C-RASP abstraction (Yang and Chiang, 2024; Yang, Cadilhac, and Chiang, 2025) captures global aggregation by modeling attention as uniform averaging, but cannot express content-dependent retrieval. We prove that C-RASP requires exponential size to solve a retrieval task that softmax attention transformers solve efficiently, and we observe the same gap in trained transformers. In the other direction, theories that rely on loose upper bounds from circuit complexity, or that model only communication and allow unbounded local computation, predict that transformers can solve many tasks that they fail to learn in practice. (Put another way, a theoretical analysis providing only upper bounds is an incomplete account of what tasks we should expect transformers to solve.) Together, these results guide the search for more practical theories of transformers, built on compact abstractions whose primitives capture the essential features that explain what transformers can learn.
Figure 1 highlights how the theories are related and some of the tasks that separate them. Three of the theories form a chain of strict inclusions, Star-free (McNaughton and Papert, 1971; Immerman, 1999; Furst, Saxe, and Sipser, 1984). MPC contains this chain, because constant-round MPC protocols can simulate NC (Roughgarden, Vassilvitskii, and Wang, 2018; Frei and Wada, 2019), and the inclusion TC is strict if TC. C-RASP lies strictly inside TC (Huang et al., 2025a, Prop. 31 and Remark 32), but it is incomparable with Star-free and AC. BAPO cuts across the whole hierarchy. It contains every regular language, and hence all of Star-free, but it excludes some tasks in C-RASP and in AC (Schnabel et al., 2025; Proposition 14).

Figure 1: Relationships between theories. Each region represents the tasks that a theory predicts are easy. Each dot is a task, drawn inside the regions of theories that predict it is easy and outside the regions of theories that predict it is hard. A filled dot means all of these placements are proved, while a hollow dot means at least one depends on a conjecture (e.g., ). Sensitivity is not plotted here because it is a theory of learnability rather than expressivity.
Table 1: Key features & assumptions of different theoretical frameworks. Each row summarizes how a theory models, or whether it captures, a particular feature of transformers.
| Star-free | C-RASP | MPC | BAPO | Sensitivity | |||
|---|---|---|---|---|---|---|---|
| Key Assumptions | |||||||
| Token primitives | Ⓡ symbols | 01 bits | 01 bits | Ⓡ symbols | Ⓡ symbols | Ⓡ symbols | 01 bits |
| Information flow | ↔ causal | ↔ bidirect. | ↔ bidirect. | ↔ causal | ↔ bidirect. | ↔ causal | ↔ bidirect. |
| Attention type | ⊥ hard | ⊥ hard | ⊥ softmax | ⊥ uniform | ⋯ msg. passing | ⊥ hard | ⊥ softmax |
| Local computation | ○ bounded | ○ bounded | ○ bounded | ○ bounded | ∞ unbounded | ∞ unbounded | ○ bounded |
| Formal relation to transformers | none | learnability | |||||
| Captured Features | |||||||
| Dynamic attention | ● | ● | ● | ○ | ● | ● | ● |
| Depth | ● | ● | ● | ● | ● | ○ | ● |
| Communication bandwidth | ○ | ○ | ○ | ○ | ● | ● | ○ |
| Learnability | ○ | ○ | ○ | ○ | ○ | ○ | ● |
The seven theories differ both conceptually and formally, and model the key features of the transformer in different ways. Table 1 highlights some of these differences, starting with the two most important: the direction of information flow and the type of attention. Star-free, C-RASP, and BAPO assume causally masked information flow, while , , MPC, and Sensitivity assume bidirectional information flow. Attention is modeled as hard in Star-free, , and BAPO, preventing input-wide aggregation (e.g., counting), while and Sensitivity capture soft attention, allowing for global aggregation. C-RASP considers a restricted form of soft attention that only allows uniform averaging, which precludes dynamic, query-dependent attention patterns. Additionally, theories differ in how they model local computation, with MPC and BAPO allowing unbounded local computation (representing the role of the MLP in transformers), relying instead on communication bandwidth to limit expressive power. Each theoretical abstraction is compared to a different class of transformers, and has a different formal relation (see Figure 2). Sensitivity is the only learnability theory, while the rest are expressivity theories.
These differences lead the theories to make conflicting predictions about whether transformers are capable of performing different tasks. In the following, we describe the core intuition and formal model behind each theory, and explain how each theory classifies tasks as easy or hard.
Out-of-scope work. Notably, our definition of a theory excludes task-specific theoretical analysis (e.g., Sanford, Hsu, and Telgarsky, 2023; Chen, Peng, and Wu, 2025). We also restrict our attention to a single forward pass of the transformer. This excludes theories of chain-of-thought and scratchpad reasoning, in which the model generates intermediate tokens. We discuss these lines of work in Section 2.1.
Star-free languages: regular languages without modular counting. A common simplifying assumption in transformer theory is unique hard attention. Under this assumption, each attention head attends to exactly one position in the context (Hahn, 2020; Hao, Angluin, and Frank, 2022). This assumption makes the computation discrete, making it amenable to analysis with tools from logic and automata theory. Yang, Chiang, and Angluin (2024) study the expressive power of masked (or causal) hard-attention transformers, where each position can only attend to tokens in the past (or only future). They show that masked hard-attention transformers recognize exactly the star-free languages, a subclass of the regular languages. Informally, they can express the order of events in a string but not periodic counting. The star-free languages can equivalently be characterized in terms of linear temporal logic (Kamp, 1968), first-order logic with order and counter-free automata (McNaughton and Papert, 1971), and aperiodic monoids (Schützenberger, 1965). This theory predicts that a task is Easy for transformers if its language is star-free, and Hard otherwise. For example, bounded-depth Dyck recognition is Easy, while PARITY is Hard. Of the seven theories, Star-free is the most restrictive: star-free languages form a strict subclass of , which is described next, and the theory classifies the fewest tasks in our suite as Easy.
: constant-depth Boolean circuits. Another line of work studies unique hard attention without masking, in bidirectional transformers (Hahn, 2020; Hao, Angluin, and Frank, 2022). This class of transformers can be related to the circuit complexity class. is the class of problems that can be solved by a family of Boolean circuits of constant depth and size polynomial in the input, using AND/OR/NOT gates with unbounded fan-in. An intuitive correspondence between transformers and Boolean circuits is that they are both models of parallel computation with bounded depth. Hao, Angluin, and Frank (2022) show that any bidirectional hard-attention transformer can be simulated by a (nonuniform) circuit family. This theory predicts that a task is Easy for transformers if it is in , and Hard otherwise. The classic examples of hard tasks for are PARITY and MAJORITY (Furst, Saxe, and Sipser, 1984; Ajtai, 1983).
: constant-depth threshold circuits. The previous two theories both assumed hard attention in transformers, which may overly restrict expressivity. For example, bidirectional hard-attention transformers are at most as expressive as nonuniform , precluding tasks like MAJORITY. By going from hard attention to soft attention, we can break this ceiling. Merrill, Sabharwal, and Smith (2022) show that bidirectional transformers with saturated attention can compute MAJORITY. is a circuit complexity class that extends by adding threshold gates that output 1 if a weighted sum of their inputs exceeds a threshold, while maintaining the constant-depth restriction. Merrill, Sabharwal, and Smith (2022) show that bidirectional saturated-attention transformers can be simulated by circuits (see also Strobl, 2023), and later work extended this result to general softmax attention (Merrill and Sabharwal, 2023b; Merrill and Sabharwal, 2023a; Chiang, 2025). Intuitively, a soft attention layer computes a weighted average over all positions, and threshold circuits can compute the required sums and divisions in constant depth. As with , this is an upper bound: circuits can simulate transformers, but the converse fails for fixed-precision transformers, which cannot recognize some languages in (Chiang, Cholak, and Pillay, 2023). This theory predicts
With intermediate tokens, a transformer can simulate any computation given enough steps (e.g., Pérez, Marinković, and Barceló, 2019; Merrill and Sabharwal, 2024).
An important technical consideration for circuit families is a uniformity requirement relating circuits across input sizes. The most recent transformer results for use DLOGTIME-uniformity (Chiang, 2025), while the main result is nonuniform (Hao, Angluin, and Frank, 2022), but uniform bounds are possible depending on the choice of positional encoding (Yang, Chiang, and Angluin, 2024). Unless otherwise specified, we assume DLOGTIME-uniformity.
Saturated attention, also known as average-hard attention, computes a uniform average of the joint maximizers of the attention scores, in contrast to unique hard attention, which selects a unique position to attend to, breaking ties by, e.g., choosing the rightmost or leftmost positions.
that a task is Easy for transformers if it is in , and Hard otherwise. For example, MAJORITY and PARITY become Easy under .
C-RASP: programs with prefix counting. The circuit theories described above provide a ceiling on the computational power of transformers. In contrast, C-RASP (Yang and Chiang, 2024; Yang, Cadilhac, and Chiang, 2025) is a programming language that can be compiled directly into causal transformers with softmax attention, providing a lower bound on the computational power of transformers. A C-RASP program has two value types: Boolean and integer counts. Each position i maintains and updates an intermediate representation of Booleans and counts, . The central operation, and the only mechanism for moving information across positions, is prefix-counting of Boolean values
which returns the number of positions up to i whose Boolean value B is true. These prefix counts are compiled to an attention head with uniform attention by setting such that the head returns the fraction of positions satisfying B, which is enough to compare counts. A C-RASP program solving the task provides an explicit construction for a causal transformer that solves the task, establishing a lower bound on the computational power of transformers.
C-RASP models information flow in transformers purely as prefix-counting, with the corresponding attention operation fixed to a uniform average over the prefix. As a result, C-RASP does not capture dynamic, content-dependent attention, where the attention pattern depends on interactions between queries and keys. We examine the cost of this restriction both theoretically and empirically in Section 4 and Appendix G.
MPC: massively parallel computation. The theories above compare transformers to circuits, logics, or programs. Sanford, Hsu, and Telgarsky (2024) and Sanford et al. (2024) take a different view, and model transformers as distributed systems in which positions exchange messages through attention. The Massively Parallel Computation (MPC) model (Karloff, Suri, and Vassilvitskii, 2010) was introduced to study large-scale parallel systems such as MapReduce. In MPC, the input is split across many machines, each with memory much smaller than the input (typically, sublinear). In each round, every machine performs arbitrary local computation on its local data and then exchanges a bounded amount of data with other machines. The complexity of a problem is measured in terms of the number of rounds required. Sanford, Hsu, and Telgarsky (2024) show that an MPC protocol with R rounds can be implemented by a bidirectional transformer of depth , and that an L-layer bidirectional transformer can be simulated by an MPC protocol with rounds. Here, communication rounds correspond to attention operations in transformers, where each position retrieves the messages addressed to it. This theory predicts that a task is Easy for transformers if it can be solved by an MPC protocol with sublinear local memory and a constant number of rounds, and Hard otherwise. MPC is the most expressive of the seven theories we consider, as constant-round MPC protocols are at least as powerful as (Roughgarden, Vassilvitskii, and Wang, 2018; Frei and Wada, 2019), which contains .
BAPO: past-to-future communication complexity. MPC can be interpreted as a theory of communication complexity in all-to-all parallel communication. In a causal transformer, information can only flow from earlier positions to later ones. Schnabel et al. (2025) propose bounded attention prefix oracles (BAPO) as a model that measures how much information a task requires to flow from prefix to suffix. A task is said to be -BAPO if the input can be split at any position and the output can be computed from the suffix using only the following information about the prefix : (1) an a-bit summary, and (2) at most b tokens selected by an attention function which sees the suffix. A task is classified as BAPO-easy if constant bandwidth suffices for every input length, and BAPO-hard otherwise. For example, INDEX is a BAPO-easy task because the suffix can directly retrieve the queried token. Every regular language, including PARITY, is also BAPO-easy because the prefix can summarize the state of a finite automaton. In contrast, MAJORITY is BAPO-hard since it requires a count of bits to cross the split. Unlike the previously mentioned theories, BAPO has no formal simulation result relating it to transformers. Instead, it is an abstract model of information flow that is postulated to capture bandwidth limitations of LLMs and is included to represent a different communication-based account of LLMs.

a, b YCA24, Th. 5
c B+24, Th. 1
d B+24, Cor. 1
e B+24, Prop. 1
f HAF22, Th. 1
g B+24, Cor. 2
h, j MS23; SMCS26
i S23, Th. 2
k MS23, Th. 2
m SHT24, Th. 3.1
n SHT24, Th. 3.4
o YC24, Th. 5.7
p YC24, Th. 7.1
q Ours, Th. 1
Figure 2: Formal expressivity relations between theories and transformer classes. The top row shows the theories, and the bottom row shows the classes of transformers they are compared to. Each edge denotes a containment (blue) or non-containment (red) between classes. An blue arrow pointing down (↓) shows that the transformer class can express every task in the theory's class (a lower bound). An blue arrow pointing up (↑) shows that it cannot express any task outside that class (an upper bound). A red arrow indicates that the result in that direction does not hold. Some results have caveats or incompatible assumptions, so dashed arrows do not necessarily compose. See Appendix D for discussion and details of each result. BAPO is omitted because it has no known formal relation to transformers, and Sensitivity because it is a learnability theory.
Sensitivity: learnability via sensitivity and loss sharpness. Each theory mentioned so far studies the computational expressivity of transformers: whether there exists some transformer that solves a given task. A separate critical question is learnability: whether training on finite data will find such a solution. Learnability is comparatively less well understood than expressivity. Hahn and Rofin (2024) propose an account of one aspect of learnability via a simple property of the target function: how sensitive the output is to small changes in the input. For a Boolean function f, the average sensitivity is defined as the expected number of input bits that would change the output if flipped,
where is x with the i-th bit flipped, and x is drawn uniformly. Hahn and Rofin (2024) show that sensitivity of the target function in input space entails sensitivity in parameter space, which in turn causes any minima in the loss landscape to be isolated and sharp. This theory predicts that a task is Hard for transformers if its average sensitivity grows linearly with input size n. For example, PARITY has average sensitivity and is therefore Hard; in contrast, MAJORITY has average sensitivity , and k-sparse functions have average sensitivity at most k. We label these tasks as Easy under the sensitivity theory, although this is just a shorthand to say “not Hard.” This theory stretches our definition of a “general predictive account of transformers,” since it is only applicable to Boolean functions with uniform distributions; we include it to represent an important learnability theory.
Overview of known expressivity results. Figure 2 shows a summary of known results relating the theories to different classes of transformers. Each edge corresponds to a specific result in the literature (Table 8). Each theory is related to a different class of transformers, which differ in the type of attention (hard, average-hard, or softmax) and in the direction of information flow (causal or bidirectional). The circuit complexity theories, and , only establish upper bounds on the expressive power of transformers. Star-free, C-RASP, and MPC have results in both directions, but these come with significant caveats, such as exponential size or unbounded local computation. We emphasize that there are several technical assumptions that underlie different analyses in the literature, and varying these assumptions can reverse the results they arrive at. For example, analyses relating soft attention transformers to typically assume precision logarithmic in the input length, as assuming finite-precision would constrain softmax transformers to (London and Kanade, 2025, Theorem 4.1). Analogously, it is important to impose some constraint on the width of the transformer to ensure that constructive results are informative, as the width budget controls the expressive power, and unbounded width can trivialize the result (Sanford, Hsu, and Telgarsky, 2023; Sanford, Hsu, and Telgarsky, 2024; Peng, Narayanan, and Papadimitriou, 2024). These width and precision considerations are what separate the simulation of Yang and Chiang (2024, Thm. 7.1) (edge p) from our Theorem 1 (edge q). See Table 8 and Appendix G for more detailed discussion.
2.1 Additional Related Work
Other expressivity results. Beyond the seven theories we describe above, there have been many other theoretical advances in the study of transformers. Strobl et al. (2024) provide a comprehensive survey of this area. Early results include that sufficiently large transformers can approximate arbitrary sequence-to-sequence functions (Yun et al., 2020) and analyses of transformer expressivity for problems like DYCK and PARITY (Bhattamishra, Ahuja, and Goyal, 2020; Hahn, 2020). The introduction of the RASP programming language (Weiss, Goldberg, and Yahav, 2021) provided the basis for the line of theoretical work on B- and C-RASP. Other notable work includes Liu et al. (2023), who show how shallow transformers can simulate automata using shortcuts. Other work outside our comparison provides task-specific analyses rather than general predictive frameworks (Sanford, Hsu, and Telgarsky, 2023; Chen, Peng, and Wu, 2025; Yao et al., 2021).
Learnability and length generalization. Much of the literature has focused on expressivity rather than learnability, but there are some exceptions. Edelman et al. (2022) use covering number bounds to argue that transformers can sample-efficiently learn sparse functions. Recent work has also started to explore the sample complexity of learning C-RASP programs (Rizvi-Martel et al., 2026). Abbe et al. (2024) conjecture that transformers can weakly learn functions if and only if they have constant globality, a distributional property roughly capturing the number of relevant input tokens. Beyond expressivity, there has also been some theoretical work on length generalization. Huang et al. (2025a) show that an idealized inference procedure, which selects the lowest-complexity transformer that fits all inputs up to a given length, length-generalizes on problems expressible in variants of C-RASP matched to the positional encoding, such as C-RASP[∅] for NoPE. This provides a formal account of length generalization related to the RASP-L conjecture (Zhou et al., 2024). Golowich et al. (2025) show that an abstraction of attention heads can learn to length generalize on sparse functions.
Chain of thought. Another line of research concerns the power of transformers with chain of thought (CoT). Pérez, Marinković, and Barceló (2019) show that CoT makes transformers Turing-complete. Subsequent work has provided finer-grained characterizations of how different CoT budgets affect expressive power (Merrill and Sabharwal, 2024; Li et al., 2024), shown CoT step lower bounds for specific problems (Bavandpour et al., 2025; Tomlinson et al., 2026), and extended Turing-completeness results to probabilistic Turing machines (Nowak et al., 2024). Some CoT work has also examined the effect it has on learnability (Altabaa, Montasser, and Lafferty, 2025; Huang, Wang, and Lee, 2025; Huang et al., 2025b; Joshi et al., 2025). Related to CoT results, there has also been work on the expressivity of transformers with scaling depth (Merrill and Sabharwal, 2025a) and padding tokens (Merrill and Sabharwal, 2025b).
Empirical work informing theory. There is a large existing literature on experiments with synthetic tasks to better understand the capabilities of transformers. Bhattamishra et al. (2023) study sensitivity-based inductive biases in transformers and LSTMs, relating differences in these biases to performance on sparse Boolean functions. Delétang et al. (2023) test whether the Chomsky hierarchy predicts length generalization across neural architectures, including transformers and RNNs. Kazemnejad et al. (2023) show that the choice of positional encoding substantially affects length generalization on reasoning and mathematical tasks. While much of this empirical work has focused on small purpose-trained transformers, Jobanputra et al. (2025) explore how LLM pretraining affects transformer capabilities on retrieval and copying tasks. Our contribution is to compare competing theoretical predictions on a common set of tasks, evaluating their explanatory power across in-distribution sample complexity, length generalization, and pretrained-model performance.
For example, Sanford, Hsu, and Telgarsky (2024, footnote 2) observe that allowing width to grow with the input size can allow the transformer to simply collect the entire input at a single position and leave the rest of the computation to the MLP, which negates the advantage of depth.
3 Methodology
We compare the theories of transformers by their ability to correctly predict empirical outcomes, especially those that were not used to construct them (Popper, 1959). As we will see, these seven theories of transformers produce conflicting predictions on our suite of tasks, as they rest on distinct conceptual foundations and assumptions. We rely on empirical experiments with both small task-specific transformers as well as frontier LLMs to reveal which abstractions capture the features of transformers that matter in practice. Our goal is to use these tests to map out each theory's domain of validity, and to draw a synthesis that guides future theoretical work.
3.1 Suite of Tasks
We evaluate the theories on a suite of tasks from seven families, summarized below. We designed the suite with two goals: (1) to cover a range of algorithmic and computational structures, and (2) to target tasks on which theories disagree. Each task tests whether transformers are able to learn and represent a particular computational structure. For example, MAJORITY tests whether transformers can perform global aggregation, DYCK tests whether transformers can track stack-like nesting structures, and k-HOP INDUCTION tests whether transformers can compose content-dependent retrievals. The full suite of tasks was as follows:
• Boolean functions: ALL, ANY, MAJORITY, PARITY.
• Indexed retrieval: INDEX, INDEX-ALL/ANY, INDEX-PARITY. Given a list and one or more indices i, retrieve values list[i] and (in the case of INDEX-*) combine them.
• Sparse functions: SPARSE-ALL/ANY, SPARSE-PARITY. Each applies a Boolean function to k fixed positions learned from data.
• Arithmetic: BINARYADD.
• Dyck languages: DYCK, with bounded and unbounded depth.
• Iterated retrieval: k-HOP INDUCTION for , which composes k content-based lookup operations.
• Graph tasks: EDGE EXISTENCE, UNDIRECTED REACHABILITY, DIRECTED REACHABILITY.
Details of each task, including formal definitions, input distributions, output formats, and variants, are described in Appendix A.
Across all tasks, the size or complexity of the input instance is parameterized by . Formally, a task is a family of problems , one for each input size , with a single finite description that applies to every size . For example, “ALL” is one description that defines the task for every . The theories we consider make claims about whether a single transformer, whose size is fixed in , can solve a task for all . Such claims describe how well the transformer architecture captures a given computational structure. For a finite , a task may be solvable by simply memorizing a lookup table using a large-enough model. However, if a task is solvable by a single model of finite size for all input sizes , then the transformer architecture represents that computational structure natively. In our experimental design, described in Section 3.3, we assess this structural alignment by evaluating the performance of transformers on these tasks as the instance size grows.
3.2 From Theories to Predictions
To test the theories on our task suite, we first apply each theory to each task to derive a prediction. The outcome of this process is a matrix of theory–task predictions, shown in Table 2. The theories make narrow formal claims of different kinds: expressivity upper or lower bounds, learnability claims, or bandwidth requirements. For each theory, we classify each task as either Easy or Hard according to the theory's abstract model, regardless of the formal claim that links the model to transformers. Our goal is to understand whether the abstract model itself makes predictions that are aligned with
Some theories allow the numerical precision to grow logarithmically in n.
Table 2: Theory–task predictions and experimental outcomes. Left: for each theory, we apply its hardness criterion, adapting tasks when necessary to fit within the theory’s assumptions about inputs. See Table 9 for an annotated version with explanations and references for each claim. Right: the outcome of each experiment in Section 4: in-distribution learning (ID), length generalization (LG), and pretrained LLMs (LLM), graded as in Section 3.3 on the task settings of Figure 3. ×: Hard, √: Easy (for predictions, in some cases, not Hard), ■: non-trivial result proved here, *: assuming a complexity theory conjecture, —: inapplicable. The bottom rows count, for each theory, the predictions that match each experiment, among cells with both a prediction and an outcome.
| Task | Theory predictions | Empirical | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Star-free | C-RASP | MPC | BAPO | Sensitivity | ID | LG | LLM | |||
| Boolean | ||||||||||
| ALL/ANY | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| MAJORITY | ✕ | ✕ | ✓ | ✓ | ✓ | ✕ | ✓ | ✓ | ✓ | ✕ |
| PARITY | ✕ | ✕ | ✓ | ✕ | ✓ | ✓ | ✕ | ✕ | ✕ | ✕ |
| Index | ||||||||||
| INDEX | ✕ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✕ | |
| INDEX-ALL/ANY | ✕ | ✓ | ✓ | ✓ | ✓• | ✓ | ✕ | — | ✕ | |
| INDEX-PARITY | ✕ | ✓ | ✓ | ✓ | ✓• | ✓ | ✕ | — | ✕ | |
| Sparse | ||||||||||
| SPARSE-ALL/ANY | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — |
| SPARSE-PARITY | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — |
| BinaryAdd | ✕ | ✓ | ✓ | ✕ | ✓ | ✓ | ✕ | ✕ | ✕ | |
| Dyck | ||||||||||
| DYCK-1 (bounded) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✕ | ✕ |
| DYCK-1 (unbounded) | ✕ | ✕ | ✓ | ✓ | ✓ | — | ✕ | ✓ | ✕ | |
| DYCK-2 (bounded) | ✓ | ✓ | ✓ | ✓• | ✓ | ✓ | — | ✓ | ✕ | ✕ |
| DYCK-2 (unbounded) | ✕ | ✕ | ✓ | ✕ | ✓ | — | ✕ | ✕ | ✕ | |
| k-Hop Induction | ||||||||||
| ✓• | ✓• | ✓• | ✓ | ✓• | — | ✓ | ✓ | ✕ | ||
| ✓• | ✓• | ✓• | ✓ | ✓• | — | ✕ | ✕ | ✕ | ||
| ✓• | ✓• | ✓• | ✓ | ✓• | — | ✕ | ✕ | ✕ | ||
| Graphs | ||||||||||
| EDGE EXISTENCE | ✕ | ✓ | ✓ | ✓ | ✓ | — | ✕ | ✕ | ✓ | |
| DIRECTED REACHABILITY | ✕ | ✕ | ✕ | — | ✕ | ✕ | ✕ | |||
| UNDIRECTED REACHABILITY | ✕ | ✕ | ✕ | — | ✕ | ✕ | ✕ | |||
| Agreement with experiments | ||||||||||
| ID (of 19) | 15 | 12 | 10 | 16 | 10 | 12 | 6 | agree | ||
| LG (of 16) | 10 | 8 | 8 | 13 | 8 | 8 | 5 | disagree | ||
| LLM (of 17) | 11 | 8 | 4 | 12 | 4 | 8 | 2 | n/a | ||
the empirical behavior of trained transformers. We provide an annotated version with references for each cell in Appendix E, Table 9.
We fill each cell in the matrix via one of four possible sources: (i) direct analysis in the theory’s own paper(s); (ii) known results about the abstract model; (iii) new results proved in this paper; (iv) conditional results that depend on standard complexity conjectures. When theoretical analysis is missing for a given theory–task pair, we apply the theory’s framework to the task ourselves and prove the resulting prediction: constructions for Easy predictions and lower bounds or impossibility results for Hard predictions. These new results are marked in Table 2 and the proofs are provided in Appendix F.
3.3 Experimental Design
In our experimental design, we evaluate three notions of empirical success and test each with its own line of experiments. The first line of experiments evaluates whether transformers can learn a task and generalize in-distribution as the input size n grows. The second line of experiments evaluates whether models trained on small instances can generalize out-of-distribution to larger instances. The third line of experiments evaluates whether pretrained large language models can solve each task, without task-specific training. In each setting, we measure how performance scales with the input size n. Since different tasks have different chance-level accuracy baselines, we measure performance via the normalized accuracy metric , where a is the accuracy and b is the chance-level baseline for the given task and input size n (see Appendix B.5). This maps chance-level accuracy to 0% and perfect accuracy to 100%. We use the normalized accuracy threshold to classify whether a task is solved by a given model at a given size n. Each experiment then grades a task as Easy or Hard based on whether the model solves the task as n grows.
In-distribution learning. This experiment evaluates whether a transformer of fixed size can learn the task from examples, and how much data it needs as the input size n grows. For this experiment, we use a single causal transformer architecture (4 layers, width 256, 4 heads, rotary positional encoding). For each task, we train a transformer model with this architecture across a range of input sizes and training set sizes . Every run uses the same number of optimizer steps to match the training compute budget across dataset sizes, so that a smaller N means more passes over fewer distinct training examples. For each configuration of (task, n, N), we repeat the experiment with 5 random seeds. A task is graded as solved at size n if, for some training set size N, at least one seed reaches the threshold.
Length generalization. Many expressivity theories make claims of the form “there exists a transformer that solves for all sizes ”. This suggests length generalization as a testable empirical analogue: can transformers discover such a length-generalizing solution? This stronger form of generalization, to larger out-of-distribution inputs, requires robustly learning the underlying computational structure of the task. To evaluate this, we train on and evaluate the same model on up to 256, eight times the longest training input. Length generalization is known to depend strongly on the architecture, and especially on the positional encoding (Anil et al., 2022; Kazemnejad et al., 2023; Zhou et al., 2024). To control and evaluate the effect of the architecture, we train every task with 3 model sizes and 9 positional encodings, including NoPE, RoPE, absolute, and relative schemes. Details of model sizes and positional encodings are in Appendix B.3. We repeat the experiment with 5 random seeds for each configuration. A task is solved at size if a single trained model (one seed at a given architecture) exceeds the normalized accuracy threshold at every test size up to .
Pretrained large language models. The two lines of experiments described above evaluate small transformers trained from scratch on each task. Large language models (LLMs) are believed to use the same transformer architecture, but are much larger and are trained on broad data with large-scale pretraining and post-training pipelines. This experiment evaluates whether the predictions of transformer theories apply to such models and their complex training recipes. We evaluate five pretrained models from several model providers on the same set of tasks, varying input size . Each prompt describes the task in natural language and gives three solved examples, followed by the test input. With enough intermediate reasoning steps, a transformer can theoretically simulate any computation (Pérez, Marinković, and Barceló, 2019; Merrill and Sabharwal, 2024). This falls outside the single-pass setting of the seven theories we evaluate. Thus, we disable reasoning in our main evaluation; we report results with reasoning enabled in Appendix C.4.1. We omit the SPARSE-* tasks, since their hidden positions must be learned at training time. We grade tasks similarly to the previous experiments: each model is graded on its own based on whether it solves the task at the largest tested size ( ), and the task receives the best grade reached by any single model.
For tasks whose answer is a sequence (BINARYADD and DYCK), we report full-sequence accuracy without normalization (b = 0).
4 Results
We now compare the predictions of the seven theories against the outcomes of our three lines of experiments. We first describe where the theories disagree and provide an overview of our theoretical contributions towards this analysis. We then report the outcomes of our experiments and what they tell us about the validity of different theoretical constructs.
4.1 Theory
The task predictions for each theory are shown in Table 2, along with a coarse summary of the experiment results for easy comparison.
Where the theories agree and disagree. On ALL/ANY, SPARSE-, and bounded DYCK, all theories that apply predict these tasks to be Easy. On the remaining tasks, the seven theories make conflicting predictions. For example, MAJORITY requires global aggregation, which Star-free, AC , and BAPO lack. PARITY requires modular counting, which Star-free, AC , and C-RASP cannot express. For retrieval tasks whose range grows with n (INDEX- and EDGE EXISTENCE), Star-free and C-RASP predict Hard. Star-free describes only regular languages, which cannot track a position that grows with n; C-RASP predicts Hard because it lacks content-dependent attention. This lack also makes C-RASP the only theory to predict Hard for k-HOP INDUCTION (even when k = 1, a new result we show in Proposition 19), an important fact given the central role induction heads are thought to perform in practice (Elhage et al., 2021; Olsson et al., 2022). Unbounded DYCK is captured by TC and MPC, but not the other theories, with the exception of C-RASP which can represent DYCK-1 but not DYCK-2. Among the seven theories, Star-free is the most restrictive, predicting Easy on only 8 of 19 tasks, while TC and MPC are the most powerful, predicting Easy on 17 of 19.
New theoretical analyses. A few notable new results we provide to fill in Table 2 include DYCK-(k, D) in C-RASP (Proposition 16), k-HOP INDUCTION not in C-RASP (even for k = 1, Proposition 19), and BAPO-hardness for unbounded DYCK-k (Proposition 17) and BINARYADD (Proposition 14). Additionally, we show a new exponential width separation between C-RASP and softmax attention transformers—despite the depth-for-depth equivalence between C-RASP and softmax transformers shown by Yang and Chiang (2024) and Yang, Cadilhac, and Chiang (2025) via uniform attention. This is due to the lack of content-dependent attention in C-RASP, which we will see manifests in our experiments. Informally, we show the following result.
Theorem (Informal). There exists a family of query-key retrieval tasks parameterized by m such that: (i) every C-RASP program that solves it needs program size , (ii) any uniform-attention transformer with depth D and p-bit precision needs width , and (iii) one softmax attention head solves the task with width .
The formal result and the proof are provided in Appendix G, along with experiments showing that the separation also appears when training softmax and uniform-attention transformers on these tasks.
4.2 Experiments
We first focus on the from-scratch transformer experiment results, grouped by task category, then summarize the LLM results. Figure 3 summarizes the results of the in-distribution, length generalization, and pretrained LLM experiments.
Boolean functions. ALL/ANY, which measure whether transformers can detect the occurrence of a symbol, is predicted Easy by all theories. This is supported by the experiments, which find this task to be learnable and easy to length-generalize. On the other hand, MAJORITY separates theories by probing their ability to perform global aggregation and thresholding. We find that transformers successfully learn and length-generalize on this task, which agrees with TC , C-RASP, MPC, and Sensitivity, and contradicts Star-free, AC , and BAPO. This highlights that transformers do indeed possess global aggregation capabilities, which hard-attention theories fail to capture. Another task
When the index range is bounded, C-RASP can simulate content-dependent retrieval by retrieving all possible queries and selecting between them in the positionwise computation (Propositions 3 and 4).
(a) In-distribution
(b) Length generalization

(c) Pretrained LLMs
Figure 3: Results of the three experiments. Rows are task settings, and heatmap color shows mean normalized accuracy. Corner tabs, when present, show the minimum and maximum over five seeds in (a,b) or available models in (c). (a) In-distribution learning: each size n shows the training-set size N with the highest-scoring seed; the full grid is in Figure 4. (b) Length generalization: models train through n = 32 (left of the black line). Each row uses the configuration that generalizes furthest among 27; the adjacent number counts configurations with a seed succeeding at every tested size through n = 256; Appendix C.3 provides more details. (c) Pretrained LLMs: cells average the models available at each size; hatched rows are not applicable. In (a,c), ✓ marks Easy and ✗ marks Hard, using the 90% threshold. A setting is Easy if it meets the threshold at the largest tested n: in (a), with any seed at any N; in (c), with any single model.
that separates theories is PARITY, which tests for the ability to learn and perform a simple type of binary state-tracking. We find that transformers fail to learn this task, even in-distribution at modest input sizes. This agrees with the Hard predictions of Star-free, AC , C-RASP, and Sensitivity, while contradicting TC , MPC, and BAPO. However, among these theories, we suspect that Sensitivity is closest to capturing the right mechanism for this failure. We observe that even training accuracy stays low when the training set is large (e.g., at n = 8, N = 65,536, training-sample accuracy is only 49.7–59.1% across the five seeds). This suggests that the central barrier is learning and optimization, rather than merely expressivity, as previously argued by Hahn and Rofin (2024). While certain more restrictive theories correctly predicted hardness, they do not seem to have captured the real underlying mechanism for this hardness.
Sparse functions. The SPARSE-* tasks measure the ability of transformers to learn functions of a hidden sparse subset of the inputs. All theories predict that such sparse functions are Easy for transformers. Indeed, we find that SPARSE-ALL/ANY is efficiently learnable, and moreover length-generalizes for some architectures. SPARSE-PARITY is also Easy in distribution, as all theories predict. However, this success is fragile at longer inputs: for , at most one of 25 runs succeeds at each size.
Retrieval. The INDEX-* tasks assess the ability of transformers to retrieve a sparse, query-dependent set of inputs from a growing context. Star-free and C-RASP predict Hard for these tasks when the index range or key space grows with the input size. Other theories predict Easy, as they provide mechanisms for efficient query-dependent retrieval through dynamic attention. Empirically, we find that small transformers learn INDEX at every input size. INDEX-ALL/ANY, which requires composing a retrieval with a simple computation (ALL/ANY), is harder: within our budget, it is solved only up to n = 16 to 64, but it appears learnable with increased data. Interestingly, however, we find INDEX-PARITY to be unlearnable, despite having the same modest sparsity level as INDEX-ALL/ANY (k = 2 or k = 3) and in-distribution success on the similar SPARSE-* task. In our length generalization experiments, we bound the maximum index range to make the length generalization problem well-defined. This makes it a different task from the in-distribution one, so we do not compare it with the theory predictions (Table 2). Transformers do length-generalize on INDEX and INDEX-ALL for certain architectural choices.
Iterated retrieval. The k-HOP INDUCTION tasks involve composing content-dependent information retrieval operations. A single hop is the computation of an induction head, a two-layer attention circuit that mechanistic interpretability work has found in pretrained language models of many sizes (Elhage et al., 2021; Olsson et al., 2022). Induction heads are thought to play an important role in in-context learning abilities of large language models (Olsson et al., 2022; Crosbie and Shutova, 2025). k-HOP INDUCTION composes k such hops, and so tests whether transformers can chain this basic retrieval operation. Here, unlike the INDEX-* tasks, we take the alphabet to be fixed in n, and instead focus on the iterated structure. All theories except C-RASP predict that k-HOP INDUCTION is Easy at fixed k. Empirically, we find that 1-HOP INDUCTION is learnable for small transformers trained from scratch, and even length-generalizes on 5 of 27 architectural configurations. However, learning compositions is substantially harder. In the in-distribution experiments, k-HOP INDUCTION is only solved at n = 8 for k = 2, and is never solved for k = 3.
Stack-like nesting with bounded and unbounded depth. The DYCK tasks assess the ability of transformers to track stack-like states and nesting structure. We consider both bounded-depth and unbounded-depth DYCK. When depth is bounded, all theories that apply predict Easy. Indistribution, transformers trained from scratch solve bounded-depth (d = 4) DYCK-1 and DYCK-2 at every size. However, they exhibit limited length generalization. With unbounded depth, the theories disagree. The most expressive theories, TC and MPC, predict Easy for all DYCK-k, C-RASP predicts Easy for DYCK-1 only, while Star-free, AC , and BAPO predict Hard. In-distribution, both DYCK-1 and DYCK-2 are solved only up to n = 64, in line with the Hard predictions. Interestingly, however, with the benefit of an architecture search over different positional encodings, one of five seeds on one of 27 architectural configurations (medium size, NoPE with a BOS token) length-generalizes on DYCK-1 to n = 256. This has an interesting connection to C-RASP theory, which provides a simple program that compiles to a uniform attention transformer that solves DYCK-1 for all input sizes by counting brackets (Yang and Chiang, 2024).
Multi-step computation. The BINARYADD task assesses the ability of transformers to perform multi-step computations associated with arithmetic. The two circuit class theories, and , together with MPC predict Easy for this task, while the rest predict Hard. Empirically, we find that transformers succeed in learning the task only for small inputs, suggesting that circuit complexity classes, even the weaker , underestimate the difficulty of this task for transformers. At larger sizes, accuracy still improves with more training data and varies widely across seeds, which points to a learning barrier rather than an expressivity limit. Consistent with this, prior work has found success on addition by augmenting position embeddings (McLeish et al., 2024; Cho et al., 2024; Cho et al., 2025). Another pair of tasks that involve multi-step computation is DIRECTED REACHABILITY and UNDIRECTED REACHABILITY, which involve complex graph processing. These tasks are the most difficult in our task suite, as they are predicted Hard by all theories. The experiments agree with this classification, as small transformers fail to learn the tasks, even for the smallest input sizes (n = 8-node graphs). Another graph task that was surprisingly difficult for transformers to learn in our experiments is the simpler EDGE EXISTENCE task. This task only requires checking if a queried edge exists in the graph. In our empirical setup, we found that small transformers failed to learn this task. We provide a deeper analysis of this in the appendix, showing that the task becomes learnable.
Some of these predictions are conditional on standard complexity conjectures.
with denser supervision on every edge rather than only on the final answer (Appendix C.1). This suggests learning is once again the culprit.
Pretrained LLM experiments. The LLM evaluation experiments test whether the predictions of transformer theories carry over to frontier language models. On our task suite, LLMs succeed robustly only on ALL and EDGE EXISTENCE, which require only identifying the presence of a single item in a list. They show some success at small input lengths for MAJORITY and INDEX-*. LLMs struggle with any more complex task as n grows. With reasoning, however, GPT-5 solves most task settings through n = 128, with exceptions for DYCK, BINARYADD, and INDEX-ALL with k = 3 (Appendix C.4.1, Figure 9; failures on DYCK are likely due to our use of per-position next-token-set prediction, see Appendix A.2.5).
5 Discussion
Section 4 showed that no single theory explains the pattern of empirical observations on our suite of tasks. When a prediction fails, it points to a feature of transformers that the theory's abstract model fails to accurately capture. We discuss the most important of these features and highlight concrete directions for future theoretical work.
Models of attention: soft vs hard, and dynamic retrieval. The attention operation is the defining feature of transformers, and each theory models it differently. We identify two properties of how attention is modeled that explain many of our results: (i) whether attention is soft or hard, and (ii) whether it supports dynamic, content-dependent retrieval. Real transformers with soft attention can aggregate information over many positions, while hard attention is limited to selecting a fixed number of positions. As a result, theories that build on hard attention (Star-free, AC , and BAPO) cannot perform global aggregation, so they predict the MAJORITY task to be Hard. Yet real transformers can use their soft attention to solve this task robustly across input sizes. On the other hand, while C-RASP theory uses a soft form of attention that enables global aggregation (in the form of prefix-counting), its restriction to uniform averaging prevents it from capturing the dynamic, content-dependent information retrieval capabilities of real transformers, as Section 4 shows. Therefore, we argue that a faithful model of attention should be both soft and content-dependent.
Unbounded computation and loose upper bounds. and MPC theories model both global aggregation and content-dependent retrieval. Yet, our experiments show that they are overpowered as they predict Easy for many tasks that transformers fail to learn. These prediction errors can be partially explained by computation resources that exceed real transformers, as well as loose upper bounds. For example, while circuits can simulate soft attention transformers, it is known that transformers do not solve every task in (Chiang, Cholak, and Pillay, 2023). MPC and BAPO measure the communication complexity of attention, but allow for unbounded local computation. This leads to false Easy predictions on tasks which have modest communication requirements but are nonetheless computationally hard. As an example, MPC and BAPO predict that every regular language is Easy, including the word problem for the permutation group , which is -complete (Barrington, 1989) and therefore lies outside the reach of constant-depth transformers assuming (Merrill and Sabharwal, 2023b).
Failures of learning, not expressivity. Most theoretical work addresses questions around expressivity, without addressing learnability. Among the seven theories we investigate in this work, only Sensitivity makes claims about what transformers can learn. Several of our negative results reflect failures of learning: transformers fail to fit even their training data on PARITY, accuracy on BINARYADD varies widely across seeds and improves with more data, and EDGE EXISTENCE becomes learnable with denser supervision. Expressivity theories cannot explain these failures. Some correctly predict PARITY to be Hard, but for the wrong reason, since its difficulty comes from optimization rather than the expressivity limits they identify. However, existing learnability theory, such as Sensitivity, tends to be narrower in scope than expressivity theory. Broader theoretical work on learnability, where our understanding lags behind, would be particularly valuable.
Positional encoding & inductive biases. Current theory does not provide an account of the inductive bias effects of positional encoding during learning, and how they lead to success or failure in length generalization. Our experiments show that the ability to learn a length-generalizing solution depends strongly on the positional encoding, and that no single encoding scheme succeeds across tasks. For example, sinusoidal encodings generalize on bounded-range INDEX, relative positional encodings succeed on 1-HOP INDUCTION, and only NoPE succeeds on unbounded DYCK-1. Huang et al. (2025a) take a first step toward such an account by relating a notion of length generalization to variants of C-RASP with different types of positional information, but consider an idealized asymptotic analysis. Our results point to an impactful direction for future theory: an account of the inductive biases that make an encoding generalize on a task could guide the design of new encodings that generalize across many tasks at once.
LLMs are more complex objects. Our experiments show that small transformer models trained from scratch exhibit markedly different behavior from pretrained large language models. For example, LLMs fail on tasks like MAJORITY and INDEX as n grows, while small transformers trained from scratch successfully learn them. This suggests that there are different important factors at play, beyond what current expressivity theory captures, that dictate what capabilities LLMs acquire, such as tokenization, training data, the pretraining and post-training recipe, and the dynamics of simultaneously training on different tasks. Thus, a theory of LLMs must seek to develop abstractions that capture these facets in addition to analysis of the architecture itself.
6 Conclusion
In this paper, we compare and contrast seven different theoretical frameworks that are aimed at explaining the capabilities and limitations of transformers. We do so by curating a diverse suite of tasks studied in the literature, including tasks such as PARITY, INDEX, DYCK-1, and BINARYADD, on which the theories disagree. We fill in missing predictions with new theoretical analyses. Importantly, our experiments show that transformer failures are not just due to one, but multiple mechanisms, including limits of expressivity, failures of learning, and the inductive biases of positional encodings. For example, in addition to the well-studied PARITY task, k-HOP INDUCTION for and unbounded DYCK-1 appear to be hard to learn, even though transformers can express solutions to them. We also see that length generalization often depends on architectural choices such as positional encodings. Finally, we find that pretrained LLMs and small transformers trained from scratch behave differently, with LLMs succeeding on tasks that small transformers fail on, and vice versa. This suggests that the abilities learned by large models depend jointly on their architecture, data, and training recipe. No single theory accounts for all of these mechanisms and their interactions, so none explains the full pattern of successes and failures.
Towards a unified theory of transformers. Each of the seven theories captures some features of transformers and misses others. Theories built on hard attention capture content-dependent retrieval, but lack global aggregation; C-RASP captures global aggregation but not content-dependent retrieval. TC and MPC can represent content-dependent soft attention, but are overpowered, predicting Easy for many tasks that transformers fail to learn. MPC and BAPO formalize the bandwidth limits of attention, but assume unbounded local computation, so they classify any task with low communication complexity as Easy, regardless of how much computation each position must perform. Only Sensitivity addresses learning, but it gives just one criterion for hardness and is limited to Boolean functions under the uniform distribution. Our results identify concrete guidelines for future theories of transformers: model attention as both soft and content-dependent, bound the computation at each position, explain which expressible solutions training finds, and account for the added complexities of large language models. Our task suite and prediction matrix provide a testbed for new theories.
Acknowledgments and AI Use Disclosure
We thank the AI Interaction and Learning (AIIL) team at Microsoft Research for helpful discussions during the development of this project.
We used generative AI tools in several parts of this work. For the experiments, we used AI coding tools to implement the model components, the training code, and the synthetic task generators. For the theory, we used AI tools to assist in developing proofs, both by formalizing proof sketches and by suggesting proof ideas. The final proofs in the paper were written and reviewed by the human authors using the AI-generated proofs as starting points when appropriate. We also used AI tools to search for and summarize relevant prior work. In preparing the paper, AI tools were used to edit the text for readability, format the LaTeX source, write the code that produces our results figures, and draw the conceptual diagrams in TikZ. We take full responsibility for all content in this paper.
References
Emmanuel Abbe, Samy Bengio, Aryo Lotfi, Colin Sandon, and Omid Saremi (2024). “How Far Can Transformers Reason? The Globality Barrier and Inductive Scratchpad”. In: Advances in Neural Information Processing Systems (cited on page 7).
Miklós Ajtai (1983). “-Formulae on Finite Structures”. In: Annals of Pure and Applied Logic (cited on pages 4, 42).
Awni Altabaa, Omar Montasser, and John D. Lafferty (2025). “CoT Information: Improved Sample Complexity under Chain-of-Thought Supervision”. In: Advances in Neural Information Processing Systems (cited on page 7).
Cem Anil, Yuhuai Wu, Anders Andreassen, Aitor Lewkowycz, Vedant Misra, Vinay Ramasesh, Ambrose Slone, Guy Gur-Ari, Ethan Dyer, and Behnam Neyshabur (2022). “Exploring Length Generalization in Large Language Models”. In: Advances in Neural Information Processing Systems (cited on page 10).
Alessandro Artale, Luca Geatti, Nicola Gigante, Andrea Mazzullo, and Angelo Montanari (2023). "LTL over Finite Words Can Be Exponentially More Succinct Than Pure-Past LTL, and vice versa". In: 30th International Symposium on Temporal Representation and Reasoning (TIME 2023) (cited on page 41).
Pablo Barceló, Alexander Kozachinskiy, Anthony Widjaja Lin, and Vladimir Podolskii (2024). "Logical Languages Accepted by Transformer Encoders with Hard Attention". In: The Twelfth International Conference on Learning Representations. arXiv: 2310.03817 [cs.FL] (cited on pages 2, 6, 41, 42).
David A. Mix Barrington (1989). “Bounded-width polynomial-size branching programs recognize exactly those languages in NC ”. In: Journal of Computer and System Sciences (cited on page 14).
David A. Mix Barrington and James Corbett (1989). “On the relative complexity of some languages in NC ”. In: Information Processing Letters (cited on page 47).
Alireza Amiri Bavandpour, Xinting Huang, Mark Rofin, and Michael Hahn (2025). “Lower Bounds for Chain-of-Thought Reasoning in Hard-Attention Transformers”. In: Proceedings of the 42nd International Conference on Machine Learning (cited on page 7).
Satwik Bhattamishra, Kabir Ahuja, and Navin Goyal (2020). “On the Ability and Limitations of Transformers to Recognize Formal Languages”. In: Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). arXiv: 2009.11264 [cs.CL] (cited on page 7).
Satwik Bhattamishra, Arkil Patel, Varun Kanade, and Phil Blunsom (2023). “Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functions”. In: Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (cited on page 7).
Janusz A. Brzozowski and Robert Knast (1978). “The Dot-Depth Hierarchy of Star-Free Languages Is Infinite”. In: Journal of Computer and System Sciences (cited on page 47).
Lijie Chen, Binghui Peng, and Hongxun Wu (2025). “Theoretical limitations of multi-layer Transformer”. In: 66th IEEE Annual Symposium on Foundations of Computer Science (FOCS). arXiv:2412.02975 [cs.LG] (cited on pages 3, 7).
David Chiang (2025). “Transformers in Uniform TC ”. In: Transactions on Machine Learning Research. arXiv: 2409.13629 [cs.CC] (cited on page 4).
David Chiang, Peter Cholak, and Anand Pillay (2023). “Tighter Bounds on the Expressivity of Transformer Encoders”. In: Proceedings of the 40th International Conference on Machine Learning. arXiv: 2301.10743 [cs.LG] (cited on pages 4, 14, 42, 43).
Hanseul Cho, Jaeyoung Cha, Pranjal Awasthi, Srinadh Bhojanapalli, Anupam Gupta, and Chulhee Yun (2024). “Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structure”. In: Advances in Neural Information Processing Systems. Ed. by A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang. Curran Associates, Inc. (cited on page 13).
Hanseul Cho, Jaeyoung Cha, Srinadh Bhojanapalli, and Chulhee Yun (2025). “Arithmetic Transformers Can Length-Generalize in Both Operand Length and Count”. In: The Thirteenth International Conference on Learning Representations (ICLR) (cited on page 13).
Joy Crosbie and Ekaterina Shutova (2025). “Induction Heads as an Essential Mechanism for Pattern Matching in In-context Learning”. In: Findings of the Association for Computational Linguistics: NAACL 2025. Ed. by Luis Chiruzzo, Alan Ritter, and Lu Wang. Association for Computational Linguistics (cited on page 13).
Grégoire Delétang, Anian Ruoss, Jordi Grau-Moya, Tim Genewein, Li Kevin Wenliang, Elliot Catt, Chris Cundy, Marcus Hutter, Shane Legg, Joel Veness, and Pedro A Ortega (2023). “Neural Networks and the Chomsky Hierarchy”. In: The Eleventh International Conference on Learning Representations (cited on page 7).
Benjamin L. Edelman, Surbhi Goel, Sham Kakade, and Cyril Zhang (2022). “Inductive Biases and Variable Creation in Self-Attention Mechanisms”. In: International Conference on Machine Learning. arXiv: 2110.10090 [cs.LG] (cited on page 7).
Nelson Elhage et al. (2021). “A Mathematical Framework for Transformer Circuits”. In: Transformer Circuits Thread. https://transformer-circuits.pub/2021/framework/index.html (cited on pages 11, 13).
Fabian Frei and Koichi Wada (2019). “Efficient Circuit Simulation in MapReduce”. In: 30th International Symposium on Algorithms and Computation (ISAAC 2019) (cited on pages 2, 5, 44, 47).
Merrick Furst, James B. Saxe, and Michael Sipser (1984). “Parity, Circuits, and the Polynomial-Time Hierarchy”. In: Mathematical Systems Theory (cited on pages 2, 4, 42, 44).
Dov Gabbay, Amir Pnueli, Saharon Shelah, and Jonathan Stavi (1980). “On the Temporal Analysis of Fairness”. In: Proceedings of the 7th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '80) (cited on page 41).
Mohsen Ghaffari, Fabian Kuhn, and Jara Uitto (2019). “Conditional Hardness Results for Massively Parallel Computation from Distributed Lower Bounds”. In: 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS) (cited on page 49).
Jacob Gilbert and MohammadTaghi Hajiaghayi (2023). “Brief Announcement: Regular and Dyck Languages in MPC”. In: Proceedings of the 35th ACM Symposium on Parallelism in Algorithms and Architectures (cited on pages 46, 48).
Noah Golowich, Samy Jelassi, David Brandfonbrener, Sham M. Kakade, and Eran Malach (2025). "The Role of Sparsity for Length Generalization in LLMs". In: Proceedings of the 42nd International Conference on Machine Learning (cited on pages 2, 7).
Michael T Goodrich, Nodari Sitchinava, and Qin Zhang (2011). “Sorting, searching, and simulation in the MapReduce framework”. In: International Symposium on Algorithms and Computation (cited on page 46).
Michael Hahn (2020). “Theoretical Limitations of Self-Attention in Neural Sequence Models”. In: Transactions of the Association for Computational Linguistics. arXiv: 1906.06755 [cs.CL] (cited on pages 1, 4, 7).
Michael Hahn and Mark Rofin (2024). “Why are Sensitive Functions Hard for Transformers?” In: Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). arXiv: 2402.09963 [cs.LG] (cited on pages 2, 6, 12, 46, 47).
Yiding Hao, Dana Angluin, and Robert Frank (2022). “Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexity”. In: Transactions of the Association for Computational Linguistics. arXiv: 2204.06618 [cs.CC] (cited on pages 2, 4, 6, 41, 42, 47).
Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen (2021). “DeBERTa: Decoding-Enhanced BERT with Disentangled Attention”. In: International Conference on Learning Representations (cited on page 26).
Jianhao Huang, Zixuan Wang, and Jason D. Lee (2025). “Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thought”. In: International Conference on Learning Representations (cited on page 7).
Xinting Huang, Andy Yang, Satwik Bhattamishra, Yash Sarrof, Andreas Krebs, Hattie Zhou, Preetum Nakkiran, and Michael Hahn (2025a). “A Formal Framework for Understanding Length Generalization in Transformers”. In: International Conference on Learning Representations (ICLR). arXiv: 2410.02140 [cs.LG] (cited on pages 2, 7, 15, 44, 46–50, 63, 64).
Yu Huang, Zixin Wen, Aarti Singh, Yuejie Chi, and Yuxin Chen (2025b). “Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization”. In: Advances in Neural Information Processing Systems (cited on page 7).
Neil Immerman (1999). “Descriptive complexity”. Springer (cited on pages 2, 44, 47, 49, 50, 54).
Mayank Jobanputra, Yana Veitsman, Yash Sarrof, Aleksandra Bakalova, Vera Demberg, Ellie Pavlick, and Michael Hahn (2025). “Born a Transformer – Always a Transformer? On the Effect of Pretraining on Architectural Abilities”. In: Advances in Neural Information Processing Systems (cited on page 7).
Nirmit Joshi, Gal Vardi, Adam Block, Surbhi Goel, Zhiyuan Li, Theodor Misiakiewicz, and Nathan Srebro (2025). “A Theory of Learning with Autoregressive Chain of Thought”. In: Proceedings of Thirty Eighth Conference on Learning Theory (cited on page 7).
Johan Anthony Willem Kamp (1968). “Tense Logic and the Theory of Linear Order”. PhD thesis. University of California, Los Angeles (cited on pages 4, 41).
Howard J. Karloff, Siddharth Suri, and Sergei Vassilvitskii (2010). “A model of computation for MapReduce”. In: Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms (cited on page 5).
Amirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das, and Siva Reddy (2023). “The Impact of Positional Encoding on Length Generalization in Transformers”. In: Advances in Neural Information Processing Systems (cited on pages 7, 10, 26).
Thomas S. Kuhn (1962). “The Structure of Scientific Revolutions”. University of Chicago Press (cited on page 1).
Zhiyuan Li, Hong Liu, Denny Zhou, and Tengyu Ma (2024). “Chain of Thought Empowers Transformers to Solve Inherently Serial Problems”. In: The Twelfth International Conference on Learning Representations (ICLR) (cited on page 7).
Bingbin Liu, Jordan T. Ash, Surbhi Goel, Akshay Krishnamurthy, and Cyril Zhang (2023). “Transformers Learn Shortcuts to Automata”. In: The Eleventh International Conference on Learning Representations. arXiv: 2210.10749 [cs.LG] (cited on page 7).
Charles London and Varun Kanade (2025). “Pause Tokens Strictly Increase the Expressivity of Constant-Depth Transformers”. In: Advances in Neural Information Processing Systems. arXiv:2505.21024 (cited on pages 6, 43).
Sean McLeish, Arpit Bansal, Alex Stein, Neel Jain, John Kirchenbauer, Brian R Bartoldson, Bhavya Kailkhura, Abhinav Bhatele, Jonas Geiping, Avi Schwarzschild, et al. (2024). “Transformers can do arithmetic with the right embeddings”. In: Advances in Neural Information Processing Systems (cited on page 13).
Robert McNaughton and Seymour Papert (1971). “Counter-Free Automata”. The M.I.T. Press (cited on pages 2, 4, 44).
William Merrill and Ashish Sabharwal (2023a). “A Logic for Expressing Log-Precision Transformers”. In: Advances in Neural Information Processing Systems. arXiv: 2210.02671 [cs.LG] (cited on pages 4, 6, 41, 43).
– (2023b). “The Parallelism Tradeoff: Limitations of Log-Precision Transformers”. In: Transactions of the Association for Computational Linguistics. arXiv: 2207.00729 [cs.CC] (cited on pages 4, 14).
– (2024). “The Expressive Power of Transformers with Chain of Thought”. In: The Twelfth International Conference on Learning Representations (ICLR) (cited on pages 4, 7, 10).
– (2025a). “A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers”. In: Advances in Neural Information Processing Systems (cited on page 7).
– (2025b). “Exact Expressive Power of Transformers with Padding”. In: Advances in Neural Information Processing Systems (cited on page 7).
William Merrill, Ashish Sabharwal, and Noah A. Smith (2022). “Saturated Transformers are Constant-Depth Threshold Circuits”. In: Transactions of the Association for Computational Linguistics. arXiv: 2106.16213 [cs.CL] (cited on pages 1, 4).
William Merrill et al. (2026). “Olmo Hybrid: From Theory to Practice and Back”. In: Third Conference on Language Modeling (cited on page 1).
Danupon Nanongkai and Michele Scquizzato (2022). “Equivalence classes and conditional hardness in massively parallel computations”. In: Distributed computing (cited on page 49).
Franz Nowak, Anej Svete, Alexandra Butoi, and Ryan Cotterell (2024). “On the Representational Capacity of Neural Language Models with Chain-of-Thought Reasoning”. In: Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (cited on page 7).
Catherine Olsson et al. (2022). “In-context Learning and Induction Heads”. arXiv: 2209.11895 [cs.LG] (cited on pages 11, 13).
Binghui Peng, Srini Narayanan, and Christos Papadimitriou (2024). “On Limitations of the Transformer Architecture”. In: First Conference on Language Modeling (COLM). arXiv: 2402.08164 [stat.ML] (cited on page 7).
Bowen Peng, Jeffrey Quesnelle, Honglu Fan, and Enrico Shippole (2024). “YaRN: Efficient Context Window Extension of Large Language Models”. In: International Conference on Learning Representations (cited on page 26).
Jorge Pérez, Javier Marinković, and Pablo Barceló (2019). “On the Turing Completeness of Modern Neural Network Architectures”. In: 7th International Conference on Learning Representations (ICLR) (cited on pages 4, 7, 10).
Karl Popper (1959). “The Logic of Scientific Discovery”. Basic Books (cited on pages 1, 8).
Ofir Press, Noah A. Smith, and Mike Lewis (2022). “Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation”. In: International Conference on Learning Representations (cited on page 26).
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu (2020). “Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer”. In: Journal of Machine Learning Research (cited on page 26).
Michael Rizvi-Martel, Satwik Bhattamishra, Guillaume Rabusseau, and Michael Hahn (2026). “From Expressivity to Sample Complexity: Narrow Teachers for Transformers via C-RASP”. arXiv:2607.11760 [cs.LG] (cited on page 7).
Tim Roughgarden, Sergei Vassilvitskii, and Joshua R. Wang (2018). “Shuffles and Circuits (On Lower Bounds for Modern Parallel Computation)”. In: Journal of the ACM (cited on pages 2, 5, 44, 47).
Clayton Sanford, Bahare Fatemi, Ethan Hall, Anton Tsitsulin, Mehran Kazemi, Jonathan Halcrow, Bryan Perozzi, and Vahab Mirrokni (2024). “Understanding Transformer Reasoning Capabilities via Graph Algorithms”. In: Advances in Neural Information Processing Systems. arXiv: 2405.18512 [cs.LG] (cited on page 5).
Clayton Sanford, Daniel Hsu, and Matus Telgarsky (2024). “Transformers, parallel computation, and logarithmic depth”. In: Proceedings of the 41st International Conference on Machine Learning. arXiv: 2402.09268 [cs.LG] (cited on pages 1, 5–7, 24, 41, 43, 48, 49, 56).
Clayton Sanford, Daniel J. Hsu, and Matus J. Telgarsky (2023). “Representational Strengths and Limitations of Transformers”. In: Advances in Neural Information Processing Systems (NeurIPS). arXiv: 2306.02896 [cs.LG] (cited on pages 3, 7).
Tobias Schnabel, Kiran Tomlinson, Adith Swaminathan, and Jennifer Neville (2025). “Lost in Transmission: When and Why LLMs Fail to Reason Globally”. In: Advances in Neural Information Processing Systems. arXiv: 2505.08140 [cs.AI] (cited on pages 1, 2, 5, 46, 49, 50).
Marcel-Paul Schützenberger (1965). “On Finite Monoids Having Only Trivial Subgroups”. In: Information and Control (cited on pages 4, 42, 44).
Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani (2018). “Self-Attention with Relative Position Representations”. In: Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (cited on page 26).
Lena Strobl (2023). “Average-Hard Attention Transformers are Constant-Depth Uniform Threshold Circuits”. arXiv: 2308.03212 [cs.CL] (cited on pages 4, 6, 41, 43).
Lena Strobl, William Merrill, Gail Weiss, David Chiang, and Dana Angluin (2024). “What Formal Languages Can Transformers Express? A Survey”. In: Transactions of the Association for Computational Linguistics. arXiv: 2311.00208 [cs.LG] (cited on pages 1, 7, 46, 47, 49).
Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu (2024). “RoFormer: Enhanced Transformer with Rotary Position Embedding”. In: Neurocomputing. arXiv: 2104.09864 [cs.CL] (cited on page 26).
Anej Svete, William Merrill, Ryan Cotterell, and Ashish Sabharwal (2026). “Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don’t”. In: Proceedings of the 43rd International Conference on Machine Learning. arXiv: 2605.30523 (cited on pages 6, 41, 43).
Wolfgang Thomas (1984). “An Application of the Ehrenfeucht–Fraissé Game in Formal Language Theory”. In: Mémoires de la Société Mathématique de France (cited on page 47).
Kiran Tomlinson, Tobias Schnabel, Adith Swaminathan, and Jennifer Neville (2026). “Reasoning about Reasoning: BAPO Bounds on Chain-of-Thought Token Complexity in LLMs”. In: Proceedings of the 43rd International Conference on Machine Learning (cited on page 7).
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin (2017). “Attention is All You Need”. In: Advances in Neural Information Processing Systems. arXiv: 1706.03762 [cs.CL] (cited on pages 1, 26).
Gail Weiss, Yoav Goldberg, and Eran Yahav (2021). “Thinking Like Transformers”. In: International Conference on Machine Learning. arXiv: 2106.06981 [cs.LG] (cited on pages 1, 7).
Avi Wigderson (1992). “The complexity of graph connectivity”. In: Mathematical Foundations of Computer Science 1992 (cited on page 48).
Andy Yang, Michaël Cadilhac, and David Chiang (2025). “Knee-Deep in C-RASP: A Transformer Depth Hierarchy”. In: Advances in Neural Information Processing Systems. arXiv: 2506.16055 [cs.CL] (cited on pages 2, 5, 11, 44, 50, 64, 65, 67).
Andy Yang and David Chiang (2024). “Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformers”. In: First Conference on Language Modeling (COLM). arXiv:2404.04393 [cs.L0] (cited on pages 2, 5–7, 11, 13, 41, 44, 47, 50, 64, 65, 67).
Andy Yang, David Chiang, and Dana Angluin (2024). “Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages”. In: Advances in Neural Information Processing Systems. arXiv: 2310.13897 [cs.FL] (cited on pages 2, 4, 6, 41, 42, 47).
Shunyu Yao, Binghui Peng, Christos Papadimitriou, and Karthik Narasimhan (2021). “Self-Attention Networks Can Process Bounded Hierarchical Languages”. In: Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers) (cited on pages 7, 23).
Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank Reddi, and Sanjiv Kumar (2020). "Are Transformers universal approximators of sequence-to-sequence functions?" In: International Conference on Learning Representations (cited on page 7).
Hattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin, Omid Saremi, Joshua Susskind, Samy Bengio, and Preetum Nakkiran (2024). “What Algorithms Can Transformers Learn? A Study in Length Generalization”. In: The Twelfth International Conference on Learning Representations (ICLR) (cited on pages 7, 10).
A Task Suite Details
We separate the mathematical functions and languages that describe tasks (Appendix A.1) from the experimental sampling, tokenization, and supervision choices (Appendix A.2).
A.1 Mathematical task definitions
We write and use one-based positions in the mathematical definitions. Unless stated otherwise, , data are binary, and task parameters are fixed independently of .
Definition 1 (Boolean tasks). For ,
Definition 2 (INDEX and INDEX-*). For data and query ,
Given and , with queries ,
Taking F to be conjunction, disjunction, or parity gives INDEX-ALL, INDEX-ANY, or INDEX-PARITY, respectively.
We occasionally consider fixed-range INDEX , where we fix an index bound and have for each queried index . When needed for clarity, we refer to the unbounded-index version as growing-range index. Similarly, INDEX- denotes the fixed-range version of INDEX- , with every query bounded by .
Definition 3 (SPARSE- ). Fix a tuple of positive indices and a Boolean function , with , independently of the input length . Repeated indices are allowed. For ,
Conjunction, disjunction, and parity give SPARSE-ALL, SPARSE-ANY, and SPARSE-PARITY.
Definition 4 (BINARYADD). For a binary string written most-significant bit first, let . The decision version of BINARYADD checks whether two n-bit numbers sum to a proposed -bit result. For and ,
Definition 5 (DYCK). Fix bracket types, with alphabet . The DYCK-k language is generated by the context-free grammar with start symbol and productions
For , its nesting depth depth( ) is the maximum, over all prefixes of , of the number of opening brackets minus the number of closing brackets. For a fixed depth bound , define
Definition 6 (k-HOP INDUCTION). Fix a finite alphabet and . For , define
leaving undefined when there is no previous occurrence. The output of -HOP INDUCTION is if all hops are defined, and a null symbol otherwise. Each hop moves to the position immediately after the most recent earlier occurrence of the current symbol. Adjacent repeats are allowed and can give .
Definition 7 (Graph problems). An instance consists of a directed graph and query vertices . EDGE EXISTENCE returns . DIRECTED REACHABILITY returns 1 exactly when there is a directed path from to . UNDIRECTED REACHABILITY returns 1 exactly when there is a path from to after edge directions are ignored.
A.2 Experimental tasks
This appendix describes how we sample and encode tasks for the experiments. Table 3 lists every task setting and the experiments that use it. The text format used for pretrained LLMs is described in Appendix B.4.
Throughout, is the size of an instance: the number of input bits or symbols, the number of bits per operand for BINARYADD, the number of bracket pairs for DYCK, and the number of nodes for the graph tasks. Positions are numbered from 0. All tasks are supervised with a cross-entropy loss at the scored positions only. Unless stated otherwise, a single position is scored: the last token of the input, where the model predicts the answer.
Table 3: Task settings. Each row is one or more task settings. “Tokens” is the input length for models trained from scratch at size . A check mark means the setting is used in the in-distribution (ID), length-generalization (LG), or pretrained-LLM (LLM) experiment. In total, ID uses 34 settings, LG uses 34, and LLM uses 27.
| Task | Settings | Tokens | ID | LG | LLM |
|---|---|---|---|---|---|
| ALL, ANY, MAJORITY, PARITY | one each | ✓ | ✓ | ✓ | |
| INDEX | 8 symbols | ✓ | ✓ | ✓ | |
| INDEX-ALL, INDEX-ANY, INDEX-PARITY | ✓ | ✓ | ✓ | ||
| SPARSE-ALL, SPARSE-ANY, SPARSE-PARITY | ✓ | ✓ | - | ||
| BINARYADD | blocked or interleaved input; MSB- or LSB-first output | ✓ | ✓ | ✓ | |
| DYCK-1, DYCK-2 | depth bound | ✓ | ✓ | ✓ | |
| -HOP INDUCTION | ✓ | ✓ | ✓ | ||
| EDGE EXISTENCE | sparse supervision (final answer only) | ✓ | ✓ | ✓ | |
| EDGE EXISTENCE | dense supervision (every edge) | ✓ | ✓ | - | |
| DIRECTED REACHABILITY, UNDIRECTED REACHABILITY | one each | ✓ | ✓ | ✓ |
A.2.1 Boolean tasks
For the experiments, bits are drawn i.i.d. with a probability chosen so that both labels are equally likely. For ALL, ; for ANY, ; for PARITY, . For MAJORITY, bits are uniform and the label 1 is slightly more likely due to ties (Table 7).
A.2.2 Indexed retrieval
Index. The input is a sequence of symbols , drawn i.i.d. and uniformly from an alphabet of 8 symbols, followed by one address token . The answer is . The address is uniform over , where is the index range. Each address is an atomic token, so the vocabulary has one token for every allowed address.
Index-All, Index-Any, Index-Parity. The input is a bit string , a separator token, and address tokens . The addresses are distinct and drawn uniformly without replacement from . The answer is the AND, OR, or XOR of . Bits are drawn i.i.d. so that both labels are equally likely given : for AND, for OR, and for XOR.
Index range. In the in-distribution experiment the index range grows with the input, , so every position can be queried and the address vocabulary grows with n. In the length-generalization experiment the range is fixed at , so test inputs longer than the training inputs introduce no new address tokens (see Appendix F.1).
A.2.3 Sparse Boolean functions
The input is a bit string with no other tokens. A set of hidden positions is fixed for each task setting and never appears in the input. The answer of SPARSE-ALL, SPARSE-ANY, and SPARSE-PARITY is the AND, OR, or XOR of , and the model must infer the hidden positions from the training data. Bits are drawn as for the indexed functions. In the in-distribution experiment the hidden positions are drawn once, uniformly at random, from , separately for each (for example, at and at for ). In the length-generalization experiment they are drawn from and shared by all lengths: for and for . The same hidden positions are used for AND, OR, and XOR.
A.2.4 Binary addition
The input is two n-bit unsigned operands a and b, drawn independently and uniformly from with leading zeros kept. The answer is the -bit sum . Operand bits use role-specific tokens (A0, A1, B0, B1) and are written most-significant bit first. In the blocked layout all bits of a precede all bits of b; in the interleaved layout the bits alternate, . An answer-marker token follows the operands. The model then predicts the result bits autoregressively, either most-significant bit first or least-significant bit first. During training the result bits are teacher-forced; the input therefore has tokens and scored positions. At evaluation the model generates all bits greedily, and an example is correct only if every bit is correct. The main-text figures show the blocked layout with MSB-first output.
A.2.5 Dyck languages
DYCK-1 and DYCK-2 use K = 1 and K = 2 bracket types, and a depth bound , where is unbounded DYCK. An instance of size n is a correctly nested string of n bracket pairs, with nesting depth at most D, framed by START and END tokens tokens). Strings are sampled uniformly among all such strings, and each pair receives an independent uniform type. Rather than the theoretical membership problem of Definition 5, we run experiments on the next-token formulation of Yao et al. (2021). Membership as a classification task requires a distribution of negative examples, and it is difficult to design one that rules out shortcuts and truly tests whether the model has learned the nesting structure. In the next-token formulation, only a positive distribution is needed, and the task is to predict, after START and after every bracket, the set of tokens that can legally come next. A model that predicts every legal set correctly also decides membership, since a string is in the language exactly when each of its tokens is legal at its position. The legal set contains every opening bracket if the current depth is below D, the closing bracket that matches the most recent unclosed opening bracket if the depth is positive, and END if the depth is zero. The target at each of the scored positions is a binary vector over the 2K brackets and END, trained with binary cross-entropy. An example is correct only if the predicted set is exactly right at every scored position.
A.2.6 Iterated retrieval: k-Hop Induction
The input is a sequence over an alphabet of 4 symbols. The first symbol is uniform, and each later symbol is uniform over the 3 symbols that differ from its predecessor, following Sanford, Hsu, and Telgarsky (2024). One hop from position finds the most recent earlier occurrence of the current symbol, , and moves to . Starting at , -HOP INDUCTION applies hops and returns . If some hop finds no earlier occurrence, the answer is a special null symbol, so the output has 5 classes. We use with the alphabet fixed for all ; is 1-HOP INDUCTION.
A.2.7 Graph tasks
The three graph tasks use the same graph distribution and input format and differ only in the question. An instance of size n is a simple directed graph with n nodes and n edges, drawn uniformly. Node names are atomic tokens, drawn uniformly without replacement from a pool of 256 names, so larger graphs introduce no new tokens. Each edge is written as the three tokens . The edge list is followed by and an token, which gives tokens. The answer is binary: EDGE EXISTENCE asks whether is a listed edge; DIRECTED REACHABILITY asks whether there is a directed path from s to t; UNDIRECTED REACHABILITY asks whether s and t are connected when edge directions are ignored. From each graph we draw one positive and one negative query: positives uniformly among ordered pairs , , with a positive answer, and negatives uniformly among pairs with a negative answer. Graphs that do not admit both a positive and a negative query are rejected and redrawn. For EDGE EXISTENCE, negative queries include reversed edges, so the model must read edge direction.
Sparse and dense supervision for Edge Existence. By default only the final answer is labeled; we call this sparse supervision. In the dense variant the query is placed before the edge list (<QUERY> s t, then the edges, then <ANSWER>), so that a causal model sees the query while reading each edge. In addition to the final answer, the last token of every edge is labeled with whether that edge equals the query. We report accuracy on the final answer only, so the metric is the same as for final-answer supervision. This variant changes both the supervision and the position of the query; Appendix C.1 discusses its results.
B Experimental Details
This appendix describes the models, training, and evaluation of the three experiments in Section 3.3. Appendix B.5 defines normalized accuracy and the chance level of each task.
B.1 Model architecture and training
All models trained from scratch are decoder-style transformers with pre-layer normalization, softmax attention, and a two-layer feedforward block of width 4d with GELU activation, where d is the model width. Attention and feedforward layers have biases, and there is no dropout. Input and output embeddings are tied, except for the graph tasks and BINARYADD, which use a separate two-class output layer. All models are trained with AdamW, a constant learning rate of with no warmup, no weight decay, gradient-norm clipping at 1.0, batch size 256, and bfloat16 mixed precision. Table 4 lists the settings that differ between the in-distribution and length-generalization experiments.
B.2 In-distribution learning
Design. For each task setting and input size , we train on examples of size and evaluate on fresh examples of the same size. The model is a causal transformer with 4 layers, width 256, 4 heads, and rotary positional encoding (base ). We vary the number of distinct training examples and repeat each configuration with 5 seeds. Every run
Table 4: Training settings of the two from-scratch experiments. Settings shared by both experiments are given in the text.
| In-distribution | Length generalization | |
|---|---|---|
| Model sizes (layers, width, heads) | (4, 256, 4) | S (2, 64, 2), M (4, 128, 4), L (8, 256, 8) |
| Positional encoding | RoPE | 9 encodings (Table 5), plus uniform attention |
| Attention mask | causal | causal; also bidirectional where the task allows |
| Training sizes | one of 8, 16, 32, 64, 128, 256 | 8, 16, 20, 24, 32 jointly |
| Evaluation sizes | the training size | 8, 16, 20, 24, 32, and 48 to 256 in steps of 16 |
| Training examples | 8,192, split evenly over training sizes | |
| Optimizer steps | 2,048 (epochs ) | 1,120 (32 epochs) |
| Evaluation examples | 8,192 | 1,024 per evaluation size |
| Seeds | 5 | 5 |
| Runs | 5,100 | 8,550 |
takes 2,048 optimizer steps with batch size 256, that is, example presentations. A run with training examples therefore makes passes over its data, from 8 epochs at to 2,048 epochs at . This holds the training compute fixed, so differences across reflect the number of distinct examples rather than the number of gradient steps. The experiment covers all 34 task settings of Table 3.
Data. All runs at a given (setting, ) are evaluated on the same 8,192 held-out examples. Each seed has its own training set of examples, disjoint from those of other seeds, and the smaller training sets are nested subsets of it. Comparisons across within a seed are therefore paired, and seeds use independent training data. The seed also sets the model initialization and the order of training examples. Held-out examples are distinct draws, but for small the input space is small, so the same input can appear in both the training and held-out sets (for example, there are only bit strings at ).
Evaluation and grading. At the end of training we evaluate on the 8,192 held-out examples and on 1,024 of the training examples. The metric is full-sequence accuracy, normalized by the chance level of the task (Appendix B.5). A task setting is solved at size if, for some , at least one of the five seeds reaches 90% normalized accuracy on the held-out examples. The setting is graded Easy if it is solved at the largest size, , and Hard otherwise.
B.3 Length generalization
Design. Each run trains one model jointly on sizes and evaluates it at 19 sizes: the five training sizes and every multiple of 16 from 48 to 256. The training set has 8,192 examples, split evenly across the five sizes, and each batch contains a single size. Training takes 32 epochs, or 1,120 optimizer steps. Each evaluation size uses 1,024 fresh examples. The seed sets the model initialization. For a given task setting and seed, every architecture uses the same training data, data order, and evaluation data, so comparisons across architectures are paired.
Architectures. We cross three model sizes (Table 4) with the nine positional encodings of Table 5. We also train an attention ablation with uniform attention, where queries and keys are set to zero so that every head attends uniformly over its allowed positions, with a BOS token prepended. This matches the attention model of C-RASP, and we use it only for the comparison in Figure 8. Every task setting is trained with a causal mask. Task settings with a single answer at the last position are also trained with a bidirectional mask. DYCK, BINARYADD, and EDGE EXISTENCE with dense supervision score positions before the end of the input, so they use the causal mask only. This gives 57 (task setting, mask) pairs, each trained with three model sizes and ten attention variants (the nine positional encodings and uniform attention).
Table 5: Positional encodings in the length-generalization experiment.
| Encoding | Position information |
|---|---|
| NoPE | None (Kazemnejad et al., 2023) |
| NoPE + BOS | None; a learned beginning-of-sequence token is prepended |
| Sinusoidal | Fixed sinusoidal encoding added to the input embeddings (Vaswani et al., 2017) |
| RoPE | Rotary encoding of queries and keys, base (Su et al., 2024) |
| YaRN | RoPE with YaRN dynamic scaling; the training length is the longest training input (Peng et al., 2024) |
| T5 bias | Learned relative attention bias, 32 buckets, maximum distance 128 (Raffel et al., 2020) |
| Shaw | Learned relative position embeddings, distances clipped at 16 (Shaw, Uszkoreit, and Vaswani, 2018) |
| DeBERTa | Disentangled relative attention (content-to-position and position-to-content), 256 buckets (He et al., 2021) |
| ALiBi | Fixed linear attention bias (Press, Smith, and Lewis, 2022) |
Index range and hidden positions. For the indexed tasks, query addresses are restricted to positions 0 to 19, and for the sparse tasks the hidden positions lie in the same range (Appendices A.2.2 and A.2.3). All address tokens and hidden positions are therefore seen during training. Longer test inputs add unqueried positions but no new addresses, so the experiment tests generalization to longer inputs rather than to unseen address tokens. Because the index range does not grow with , the indexed settings are a different task from the in-distribution ones, and we do not compare them with theory predictions in Table 2.
Grading. The metric is normalized full-sequence accuracy, except for EDGE EXISTENCE, where we score the final answer only (Appendix A.2.7). A seed succeeds at a size if it reaches 90% normalized accuracy there. A seed is credited only if it succeeds at all five training sizes. Its horizon is then the largest evaluation size up to which it succeeds at every size, starting from 48. A configuration (model size, positional encoding, mask) takes the largest horizon among its five seeds, so the credited horizon is always reached by one trained model. The main search covers the 27 causal configurations with the nine positional encodings. A task setting is solved at size if some configuration in the main search has horizon at least , and it is graded Easy if it is solved at . For each task, panel (b) of Figure 3 shows the configuration with the largest horizon, with ties broken by the median out-of-distribution accuracy across seeds, then the mean, then in-distribution accuracy.
B.4 Pretrained language models
Models. Table 6 lists the evaluated models. We disable reasoning in the main evaluation, using each provider's control for this. GPT-4o mini does not reason. For GPT-5, we additionally evaluate every task setting with medium reasoning effort (Appendix C.4.1). We use each provider's default sampling settings and request a structured JSON answer.
Tasks and sizes. We evaluate the 27 task settings of Table 3 marked for LLMs. The sparse tasks are excluded because the hidden positions must be inferred from many labeled examples, which does not fit a few-shot prompt. Each setting is evaluated at with 128 examples per size. All models see the same prompts. For BINARYADD, the model returns all result bits at once, in the requested order. For the graph tasks, the edge list precedes the query.
Table 6: Evaluated language models. Reasoning is disabled for all models in the main evaluation.
| Model | Model ID | Reasoning control |
|---|---|---|
| GPT-5 | gpt-5-2025-08-07 | effort none; also medium |
| GPT-5.4 mini | gpt-5.4-mini-2026-03-17 | effort none |
| GPT-4o mini | gpt-4o-mini-2024-07-18 | not applicable |
| DeepSeek-V3.2 | DeepSeek-V3.2 | effort none |
| Gemini 2.5 Flash | gemini-2.5-flash | thinking budget 0 |
Prompts. The system message is: "You solve precisely specified formal tasks over symbol sequences. Follow the task definition exactly and return only the requested structured answer." The user message contains a natural-language definition of the task, a sentence describing the answer format, three solved examples of size 12, and the test input. The solved examples are the same for every test size. Inputs are written as text: bits and symbols separated by spaces, symbols as letters, Dyck brackets as (_1 and )_1, graph nodes as vi with one edge per line, and binary operands as bit strings. Appendix B.6 shows one prompt for every task.
Scoring and failures. An answer is correct only if it matches the target exactly: the single label for most tasks, all bits for BINARYADD, and the legal-next-token set at every prefix for DYCK. Refusals and responses that are not valid JSON of the requested form are counted as incorrect. Responses that exhaust the completion-token budget are counted as incorrect. The completion-token budget is at least 4,096 tokens and several times the length of a correct answer, with additional tokens when reasoning is enabled. Without reasoning, truncation occurs only on long answers (DYCK and BINARYADD) at sizes where accuracy is already near zero. With reasoning, occurs mainly on BINARYADD (Appendix C.4.1). Whether truncations are treated as incorrect predictions or filtered out does not affect any Easy/Hard grade.
Accuracy is normalized with the chance levels of Table 7.
Grading. Each model is graded on its own. A model solves a task setting at size n if its normalized accuracy is at least 90%, and a setting is graded Easy for that model if it is solved at the largest evaluated size, n = 128. A setting receives the best grade reached by any single model. Gemini 2.5 Flash is not evaluated on BINARYADD or on bounded DYCK-2 (D = 4 and D = 8). For the two of these settings shown in panel (c) of Figure 3, the panel averages the other four models; all other rows average five models.
B.5 Normalized accuracy
Tasks differ in how often a constant answer is correct, so raw accuracies are not comparable across tasks. We therefore report normalized accuracy , where is accuracy and is the chance level of the task, so that chance maps to 0 and perfect accuracy maps to 1. The chance level is the accuracy of the best constant answer at input size : the probability of the most likely answer under the input distribution of the task. A model that ignores its input therefore scores at most 0. Here is full-sequence accuracy: an example counts as correct only if every scored output is correct, which for single-answer tasks is the accuracy of that answer. Table 7 lists the chance level of each task. For most tasks it is a constant, because the input distribution makes all answers equally likely. For MAJORITY and -HOP INDUCTION it depends on . A setting counts as solved at a given input size when its normalized accuracy reaches , and each experiment combines this threshold with its own rules over seeds and lengths to assign a grade. For -HOP INDUCTION, the input distribution does not change when the symbols are relabeled, so all symbol answers are equally likely, and the best constant answer is either the null answer or any single symbol. We estimate the probability of the null answer from 200,000 samples per . For tasks whose answer is a sequence, DYCK and BINARYADD, we report full-sequence accuracy without normalization . Here the best constant answer is a single fixed answer sequence, and models that fail generally score near 0 rather than near its accuracy. One exception is unbounded DYCK-1 in the in-distribution
Table 7: Chance level : the accuracy of the best constant answer at input size . Tasks with sequence answers use full-sequence accuracy without normalization. The same values are used in all three experiments.
| Tasks | Chance level | Reason |
|---|---|---|
| ALL, ANY, PARITY,INDEX-ALL/ANY,INDEX-PARITY,SPARSE-ALL/ANY,SPARSE-PARITY | 1/2 | Bits are drawn with a per-bit probability that makes both labels equally likely. |
| EDGE EXISTENCE,DIRECTED REACHABILITY,UNDIRECTEDREACHABILITY | 1/2 | Each graph yields one positive and one negative query. With dense supervision, the all-negative answer is correct exactly on negative queries. |
| MAJORITY | (n even) | Bits are uniform and ties are labeled 1, so label 1 is more likely: 0.64 at , 0.52 at . |
| INDEX-HOP INDUCTION | The queried symbol is uniform over 8 values.4 equally likely symbols plus the null answer, which has probability . For , at ; for , for all . | |
| DYCK-1, DYCK-2,BINARYADD | 0 (full sequence) | Sequence answers: the legal next-token set after each prefix, or all bits of the sum. We do not normalize. |
experiment: the best constant answer (the depth returns to 0 only at the end of the string) has accuracy , and models that fail at score 0.2 to 0.33, close to it.
B.6 LLM prompts
This section shows the user message of one evaluated prompt for each task, followed by the expected answer; the system message is given in Appendix B.4. Each prompt is the first test input of size n = 8 in the evaluation. The evaluated prompts contain three solved examples of size 12; to save space we show only the first. For tasks with several settings we show one; the other settings change only the parameters in the task definition (the number of queried positions k, the number of bracket types, the depth bound, the number of hops, or the order of the output bits). Long lines are wrapped for display.
All
You are given a string of bits. Each bit is 0 or 1, and the bits are separated by spaces. Compute the AND of every bit: the answer is 1 if every bit in the string is 1, and 0 otherwise.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 1 0 1 0 1 1 1 1 1 1 1 Answer: {"answer": 0}
Now solve this instance. Bits: 1 1 1 1 1 1 1 1
Expected answer: {"answer": 1}
Any
You are given a string of bits. Each bit is 0 or 1, and the bits are separated by spaces. Compute the OR of every bit: the answer is 1 if at least one bit in the string is 1, and 0 if every bit is 0.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 0 0 0 0 0 0 0 0 0 0 Answer: {"answer": 1}
Now solve this instance. Bits: 0 0 0 0 0 0 0 0
Expected answer: {"answer": 0}
Majority
You are given a string of bits. Each bit is 0 or 1, and the bits are separated by spaces. Compute the majority bit: the answer is 1 if at least half of the bits in the string are 1, and 0 otherwise. An exact tie counts as 1.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 1 0 0 0 1 0 0 1 1 1 1 Answer: {"answer": 1}
Now solve this instance. Bits: 1 0 1 1 1 0 1 0
Expected answer: {"answer": 1}
Parity
You are given a string of bits. Each bit is 0 or 1, and the bits are separated by spaces. Compute the parity of the string: the XOR of every bit. The parity is 1 if the number of 1s in the string is odd, and 0 if it is even. Report that parity bit.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 1 0 0 0 1 0 0 1 1 1 1 Answer: {"answer": 1}
Now solve this instance. Bits: 1 0 1 1 1 0 1 0
Expected answer: {"answer": 1}
Index
You are given a sequence of symbols separated by spaces, drawn from the alphabet a, b, c, d, e, f, g, h. Positions are numbered from 0, so the first symbol is at position 0, the second at position 1, and so on.
You are also given a query position. Report the symbol that sits at that position in the sequence.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Sequence: c d g f a c e f g h d d Query position: 8 Answer: {"answer": "g"}
Now solve this instance. Sequence: e h f a d d d h Query position: 4
Expected answer: {"answer": "d"}
Index-All
You are given a string of bits separated by spaces. Each bit is 0 or 1. Positions are numbered from 0, so the first bit is at position 0, the second at position 1, and so on. You are also given 2 distinct query positions. Compute the AND of the bits at those query positions: the answer is 1 if every one of them is 1, and 0 otherwise.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 1 0 1 0 1 0 1 1 1 1 1 Query positions: 9 5 Answer: {"answer": 1}
Now solve this instance. Bits: 1 0 1 1 1 1 1 0 Query positions: 3 2
Expected answer: {"answer": 1}
Index-Any
You are given a string of bits separated by spaces. Each bit is 0 or 1. Positions are numbered from 0, so the first bit is at position 0, the second at position 1, and so on. You are also given 2 distinct query positions. Compute the OR of the bits at those query positions: the answer is 1 if at least one of them is 1, and 0 otherwise.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 0 0 0 0 1 0 0 1 1 0 1 Query positions: 9 5 Answer: {"answer": 1}
Now solve this instance. Bits: 0 0 1 1 0 0 0 0 Query positions: 3 2 Expected answer: {"answer": 1}
Index-Parity (k = 2).
You are given a string of bits separated by spaces. Each bit is 0 or 1. Positions are numbered from 0, so the first bit is at position 0, the second at position 1, and so on. You are also given 2 distinct query positions.
Compute the XOR of the bits at those query positions: the answer is 1 if an odd number of them are 1, and 0 otherwise.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1: Bits: 1 1 0 0 0 1 0 0 1 1 1 1 Query positions: 9 5 Answer: {"answer": 0}
Now solve this instance. Bits: 1 0 1 1 1 0 1 0 Query positions: 3 2 Expected answer: {"answer": 0}
BinaryAdd (blocked, MSB-first output).
Add two unsigned binary operands of the same width. Leading zeros are significant for the required width. Return the sum using exactly one more bit than either operand, in msb first order.
Respond with only a JSON object of the form {"answer": "<bits>"} . The answer must be a string so leading zeros are preserved.
Example 1: Operand A (msb first): 111010001010 Operand B (msb first): 011010011100 Answer: {"answer": "1010100100110"}
Now solve this instance. Operand A (msb first): 11110110 Operand B (msb first): 01100010
Expected answer: {"answer": "101011000"}
Dyck-2 ( ).
This is next-token prediction in the Dyck language of balanced bracket strings, with 2 bracket types. Type 1 opens with (-1 and closes with )_1. Type 2 opens with (-2 and closes with )_2.
A bracket string is balanced when each closing bracket matches the most recent opening bracket that is not yet closed and is of the same type as it, and no opening bracket is left unclosed at the end.
You are given a balanced string, written as brackets separated by spaces. For each prefix of the string, list every token that can legally come next.
A token can legally come next when the prefix followed by that token is itself the prefix of some balanced string. Judge each prefix on its own: use only the brackets in it, ignore the rest of the given string, and allow the balanced string it extends to be any length. The token "END" can come next when the prefix is already balanced, meaning the string may stop there.
Respond with a JSON object holding a single field "answer", and nothing else. "answer" holds one entry per prefix of the string. Entry 0 is for the empty prefix, before any bracket. Entry i is for the prefix made of the first i brackets. The last entry is for the whole string. So a string of m brackets has exactly entries, and m is given with each string. Each entry lists the tokens that can come next after that prefix, in any order.
Example 1:
String: (_1)_1 (_2 (_2 (_1)_1)_2)_2 (_1 (_1)_1 (_1 (_2 (_1)_1 (_1 (_2)_2 (_2)_2)_1)_2)_1)_1
Number of brackets: 24
Answer: [{"_1", "(_2", "END"], ["_1", "(_2", ")_1"], ["_1", "(_2", "END"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", "END"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", ")_1"], ["_1", "(_2", "END"]}]
Now solve this instance.
String: (_2 (_2 (_2)_2)_2 (_1 (_1)_1)_1 (_2)_2)_2 (_2 (_2)_2)_2
Number of brackets: 16
Expected answer:
{"answer": [{"_1", "(_2", "END"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", "END"], ["_1", "(_2", ")_2"], ["_1", "(_2", ")_2"], ["_1", "(_2", "END"]}]
k-Hop Induction .
Consider the k-hop induction head task with k = 2.
You are given a string s_1 s_2 ... s_N of symbols separated by spaces, drawn from the alphabet a, b, c, d.
Start at the last position, so p = N. Then do the following 2 times:
-
Let , the symbol at the current position p.
-
Let i be the largest index with i < p and . This is the most recent occurrence of x strictly before the current position. If there is no such i, stop and return "none".
-
Set .
After the last repetition, return s_p.
In words: each step looks back for where the current symbol last occurred, then moves to the symbol immediately after that occurrence.
Respond with a JSON object holding a single field "answer", and nothing else.
Example 1:
Sequence: c d c d b d c d b a c a
Answer: {"answer": "d"}
Now solve this instance.
Sequence: a c a c a c a d
Expected answer:
{"answer": "none"}
Edge Existence.
You are given a finite directed graph and an edge query. Edges are written "u -> v", meaning that there is a directed edge from u to v. Set the Boolean "answer" to true if the queried edge is one of the listed edges, and false otherwise. Direction matters: "u -> v" being listed does not mean "v -> u" is listed.
Respond with a JSON object holding the Boolean field "answer".
Example 1: Directed edges: v22 -> v105 v56 -> v105 v31 -> v120 v10 -> v105 v56 -> v37 v56 -> v22 v37 -> v55 v98 -> v10 v31 -> v10 v56 -> v120 v58 -> v126 v22 -> v10
Query: Source: v56 Target: v31 Answer: {"answer": false}
Now solve this instance. Directed edges: v48 -> v22 v79 -> v55 v49 -> v22 v76 -> v96 v76 -> v78 v49 -> v76 v96 -> v55 v48 -> v49
Query: Source: v48 Target: v22
Expected answer: {"answer": true}
Directed Reachability
You are given a finite directed graph and a reachability query. Edges are written "u -> v", meaning that there is a directed edge from u to v. Set the Boolean "answer" to true if there is a directed path from the source to the target, and false otherwise.
Respond with a JSON object holding the Boolean field "answer".
Example 1: Directed edges: v22 -> v105 v56 -> v105 v31 -> v120 v10 -> v105 v56 -> v37 v56 -> v22 v37 -> v55 v98 -> v10 v31 -> v10 v56 -> v120 v58 -> v126 v22 -> v10
Query: Source: v94
Target: v56 Answer: {"answer": false}
Now solve this instance. Directed edges: v48 -> v22 v79 -> v55 v49 -> v22 v76 -> v96 v76 -> v78 v49 -> v76 v96 -> v55 v48 -> v49
Query: Source: v76 Target: v96
Expected answer: {"answer": true}
Undirected Reachability
You are given a finite undirected graph and a connectivity query. Edges are written "u -- v", meaning that u and v are joined by an edge. The same edge may be listed more than once; a repeat carries no extra meaning. Set the Boolean "answer" to true if some path of edges joins the two query nodes, and false otherwise.
Respond with a JSON object holding the Boolean field "answer".
Example 1: Undirected edges: v22 -- v105 v56 -- v105 v31 -- v120 v10 -- v105 v56 -- v37 v56 -- v22 v37 -- v55 v98 -- v10 v31 -- v10 v56 -- v120 v58 -- v126 v22 -- v10
Query: Node A: v94 Node B: v56 Answer: {"answer": false}
Now solve this instance. Undirected edges: v33 -- v73 v33 -- v7 v78 -- v73 v73 -- v60 v5 -- v29 v60 -- v5 v60 -- v73 v78 -- v7
Query: Node A: v86 Node B: v5
Expected answer: {"answer": false}
C Additional Experimental Results
This appendix reports the full results of the three experiments, including task settings that the main-text figures omit, and two analyses referenced in Section 4: pretrained LLMs with reasoning enabled (Appendix C.4.1) and EDGE EXISTENCE with dense supervision (Appendix C.1).
C.1 Edge Existence with dense supervision
Small transformers fail to learn EDGE EXISTENCE when only the final answer is supervised, so we also train it with dense supervision (Appendix A.2.7). With dense supervision, the last token of every edge is labeled with whether that edge equals the query, and the query is placed before the edge list so that a causal model can compare each edge with it. Both settings are scored on the final answer only. We find that dense supervision makes the task learnable. In distribution, it is solved at every size except (best seed 0.87 normalized accuracy), with training examples for and for and (Figure 4). In the length-generalization experiment, one configuration (medium size, Shaw relative encoding) generalizes up to (Figure 5). A small transformer can therefore represent and learn the lookup that EDGE EXISTENCE requires; the failure under sparse supervision appears to be a failure of learning.
C.2 In-distribution learning
The full grid behind panel (a) of Figure 3 appears in Figure 4, covering all task settings. The settings included in Figure 4 that are omitted from the main figure are: ANY; INDEX-ANY ( ); INDEX-ALL and INDEX-PARITY with ; SPARSE-ANY ( ); SPARSE-ALL and SPARSE-PARITY with ; the other three BINARYADD formats; DYCK with ; and EDGE EXISTENCE with dense supervision.

Figure 4: In-distribution learning, all task settings. Each cell shows normalized accuracy for one task setting at input size n (column groups) and training-set size N (columns within a group). Each cell depicts the minimum, mean, and maximum over five seeds. Easy/ Hard labeling criteria are described in Appendix B.2.
C.3 Length generalization
Figure 5 shows all task settings for the length generalization experiments, highlighting only the best positional encoding and model size configuration. Figure 6 shows how length generalization depends on the positional encoding used. Figure 7 compares causal and bidirectional attention. Figure 8 compares uniform attention with the best configuration shown in Figure 5.

Figure 5: Length generalization, all task settings. Same conventions as panel (b) of Figure 3: for each task setting, we plot the best positional encoding and model size configuration, noted on the right.

Figure 6: Dependence of length generalization on positional encoding. Mean out-of-distribution normalized accuracy () for each task and positional encoding, using causal attention and the best model size for each pair. Corner tabs show the minimum and maximum over seeds when they differ by more than 0.05. Some tasks like SPARSE-ALL, SPARSE-PARITY, 1-HOP INDUCTION, and DYCK-1 succeed only for certain positional encodings.

Figure 7: Length generalization with causal versus bidirectional attention. Here, we compare length generalization performance of the best configurations with causal and bidirectional attention. Cells show mean normalized accuracy across seeds, with a shared color scale. Corner tabs show the minimum and maximum over seeds when they differ by more than 0.05. Performance is fairly consistent between causal and bidirectional attention, although mean performance differs for some sparse tasks.

Figure 8: Length generalization with uniform attention versus the best configuration. This plot shows length generalization performance of uniform attention ( , with a BOS token) at its best model size with causal attention, compared with the best configuration of the main search in Figure 5. Uniform attention performs substantially worse across many problems.
C.4 Pretrained language models
C.4.1 LLMs with reasoning
Our main LLM evaluation disables reasoning to align with theory predictions about single-step generation. To measure how much intermediate reasoning changes the results, we evaluate GPT-5 with medium reasoning effort on the same prompts. Figure 9 compares reasoning and non-reasoning performance. With medium reasoning, many BINARYADD responses exhaust the completion-token budget, and we count these as incorrect, as in the main evaluation (Appendix B.4). Depending on the input format, 3% to 25% of these responses are truncated. Truncation is most frequent at intermediate sizes, so accuracy is not monotone in for three of the four formats. Excluding truncated responses instead would raise accuracy at intermediate sizes by up to 0.58, but would not change the grade the model receives for any task.

Figure 9: GPT-5 with and without reasoning. Normalized accuracy for the same task settings and prompts, with reasoning disabled (left) or medium reasoning effort (right).
D Background on the Theories
Table 8 below discusses the source and assumptions of each edge in Figure 2 describing a relationship between an abstract theory and a class of transformers. The figure is reproduced below for ease of reference. A containment arrow means that every task in is also in , and a non-containment arrow means that there exist some tasks in that are not in . A dashed arrow indicates a caveat. Since various technical assumptions (e.g., precision, width, etc.) can affect the theoretical containment relations, the figure compares against the base transformer class associated with each line of work. Where there are deviations, we mark the relation with a caveat, and discuss the details in the table below. Notably, positional encoding assumptions can differ across different base transformer classes. In particular, the base transformer classes associated with Star-free and C-RASP assume no positional encoding, with positional information encoded by the causal mask. In contrast, the bidirectional classes (, , and MPC) allow arbitrary positional encodings.

Figure 10: Formal expressivity relations between theories and transformer classes (reproduced from Figure 2).
Table 8: Guide to the edges in Figures 2 and 10.
| Relation | Result |
|---|---|
| Star-free | |
| a Star-free Causal Hard Attn. with caveats | Yang, Chiang, and Angluin (2024, Theorem 5) show that strictly future-masked, rightmost-hard-attention transformers without positional encodings recognize every star-free language. The construction goes through the B-RASP programming language, which allows both strictly future-masked and strictly past-masked attention. B-RASP is equivalent to linear temporal logic with both since and until, which defines exactly the star-free languages. Every LTL formula is equivalent to one that uses only since when evaluated at the last position (Kamp, 1968; Gabbay et al., 1980), so every B-RASP program with both kinds of masking has an equivalent program that uses only causal future masking. However, this rewriting has a cost, as the past-only formula can be exponentially larger than an equivalent formula that uses both directions (Artale et al., 2023). |
| Relation | Result (continued) |
| b | Causal Hard Attn. Star-free By the same theorems (Yang, Chiang, and Angluin, 2024, Theorems 2 and 4), showing equivalence between masked hard-attention transformers, B-RASP, and LTL, every language recognized by masked hard-attention transformers is star-free; this direction preserves depth. This result describes masked hard-attention transformers without positional encoding, with positional information implicitly encoded in the masking. With rational sinusoidal encoding, the class of languages recognized by masked hard-attention transformers (with both past and future attention) grows to the regular languages in (Yang, Chiang, and Angluin, 2024, Corollary 8). |
| c | Star-free Bidir. Hard Attn. Barceló et al. (2024, Theorem 1) show that bidirectional unique-hard-attention transformers with positional encodings recognize every language definable in , which contains and hence every star-free language. |
| d | Bidir. Hard Attn. Star-free Bidirectional hard-attention transformers with positional encodings recognize every regular language in (Barceló et al., 2024, Corollary 1). This includes , for example, which is regular and in but not star-free (Schützenberger, 1965). |
| e | Bidir. Hard Attn. No bidirectional unique-hard-attention transformer recognizes approximate majority, a language in that contains every bitstring with at least two-thirds ones and no bitstring with at most one-third ones (Barceló et al., 2024, Proposition 1). |
| f | Bidir. Hard Attn. Hao, Angluin, and Frank (2022, Theorem 1) show that every language recognized by a bidirectional unique-hard-attention transformer is in , even for their generalized model with unrestricted position-wise functions and positional encodings. The circuit family is non-uniform, unlike the uniform used elsewhere in this table. |
| g | Bidir. Avg.-Hard Attn. Chiang, Cholak, and Pillay (2023, Theorem 5) build a bidirectional transformer, using only uniform attention (a special case of average-hard attention) and a CLS token, that recognizes every language definable in , including MAJORITY (Chiang, Cholak, and Pillay, 2023, Proposition 11). MAJORITY is not in (Furst, Saxe, and Sipser, 1984; Ajtai, 1983). Barceló et al. (2024, Corollary 2) also show that MAJORITY and PARITY can be recognized by average-hard attention with future positional masking. |
| Relation | Result (continued) |
| h | It is conjectured that contains languages that are not expressible by average-hard (or softmax) attention transformers. The upper bounds for average-hard and softmax attention (edges i and k) are one-directional. Merrill and Sabharwal (2023a) state that they believe these bounds are not tight. Svete et al. (2026, Conjecture 6.1) state the conjecture formally for constant-width, -precision softmax and average-hard-attention transformers, conditional on a uniform size hierarchy. |
| i | Bidir. Avg.-Hard Attn. Strobl (2023, Theorem 2) shows that every language recognized by a bidirectional average-hard-attention transformer with -bit precision is in log-space-uniform . |
| j | Conjectured, as for edge h. Narrower results exist for restricted models. Fixed-precision bidirectional transformers with rational-frequency sinusoidal positional encodings recognize only languages definable in , which is strictly smaller than uniform (Chiang, Cholak, and Pillay, 2023, Theorem 2 and Proposition 4). With constant precision and every arithmetic operation rounded, transformers are contained in (London and Kanade, 2025, Theorem 4.1). These results do not cover soft-attention transformers with -bit precision. |
| k | Bidir. Softmax Attn. Merrill and Sabharwal (2023a, Theorem 2) show that every transformer with -bit precision and positional encodings computable in time can be expressed in FOM[BIT], which equals DLOGTIME-uniform . |
| MPC | |
| m | MPC Bidir. Softmax Attn. with caveats Sanford, Hsu, and Telgarsky (2024, Theorem 3.1) show that every -round MPC protocol with local memory is simulated by a transformer of depth , width and heads. However, this assumes unbounded pre-computation in the MLP and the query, key, and value maps, and that this computation may differ from position to position. Moreover, the width grows with the input length. |
| n | Bidir. Softmax Attn. MPC Sanford, Hsu, and Telgarsky (2024, Theorem 3.4) show that every transformer with width times heads , which includes every fixed-width transformer, is simulated by an -round MPC protocol with machines. The protocol's local computation evaluates the transformer's position-wise maps. Note that this uses a different memory regime compared to edge m, with machines whereas edge m uses fewer machines than tokens. |
| C-RASP | |
| Relation | Result (continued) |
| O | C-RASP Causal Softmax Attn. Yang and Chiang (2024, Theorems 4.3 and 5.7) compile every C-RASP program into a future-masked softmax transformer without positional encodings, with uniform attention and one layer per level of count nesting. This construction uses infinite precision and layer normalization; Yang, Cadilhac, and Chiang (2025, Proposition B.4) give a fixed-precision version with the same depth, for a model that rounds every value except the sums inside attention. |
| P | Causal Softmax Attn. C-RASP with caveats Yang and Chiang (2024, Theorems 4.3 and 7.1) show that every fixed-precision, future-masked softmax transformer without positional encodings can be simulated by a C-RASP program. The construction enumerates the finitely many possible activation values, which makes the program exponentially larger than the transformer. Edge q shows that this exponential increase is, in general, necessary. |
| Q | Causal Softmax Attn. C-RASP with caveats Holds at comparable size (Theorem 1). On query-dependent retrieval over key-value items, one causal softmax attention head solves the task with residual width , while every C-RASP program for the task needs prefix-count nodes. |
| Relations between theories (unlettered edges) | |
| Star-free | Star-free languages are exactly the languages definable in (McNaughton and Papert, 1971), and , which equals DLOGTIME-uniform (Immerman, 1999). The containment is strict: is in but is not star-free (Schützenberger, 1965). |
| Every circuit is a circuit; MAJORITY is in but not in (Furst, Saxe, and Sipser, 1984). | |
| Every C-RASP program translates into a uniform circuit family with a linear number of gates (Huang et al., 2025a, Proposition 31 and Remark 32). The containment is strict: PARITY is in but not expressible in C-RASP (Huang et al., 2025a, Lemma 11). | |
| Roughgarden, Vassilvitskii, and Wang (2018, proof of Theorem 6.1) simulate every logspace-uniform circuit family, and hence , in rounds with polynomially many machines that each read words per round. Frei and Wada (2019, Theorem 9) give a constant-round simulation in a MapReduce model with local memory of at least . | |
| Follows from . | |
| Not shown | |
| BAPO, Sensitivity | Omitted because they have no formal containment relation to transformer classes. |
E Notes on the Theory–Task Predictions
Table 9 annotates each task prediction with a link to a row in Table 10, which explains the source of each prediction.
Table 9: Theory–task prediction matrix. Annotated version of the theory-task predictions in Table 2. For each theory, we apply its hardness criterion, adapting tasks when necessary to fit within the theory's assumptions about inputs. Superscripts link to explanations and references in Table 10. X: Hard, √: Easy (in some cases, not Hard), ■: non-trivial result proved here, *: assuming a complexity theory conjecture.
| Task | Star-free | C-RASP | MPC | BAPO | Sensitivity | ||
|---|---|---|---|---|---|---|---|
| Boolean | |||||||
| ALL/ANY | ✓1 | ✓2 | ✓2 | ✓3 | ✓4 | ✓5 | ✓6 |
| MAJORITY | ✕7 | ✕7 | ✓8 | ✓9 | ✓10 | ✕11 | ✓12 |
| PARITY | ✕7 | ✕7 | ✓8 | ✕13 | ✓4 | ✓5 | ✕14 |
| Index | |||||||
| INDEX | ✕15 | ✓16 | ✓16 | ✕17 | ✓18 | ✓19 | ✓20 |
| INDEX-ALL/ANY | ✕15 | ✓16 | ✓16 | ✕17 | ✓18 | ✓21 | ✓20 |
| INDEX-PARITY | ✕15 | ✓16 | ✓16 | ✕17 | ✓18 | ✓21 | ✓20 |
| Sparse | |||||||
| SPARSE-ALL/ANY | ✓22 | ✓22 | ✓22 | ✓23 | ✓24 | ✓25 | ✓26 |
| SPARSE-PARITY | ✓22 | ✓22 | ✓22 | ✓23 | ✓24 | ✓25 | ✓26 |
| BinaryAdd | ✕27 | ✓28 | ✓28 | ✕27 | ✓28 | ✕29 | ✓30 |
| Dyck | |||||||
| DYCK-1 (bounded) | ✓31 | ✓31 | ✓31 | ✓32 | ✓4 | ✓5 | — |
| DYCK-1 (unbounded) | ✕33 | ✕33 | ✓33 | ✓32 | ✓34 | ✕35 | — |
| DYCK-2 (bounded) | ✓31 | ✓31 | ✓31 | ✓36 | ✓4 | ✓5 | — |
| DYCK-2 (unbounded) | ✕33 | ✕33 | ✓33 | ✕37 | ✓34 | ✕35 | — |
| k-Hop Induction | ✓38 | ✓38 | ✓38 | ✕39 | ✓40 | ✓5,38 | — |
| Graphs | |||||||
| EDGE EXISTENCE | ✕41 | ✓42 | ✓42 | ✕43 | ✓44 | ✓45 | — |
| DIRECTED REACHABILITY | ✕46 | ✕46 | ✕*47 | ✕*47 | ✕*48 | ✕49 | — |
| UNDIRECTED REACHABILITY | ✕46 | ✕46 | ✕*50 | ✕*50 | ✕*48 | ✕49 | — |
Table 10: Explanations for the theory–task predictions. IDs correspond to the numbered links in Table 9.
| ID | Explanation |
|---|---|
| 1 | All/Any are star-free. They are defined in FO[<] by and , respectively, where holds when position contains a one. |
| 2 | All/Any have depth-one circuits. ALL and ANY are respectively a single unbounded-fan-in AND and OR gate, so they lie in both and . |
| 3 | All/Any have small C-RASP programs. ALL tests whether the prefix count of zeros is zero; ANY tests whether the prefix count of ones is positive. |
| ID | Explanation (continued) |
|---|---|
| 4 | Regular languages have constant-round, sublinear-memory MPC algorithms. Gilbert and Hajiaghayi (2023, Theorem 3.2) give an -round MPC algorithm with local memory for any fixed regular language. This covers ANY/ALL, PARITY, and constant-depth DYCK. |
| 5 | Regular languages are BAPO-easy. Schnabel et al. (2025, Theorem 2) show that every regular language has a constant-bandwidth BAPO; this includes ALL/ANY, PARITY, and fixed-depth DYCK. For fixed alphabet and hop count k, each output language of k-HOP INDUCTION is star-free and hence regular by Proposition 18. Concatenating the finite-state summaries for the possible outputs gives a constant-bandwidth BAPO for the full output. |
| 6 | All/Any have low average sensitivity. Flipping a bit changes ALL (ANY) exactly when all other bits are one (zero). Under uniform Boolean inputs, both therefore have average sensitivity , giving an Easy prediction. This prediction uses the uniform distribution rather than the class-balanced distribution we use in experiments. |
| 7 | Majority and Parity are not in (Strobl et al., 2024). This also means they are not Star-free due to containment in . |
| 8 | Majority and Parity are in (Strobl et al., 2024). |
| 9 | Majority is in C-RASP (Huang et al., 2025a). |
| 10 | Majority has a constant-round, sublinear-memory MPC algorithm. The bounded-memory prefix-sum algorithm of Goodrich, Sitchinava, and Zhang (2011) computes the total number of ones in rounds. Taking gives rounds with local memory; a final threshold comparison computes MAJORITY. |
| 11 | Majority is BAPO-hard (Schnabel et al., 2025). |
| 12 | Majority has low average sensitivity (Hahn and Rofin, 2024). MAJORITY has average sensitivity under uniform Boolean inputs, so it is not predicted Hard by sensitivity results (Hahn and Rofin, 2024, Theorem 4, Theorem 6). |
| 13 | Parity is not expressible in C-RASP (Huang et al., 2025a, Lemma 11). Huang et al. (2025a) show the stronger result that PARITY is not expressible in C-RASP[periodic, local], which adds additional positional operators to base C-RASP. |
| 14 | Parity is maximally sensitive. Flipping any input bit flips the answer to PARITY, giving it average sensitivity n (Hahn and Rofin, 2024). |
| 15 | Growing-range Index is not star-free. Proposition 7 shows that INDEX and fixed-arity INDEX-ALL, INDEX-ANY, and INDEX-PARITY are not finite-state computable, even when correctness is required only on valid inputs. In particular, their valid-input behavior has no star-free realization. In contrast, fixed-range INDEX and INDEX-* are star-free by Propositions 1 and 2. |
| 16 | Binary-index Index is in . Proposition 6 shows growing-range INDEX and INDEX-* are in DLOGTIME-uniform and , encoding indices in binary. |
| 17* | Growing-range Index requires growing C-RASP size. Proposition 10 rules out a fixed-size base C-RASP program for INDEX and fixed-arity INDEX-ALL, INDEX-ANY, and INDEX-PARITY. The result applies to binary and atomic query encodings. The displayed Hard predictions concern a growing query range, as in the ID and LLM experiments. In contrast, length-generalization experiments fix the query range; fixed-range INDEX and INDEX-* admit fixed-size C-RASP programs by Propositions 3 and 4. |
| 18 | Growing-range Index is MPC-easy. Proposition 9 gives a three-round protocol for INDEX and INDEX-* with fixed arity and Boolean function, using words of local memory and polynomial total memory. |
| 19 | Atomic-index Index is BAPO-easy. INDEX has a (0,1)-BAPO (Schnabel et al., 2025): the attention oracle selects the queried data token. This bound uses an atomic address token, not a binary-encoded index. |
ID Explanation (continued)
20 Index and fixed-arity Index-* have low sensitivity. Fix a layout of n data bits followed by k binary addresses of width . Extend the task to all bitstrings of this layout by returning zero whenever any address is outside [n]. At any input, at most k queried data bits and address bits can be sensitive. Thus pointwise sensitivity, and hence average sensitivity, is at most , sublinear in the total input length for fixed k and below the linear hardness threshold of Hahn and Rofin (2024, Theorem 6).
21* Atomic-index Index-* is BAPO-easy. Proposition 8 gives a -BAPO for INDEX-* with fixed arity k and Boolean function. This extends the existing INDEX result to Boolean functions of multiple retrieved bits. The bound uses atomic address tokens; it does not establish the same bound for binary-encoded indices.
22 Fixed-support Boolean tasks are star-free. Proposition 11 gives an FO[<] definition of SPARSE-* for fixed selected positions and Boolean function, hence membership in Star-free and DLOGTIME-uniform AC and TC .
23 Fixed-support Boolean tasks are in C-RASP. Proposition 12 gives a base C-RASP program of counting depth at most two for SPARSE-* with fixed selected positions and Boolean function.
24 Fixed-support Boolean tasks are MPC-easy. These are special cases of Proposition 9 in which the selected indices are known in advance. The coordinator therefore skips query collection, requests the selected bits, and applies the fixed Boolean function to the replies. The algorithm uses constant rounds and local memory.
25 Fixed-support Boolean tasks are BAPO-easy. Proposition 13 gives a -BAPO for SPARSE-* with fixed arity k, selected positions, and Boolean function.
26 Sparse tasks have constant sensitivity. Only the k selected bits can affect the output, so sensitivity is at most k, which is fixed independently of input length.
27 Checking binary addition is Star-free- and C-RASP-hard. Consider the decision version of addition: given , where the three numbers are written in binary, decide whether . A simple pumping lemma argument shows this is nonregular and hence not star-free. Across the equal-length split , equality requires bits of deterministic one-way communication, whereas a fixed C-RASP[periodic, local] program gives an -bit protocol (Huang et al., 2025a, Theorems 9 and 12).
28 Binary addition is in (Immerman, 1999, Proposition 1.9). This also makes it Easy for by containment and for MPC since constant-round MPC with local memory contains (Roughgarden, Vassilvitskii, and Wang, 2018; Frei and Wada, 2019).
29* Blocked BinaryAdd verification is BAPO-hard. For input with -bit operands and an -bit proposed sum, all MSB-first, Proposition 14 proves that every -BAPO requires .
30 BinaryAdd verification has low uniform average sensitivity. Proposition 15 gives average sensitivity for -bit operands and an -bit proposed sum. Each valid sum is sensitive to all bit flips, but valid sums constitute only a fraction of uniform inputs.
31 Bounded Dyck is star-free. For fixed bracket-type count k and depth bound D, DYCK(k, D) is known to be star-free (e.g., Strobl et al., 2024), with classical proofs for k = 1 (Brzozowski and Knast, 1978; Thomas, 1984), hence also in DLOGTIME-uniform AC and TC .
32 Bounded and unbounded Dyck-1 are in C-RASP. Yang and Chiang (2024) provide a C-RASP program for DYCK-1 that compares prefix counts of opening and closing brackets, requiring nonnegative height at every prefix and zero final height. This program can be easily extended to require every prefix height to be at most a fixed bound D.
33 Unbounded Dyck-1 and Dyck-2 are outside but in . Both languages are nonregular, hence not star-free, and neither is in (Hao, Angluin, and Frank, 2022; Yang, Chiang, and Angluin, 2024). DYCK with any fixed number of bracket types is in (Barrington and Corbett, 1989).
| ID | Explanation (continued) |
|---|---|
| 34 | Unbounded Dyck has constant-round MPC algorithms. Gilbert and Hajiaghayi (2023, Theorem 3.3) decide DYCK languages with a fixed number of bracket types in MPC rounds with local memory. |
| 35* | Unbounded Dyck-1 and Dyck-2 are BAPO-hard. Proposition 17 proves that recognizing unbounded DYCK with any fixed number of bracket types on inputs of length at most N requires . |
| 36* | Bounded multi-type Dyck is in C-RASP. Proposition 16 gives a base C-RASP program for DYCK(k, D) with channels and counting depth at most three. For fixed k, D, this is a fixed-size program; in particular, it handles bounded DYCK-2. |
| 37 | Unbounded Dyck-2 is not in C-RASP (Huang et al., 2025a, Remark 21). Encode two bitstrings as opening-bracket types and closing-bracket types in reverse order. Their concatenation is in DYCK-2 exactly when the strings are equal. This requires linear deterministic one-way communication, whereas a fixed C-RASP[periodic, local] program provides an -bit protocol by Huang et al. (2025a, Theorems 9 and 12). |
| 38* | Fixed-hop induction is star-free. For fixed alphabet and hop count k, Proposition 18 defines each final-position output language, including the undefined output , in FO[<]. Thus each is star-free and in DLOGTIME-uniform and . Their regularity also yields the BAPO upper bound via 5. |
| 39* | Fixed-hop induction is C-RASP-hard. For every fixed , Proposition 19 shows that a base C-RASP program for k-HOP INDUCTION would imply a C-RASP program for , contradicting Huang et al. (2025a, Proposition 31 and Lemma 35). |
| 40 | Fixed-hop induction is MPC-easy. Sanford, Hsu, and Telgarsky (2024, Theorem 4.2) construct a constant-width transformer for k-HOP INDUCTION with depth , which is constant for fixed k. Their transformer-to-MPC simulation (Sanford, Hsu, and Telgarsky, 2024, Theorem 3.4) therefore gives a constant-round protocol with local memory for fixed and polynomial total memory. |
| 41 | Edge Existence is not star-free. Encode node IDs in fixed-width binary over a finite alphabet, with the edge list before the query and an unbounded node range. Any two different edge sets can be distinguished by appending a query for an edge present in only one of them. Thus arbitrarily many graph prefixes require distinct automaton states, so the task is nonregular. |
| 42 | Binary-encoded Edge Existence is in . With fixed-width binary node IDs and fixed edge-block boundaries, compare the queried endpoints with the endpoints of every listed edge and OR the matches. These comparisons give DLOGTIME-uniform, constant-depth, polynomial-size Boolean circuits, hence membership in and . |
| 43* | Edge Existence requires growing base C-RASP size. Use the encoding and input order in 41. As in the proof of Proposition 10, a program with s primitive counts has at most distinct count vectors after a graph prefix of length L. Choosing half of M possible edges gives pairwise distinguishable graph prefixes of the same length . Their count vectors must be distinct, which is impossible for fixed s. |
| 44 | Edge Existence is MPC-easy. Distribute the queried pair to the machines holding the edge list. Each machine checks whether any of its edges matches the query, and an OR reduction combines the local answers. For input size n, broadcast and reduction trees use rounds and local memory. |
| 45 | Edge Existence is BAPO-easy with atomic edge tokens. Encode each directed edge as one token and append the queried edge as the final atomic token. A -BAPO suffices: the attention function selects precisely the prefix edges matching the query, and the suffix oracle also checks the listed edges in the suffix. We conjecture that other encodings (one token per node or binary node encodings) may be BAPO-hard, but not because of the core lookup mechanism of the task. |
| 46 | Reachability is outside . Both directed and undirected reachability are outside (Wigderson, 1992) and therefore neither is star-free. |
| ID | Explanation (continued) |
| 47 | Directed reachability is conditionally hard for and C-RASP. DIRECTED REACHABILITY is NL-complete under first-order reductions (Immerman, 1999, Theorem 3.16). Since DLOGTIME-uniform , it is outside this circuit class assuming . C-RASP is contained in DLOGTIME-uniform (Huang et al., 2025a, Proposition 31 and Remark 32), so the same assumption gives its Hard prediction. |
| 48 | Reachability is conditionally MPC-hard. Assuming the one-vs-two-cycles conjecture for MPC (Ghaffari, Kuhn, and Uitto, 2019), UNDIRECTED REACHABILITY requires MPC rounds with sublinear local memory (Sanford, Hsu, and Telgarsky, 2024). DIRECTED REACHABILITY is similarly Hard under the same conjecture, as well as under a weaker conjecture that (Nanongkai and Scquizzato, 2022). |
| 49 | Reachability is BAPO-hard (Schnabel et al., 2025, Theorem 3). The theorem is stated for DIRECTED REACHABILITY, but the proof directly transfers to UNDIRECTED REACHABILITY as it only uses graphs that are unions of directed paths (which have the same connectivity for queried nodes if they are undirected). |
| 50 | Undirected Reachability is conditionally hard for and C-RASP. UNDIRECTED REACHABILITY is outside DLOGTIME-uniform given the conjecture that L-uniform (Strobl et al., 2024, Section 5.4.2). Since C-RASP is contained in DLOGTIME-uniform , the same assumption gives its Hard prediction (Huang et al., 2025a, Proposition 31 and Remark 32). |
F Supporting Theory–Task Results
This section gives the new results behind the theory–task predictions in Table 2, including constructions showing that a task is Easy under a theory, and lower bounds showing that it is Hard. Table 9 lists the result behind each prediction. The results below are grouped by task family.
F.1 Definitions and conventions
F.1.1 Circuits and logic
A language is in if it is decided by a family of Boolean circuits with polynomial size and constant depth (independent of ), using unbounded-fan-in AND and OR gates and fan-in-one NOT gates. A language is in if the circuits may additionally use unbounded-fan-in majority gates. For a fixed finite alphabet , we encode each symbol with bits. This changes circuit size and depth by at most a constant factor, so it does not affect membership in or . A uniformity condition imposes that the same algorithm can generate the circuit for each input length . We consider DLOGTIME-uniform , where a deterministic random-access Turing machine can determine a gate's type and whether two gates are connected in time .
Fix a finite alphabet . A word is represented by a structure with domain
Variables range over positions in . The atomic predicates are
where means that position contains the symbol , and means that bit of the binary representation of is 1. Because the structure represents a word, exactly one predicate holds at each position. Formulas are built from these predicates using Boolean connectives and the quantifiers and . A sentence is a formula that has no free variables and defines the words on which it is true.
From a descriptive complexity perspective, DLOGTIME-uniform can be characterized as the class of languages definable by first-order logic with the BIT predicate (Immerman, 1999):
Thus, a language is in DLOGTIME-uniform if and only if it can be defined by a first-order sentence using the predicates , , , and . This gives a way to reason about DLOGTIME-uniform without explicitly constructing circuits.
The fragment FO[<], which omits BIT, defines exactly the star-free languages (Immerman, 1999). We will use the inclusions
Thus, an FO[<] representation immediately shows a problem is in all three classes.
F.1.2 C-RASP
Following Yang and Chiang (2024) and Yang, Cadilhac, and Chiang (2025), a C-RASP program is a straight-line sequence of named Boolean streams and integer-valued count streams . The primitives in a C-RASP program are:
Boolean:
Count:
The definition above omits the conditional and max/min operators included in the C-RASP definition by Yang and Chiang (2024), since they can be constructed from these primitives. Max/min can be replaced by conditionals, e.g., is equivalent to ? . Conditionals can then be replaced by Boolean operators, by rewriting each comparison that contains a conditional as a Boolean combination of comparisons, without increasing depth (Yang, Cadilhac, and Chiang, 2025, Lemma A.3). Other operations can also be derived from these base primitives, e.g., disjunction from negation and conjunction, and equality from and . A program accepts by reading its final Boolean stream at the last input position. The “counting depth” is the largest number of counting operations along a dependency chain in the program.
In the notation of Huang et al. (2025a), this base version of C-RASP is also called C-RASP[∅], to distinguish it from enhanced versions such as C-RASP[periodic, local].
F.1.3 BAPO
Following Schnabel et al. (2025), an -BAPO consists of three functions
The function is called the prefix oracle, the attention function, and the suffix oracle. Intuitively, summarizes the prefix in bits, selects which prefix tokens the suffix attends to, and computes the answer from the summary, at most attended prefix tokens, and the suffix. For an input and split index , let
The BAPO computes when, for every split and every attended set with ,
See Schnabel et al. (2025) for a full introduction to the model.
F.2 Fixed-range Index
We use the fixed-range tasks INDEX_L and INDEX-*_L,F,k from Definition 2. Fix an index bound and distinct index symbols , disjoint from the data alphabet .
For INDEX , valid inputs have the form
For INDEX- , valid inputs have the form
The bit and index alphabets are disjoint, so no separator is needed. Indices may repeat.
Proposition 1 (Fixed-range INDEX_L in Star-free). For every fixed index bound L, INDEX_L is representable in FO[<] on valid inputs, and is therefore star-free and in DLOGTIME-uniform AC^0 and TC^0.
Proof. We prove this by constructing an FO[<] sentence that, on every valid input, is true exactly when INDEX_L outputs 1.
To slightly simplify the presentation of the proof, let's relabel the data bits and index symbols to use 0-based indexing:
The output is . This is more aligned with the convention for positions in , which are 0-based. Now occurs at position , and the final index token occurs at position .
Position predicates. The main step is to define, for each fixed , a first-order formula that names position . We achieve this by first defining some basic predicates that allow us to manipulate positions in :
In words, the successor predicate holds when and no other is between them. For each fixed nonnegative integer , define as the predicate meaning , by
Each Eq is shorthand for a separate finite first-order formula, obtained by expanding the recursive definition m times. For example, Eq says that q is two successor steps after the first position. Since L is fixed, the construction needs only the fixed finite list Eq , Eq , independent of the input length n.
Sentence. On valid inputs, the positive instances of INDEX are defined by
The idea is the following: the sentence is an OR over the allowed indices . For each , checks that the final token (which is the index) is , the predicate checks that is at position , and checks that the data bit there is 1. The formula checks whether there is a position matching that contains the bit 1.
More formally: fix a valid input . The condition requires , the final position. Since that position contains , only the disjunct can hold. Within this disjunct, requires , the position containing . The remaining condition holds exactly when . Therefore, on valid inputs, is true exactly when outputs 1.
Since is fixed, the displayed disjunction has fixed size and is one fixed sentence. The correspondence and the inclusions in Equation (3) prove the claim.
Proposition 2 (Fixed-range INDEX- in Star-free). For every fixed L, k, and F, INDEX- is representable in FO[<] on valid inputs, and is therefore star-free and in DLOGTIME-uniform and .
Proof. Let be a fixed Boolean formula computing . As in Proposition 1, relabel the data bits and index symbols to use 0-based indexing. A valid input then has the form
and the output is . The total input length is . The data bit occurs at position , and the index token occurs at position . We construct one formula for each index token. The truth value of will be the selected bit . We then apply to these formulas.
Position predicates. We first identify the j-th index token by its fixed distance from the end of the input. Using max and SUCC from the proof of Proposition 1, define
Each Slot is shorthand for a separate finite first-order formula, obtained by expanding the definition from Slot . The predicate Slot identifies the final position , and each preceding predicate moves one position to the left. Therefore Slot holds exactly when , the position containing .
For each , define
This is applying the INDEX construction from the proof of Proposition 1 for the j-th index token, to extract the bit selected by that token.
Sentence. On valid inputs, the positive instances of INDEX- are defined by
where each input variable in is replaced by the first-order formula .
To see why this sentence correctly defines the positive instances of INDEX- , fix a valid input
For each , requires , the position containing . Because the input is valid, , so the disjunct appears in . No other disjunct can hold because the index-token position contains exactly one symbol. Validity also gives , so position exists and contains . Within the surviving disjunct, requires , and is true exactly when . Thus has truth value . It follows that has truth value , including when indices repeat. Therefore, on valid inputs, is true exactly when outputs 1.
Since , , and are fixed, all displayed disjunctions and formulas have fixed size. Thus is one fixed sentence. The correspondence and the inclusions from Equation (3) prove the claim.
Remark (malformed inputs). These proofs assume the valid input formats defined at the start of this subsection. If malformed inputs are admitted, first define an sentence Valid that checks the corresponding format, then conjoin Valid with the task sentence above. Because and are fixed, these format checks are expressible in .
Proposition 3 (Fixed-range INDEX in C-RASP). For every fixed index bound L, INDEX has a C-RASP program of counting depth at most two.
Proof. First identify payload bits and count how many have appeared:
At each payload position , .
For each , use to mark payload position :
Thus is true exactly at position , when that position exists.
The second count retrieves the bit at , and converts the count to a Boolean:
At the final index token, for every payload position .
Finally, use the index token to select the requested bit:
If the input ends in , exactly is true, so . The stream has depth one, each has depth two, and all remaining operations are Boolean.
Proposition 4 (Fixed-range INDEX- in C-RASP). For every fixed L, k, and F, INDEX- has a C-RASP program of counting depth at most two.
Proof. Let be a fixed Boolean formula computing . Define , and as in the proof of Proposition 3. Additionally, identify and count index tokens:
For every query slot and index , use to test whether slot contains :
At the final position, exactly is true for each slot .
Use these selectors to retrieve each requested bit, then apply :
Thus, at the final position, and . The streams and have depth one, each and has depth two, and all remaining operations are Boolean.
Proposition 5 (Fixed-range INDEX- is BAPO-easy). For every fixed L, k, and F, INDEX- has a -BAPO.
Proof. Consider a valid input of total length :
Let be the split index and let be the number of index tokens in . If , then and . If , then and . Since , we have . Define the prefix oracle to send the bits that are selected by the index tokens in the prefix, padded with zeros to length :
For each prefix token , define the attention function g to select it if its index occurs in the suffix:
Thus contains the (distinct) prefix positions requested by , so . Therefore we always have .
The suffix oracle counts the index tokens in to recover . It reads the first requested values from . For each remaining index , it reads from when and from suffix position when . It then outputs . If an index is repeated, reuses the same bit. For any valid input and any split index, this BAPO can thus compute INDEX-.
F.3 Growing-range Index
The results in Appendix F.2 use a fixed index range. We now consider INDEX and INDEX-* from Definition 2 without that restriction. We use binary-encoded indices to keep the alphabet finite as the range grows with the data length. As before, the data are binary and indices are 1-based. Instead of one symbol per index, use two query-bit symbols , , distinct from the data symbols 0, 1. For , let , and let be the -bit, least-significant-bit-first binary representation of , padded with zeros and written using query bits. Valid inputs for INDEX have the form
For fixed and , valid inputs for INDEX- have the form
Indices may repeat. The disjoint data and query alphabets identify the start of the query suffix, and its equal-width blocks identify the individual indices, so no separators are needed. The alphabet is fixed and independent of . Unlike the native atomic-address encoding, this encoding exposes the bits of each index; the circuit result below is for this binary encoding.
Proposition 6 (Growing-range INDEX and INDEX-* in uniform ). For every fixed and , growing-range INDEX-* is representable in on valid inputs. In particular, this holds for INDEX, INDEX-ALL, INDEX-ANY, and INDEX-PARITY. Consequently, these tasks have DLOGTIME-uniform and circuits on valid inputs.
Proof. The universe is the set of 0-based input positions, and holds when bit of is one. Use max and SUCC from Proposition 1, and let express the equality , which is definable in (Immerman, 1999).
Query blocks. Let Query(p) := . Define predicates that identify the first query bit and partition the query suffix into k consecutive, equal-length blocks with start positions and end positions :
On a valid input, holds when and partition the query suffix into consecutive blocks of equal length , where positions through , inclusive, contain the encoding of the th query index . Since the suffix has length , necessarily ; thus the endpoints are uniquely determined. The conjunctions have fixed size because is fixed.
Address matching. The following formula says that the block from s through e encodes the integer r:
This matches bit of with the query bit at position , for every . When , the right side is false, requiring all higher bits of to be zero. We can then use this to retrieve the data bit at a queried position. The data bit occurs at position , so the retrieved bit is defined by
The integer is in the universe even when , since at least one query digit follows the data. Thus, for the uniquely determined block endpoints, holds exactly when .
Sentence. Let be a fixed Boolean formula computing . The desired sentence is
For INDEX, take and . For INDEX-ALL, INDEX-ANY, and INDEX-PARITY, use conjunction, disjunction, and parity, respectively. The sentence has fixed size, so the standard FO[<,BIT] characterization gives DLOGTIME-uniform , and hence . As in the fixed-range results, only agreement on valid inputs is required; the sentence defines a total language with unrestricted behavior on malformed inputs.
Proposition 7 (Growing-range INDEX is not regular). Growing-range INDEX is not computable by any finite-state machine, even when correctness is required only on valid inputs. For every fixed , growing-range INDEX-ALL, INDEX-ANY, and INDEX-PARITY are likewise not finite-state computable. In particular, their valid-input behavior has no star-free realization.
Proof. Fix . Any two distinct data strings differ at some position . Appending the same valid suffix makes INDEX output on one string and on the other. Therefore a machine correct on all valid inputs must reach distinct states after all length- data prefixes. No fixed finite-state machine can do so for every .
For a fixed , reserve data positions and set them to the neutral element of the operation: one for AND and zero for OR or XOR. Let all remaining positions vary. Given two different strings in this restricted family, choose a differing, nonreserved position , query together with the reserved positions, and use each address once. The two outputs differ. Thus there are at least distinguishable length- data prefixes, again ruling out a finite-state machine. The argument uses only that every address has some valid suffix representation; it does not depend on the particular binary syntax.
Proposition 8 (BAPO bounds for growing-range INDEX with atomic addresses). In the native encoding with one atomic token for every available address , growing-range INDEX has a -BAPO. For every fixed and , growing-range INDEX- has a -BAPO.
Proof. Use the constructions of Proposition 5. The bandwidth depends on the number of query tokens, not on the size of the atomic address vocabulary. The proof of Proposition 5 therefore applies for every growing address range and give bandwidths and respectively. Note that this result uses atomic address tokens. For the binary-block encoding above, a BAPO split can fall inside an address and separate its bits.
Proposition 9 (Three-round MPC protocol for growing-range INDEX). Fix . Under the indexed block input convention of Sanford, Hsu, and Telgarsky (2024), growing-range INDEX and INDEX- with fixed k, F have a three-round MPC protocol with words of local memory per machine and polynomial total memory.
Proof. Let be the total input length and the block size. As in Sanford, Hsu, and Telgarsky (2024), each input symbol carries its position, and the symbol at 0-based position is initially on machine . Each word has bits.
In the first round, every machine sends its query bits, identified by the symbols , together with their positions, to machine 1, retaining the data bits locally. Machine 1 orders the query bits by position and decodes the equal-width indices. In the second round, it sends a request tagged by for each index to machine . In the third round, each owner returns the requested bits with their query tags. Machine 1 then locally outputs the retrieved bit, or applies to the returned bits in query order.
The first round gathers words for fixed . The next two rounds each communicate constant-size messages. Together with the words of retained data per machine, these satisfy local memory and per-round communication bounds. The input blocks use total words; any additional machines allowed by the model can remain idle.
Remark. If the indexed input records are instead initially distributed arbitrarily, subject to the same local memory bound, one preliminary round can route each record at position p to machine . Each sender holds words and each destination receives at most B records, so this establishes the required layout within the same asymptotic bounds. Thus unknown initial owners cost at most one additional round, provided the records retain their input positions.
Proposition 10 (Growing-range INDEX requires growing C-RASP size). Fix , and let be the number of primitive prefix-count nodes in a base C-RASP program. If the program answers every growing-range INDEX query on every binary data prefix , then
For fixed and , any such program computing INDEX-ALL, INDEX-ANY, or INDEX-PARITY with distinct query indices satisfies
Consequently, none of these growing-range tasks has a fixed-size base C-RASP program valid for all n.
Proof. Fix , and write the primitive prefix counts as . After reading a data prefix , record
For this fixed , the vector determines the computation on any given query suffix. To see this, process the suffix symbols in order and the program nodes in topological order at each position. All non-counting operations are pointwise, so their values are determined by the current symbol and earlier nodes at that position. If counts predicate , then
The first term is its saved count, and depends only on earlier program nodes at position . Thus all values on the suffix are determined inductively, even when counts depend on other counts. There is no need to save Boolean streams or arithmetic combinations of counts separately.
If differ, choose with and append the same query suffix to both prefixes. Since the prefixes have the same length, this suffix is valid for both. Correctness requires different outputs, so . There are possible data prefixes and at most count vectors. Hence , proving the first bound.
For INDEX-ALL, INDEX-ANY, or INDEX-PARITY, reserve fixed data positions and set their bits to the operation's neutral value: 1 for AND and 0 for OR or XOR. Let the remaining data bits vary freely. Given two different prefixes in this family, append the same query suffix selecting one differing position and all reserved positions. These query indices are distinct, and the output is the differing data bit. Thus the prefixes have distinct count vectors, giving and the second bound.
The argument also applies to atomic query indices: it uses only that the same query suffix can be appended to any two data prefixes of the same length.
F.4 Sparse Boolean functions
We use SPARSE- from Definition 3, with fixed and . Write . Inputs are nonempty binary strings , with one token per bit.
Proposition 11 (SPARSE-* in Star-free). For every fixed k, I, and F, the task SPARSE-* is representable in FO[<], and is therefore star-free and computable by DLOGTIME-uniform and circuits.
Proof. The selected indices are fixed, so we can identify each selected bit with a fixed position predicate and apply a Boolean formula computing . We retain the one-based indices of Definition 3; in the zero-based logical structure, occurs at position .
Position predicates. Using Eq from Proposition 1, which holds exactly when , define
For each , is true exactly when and .
Sentence. Let be a fixed Boolean formula computing . The positive instances of SPARSE- are defined by
Here each variable in is replaced by the sentence .
The first conjunct holds exactly when , ensuring that all selected positions exist. In that case, each has truth value , so has truth value . If , the first conjunct forces the output to 0, as required, regardless of . Thus defines SPARSE- , including when selected indices repeat.
Since , , and are fixed, is one fixed FO[<] sentence. The FO[<]-Star-free correspondence and the inclusions in Equation (3) prove the claim.
Proposition 12 (SPARSE-* in C-RASP). For every fixed k, I, and F, the task SPARSE-* has a base C-RASP program of counting depth at most two.
Proof. Let be a fixed Boolean formula computing . Reuse Bit, , , , and from the proof of Proposition 3, taking . Here every input symbol is a data bit, so . For each selected index , the stream has truth value whenever .
Finally, apply F (and guard against short inputs):
At the final position, if , and otherwise. As in the fixed-range construction, has counting depth one and each has counting depth two. The length check and Boolean formula add no counting depth.
Proposition 13 (SPARSE-* is BAPO-easy). For every fixed k, I, and F, the task SPARSE-* has a -BAPO.
Proof. For a split after position t, define
The candidate set is
It satisfies . Hence the required subset is necessarily , and receives every selected prefix bit.
The suffix oracle returns 0 when (the input is too short to contain all indices). Otherwise, for each , it reads from if and from suffix position if . It then computes . The prefix oracle is not needed.
F.5 Binary addition
Proposition 14 (Blocked BINARYADD verification is BAPO-hard). Encode an instance of BINARYADD with n-bit operands (Definition 4) as . For , every -BAPO solving this task satisfies
In particular, this encoding of BINARYADD is BAPO-hard.
Proof. Fix the split , so that both operands lie in the prefix. Write the BAPO functions as . All prefixes have length , and their only variable positions are the operand bits. For each integer
let be its -bit representation. Call a prefix a completion for if its operands sum to . There are candidate sums in . This range gives exponentially many candidate sums while ensuring that, among operand pairs with any one of these sums, neither value of any operand bit is too rare.
We will associate each candidate sum c with a record consisting of the a-bit prefix summary output by f and at most 4b operand bits, together with their positions. We will ensure any prefix matching the record has operand sum c. Counting the possible records will then give the lower bound.
A small record that fixes the sum . Fix a candidate sum and its suffix . Choose a completion maximizing the number of prefix positions selected by , and call this number . This count includes any selected separators. Call an operand position active if selects at least one of its two possible bit values with suffix . Let be the number of active positions.
We first show that . Choose a completion for uniformly by choosing an integer uniformly from and setting . Both and are uniform on . For either operand, each bit is 0 with probability at least and 1 with probability at least . To see this for any bit other than the most significant one, the interval contains , on which that bit takes each value times. For the most significant bit, at least values lie on each side of because . In both cases, there are at most possible operand values for and , giving the lower bounds.
For each active position , let be 1 if its bit is selected by and 0 otherwise. At least one bit value is selected at that position, and that value occurs with probability at least , so . Let be the number of selected operand positions. Inactive positions are never selected, so . Thus, by linearity of expectation,
Also, for every completion by the definition of . Combining these facts yields , so .
We form by recording and the values and positions of a subset of operand bits, according to the following cases:
-
Case 1: If , choose any selected token-position pairs as and record their operand bits, at most bits.
-
Case 2: If , let be the full selected set and record all active operand bits, at most bits.
The separator tokens need not be recorded because their positions and values are fixed. The first alternative also covers , with empty.
For any prefix matching the record (i.e., with and with matching recorded bits), remains a legal attended set. In Case 1, its pairs remain selected because sees the same suffix, split, token, and position. In Case 2, the full selected set is unchanged: all active positions have their recorded values, inactive positions are never selected by , and separators are fixed. Since the recorded prefix summary also agrees, the suffix oracle receives identical arguments:
Correctness therefore forces the operands in to sum to c.
Counting the records. Since any prefix matching must have operand sum , different candidate sums must have different records. Otherwise, if for , the prefix would match . With the suffix fixed at , the preceding argument would force acceptance of , even though its operands sum to .
There are at most distinct outputs of . Each recorded pair has possible positions and two possible bit values. Sorting the pairs by position and padding to slots with a blank symbol therefore gives at most possible lists (each of the slots contains one of position-bit pairs or a blank). Since records for each must be distinct,
Taking logarithms proves the bound. In particular, constant a, b cannot suffice.
Proposition 15 (Average sensitivity of BINARYADD verification). Let test whether the n-bit operands sum to the -bit proposed result . Under the uniform distribution on the input bits, its average sensitivity is
Proof. The sensitivity at an input is the number of single-bit flips that change the answer. There are exactly accepting inputs, since each operand pair has a unique -bit sum. At every accepting input, flipping any one of the m bits makes the equality false: flipping an operand bit changes the left-hand side by a nonzero power of two, and flipping a result bit changes the right-hand side. Thus each accepting input has sensitivity m.
View the inputs as vertices of the Boolean hypercube, with an edge for each single-bit flip. There are exactly edges joining an accepting input to a rejecting one. Each such edge contributes once to the sensitivity at each endpoint, and all other edges contribute zero. Averaging over all inputs gives
F.6 Dyck languages
We use the bounded-depth language DYCK-(k, D) and bracket alphabet from Definition 5.
Proposition 16 (DYCK-(k, D) in C-RASP). For every fixed and , membership in DYCK-(k, D) on nonempty inputs is computed by a base C-RASP[ ] program with channels and counting depth at most three.
Proof. Let the input have length . First, we identify whether each token is an open bracket or a close bracket, regardless of its type.
Then, we compute the open-minus-close prefix height at each position (inclusive of the current position):
Then we define Boolean streams that identify whether the current prefix is at a given depth , or has underflowed or overflowed:
For every depth and type , mark type-t openings and closings at depth :
An opening at depth crosses from height to height , while a closing at depth crosses from height to height .
We then count the openings and closings, at each depth d and for each type t, over each prefix:
A type mismatch is detected when a prefix contains more type-t closings than openings at the same depth:
A violation occurs at a position i if the prefix up to i has underflowed, overflowed, or has a type mismatch at any depth and type.
We accept the string if no violation occurs at any position, and the final height is zero:
The program accepts from the last position through Accept(n). The streams O and C have counting depth one, the depth-specific opening and closing counts have counting depth two, and V has counting depth three.
Correctness. If the word is in DYCK-(k, D), every prefix height lies in and the final height is zero, so the height checks pass. Every closing also matches an earlier opening of the same type at the same depth, so no closing count exceeds its corresponding opening count. Thus every nonempty word in DYCK-(k, D) is accepted. Conversely, the height checks reject underflow, overflow, and a nonzero final height. If these checks pass, openings and closings at each depth d alternate, so the jth closing at depth d pairs with the jth opening at depth d. If a type mismatch occurs, consider the first mismatched closing, of type t at depth d. Previously completed pairs at that depth contribute equally to the opening and closing counts, while the unmatched opening has a different type. This closing therefore makes NumClosesAtDepth exceed NumOpensAtDepth , triggering TypeBad . Checking every prefix ensures that a later symbol cannot erase the violation.
Proposition 17 (Unbounded DYCK is BAPO-hard). Fix a bracket-type count . Every -BAPO recognizing unbounded DYCK with bracket types on all inputs of length at most satisfies
In particular, unbounded DYCK is BAPO-hard for every fixed .
Proof. We use only bracket type 1, with opening bracket and closing bracket . Suppose an -BAPO recognizes the language on all inputs of length at most . Write its oracles as , and set
Assume for contradiction that . We will construct prefixes that require distinct summaries from , although has only possible outputs. All complete inputs in the construction have length .
Suffixes that distinguish different balances. All prefixes will have length 2V, start with V opening brackets, and differ only in their last V positions. For , define m distinct suffixes :
The exponent is positive because . Each suffix has length 2V and closes a net total of brackets. A prefix that never underflows and ends at balance therefore forms a valid string with exactly when .
Fixing a common attended set for each suffix. Initially fix the first V prefix positions to and leave the last V positions unassigned. Process the suffixes in order, keeping every assignment made in earlier steps. For each , count the already assigned positions selected by . While fewer than are selected, look for an unassigned position and a bracket such that
If such a pair exists, assign z to position i; otherwise stop processing . Each assignment increases the selected count by one. Thus each suffix fixes at most b new positions, and all suffixes together fix at most bm positions in the last V positions.
For any fixed , there is now a legal attended set shared by every completion of the unassigned positions:
-
If at least b assigned positions were selected when processing stopped, choose any b of their token-position pairs. These pairs remain selected in every completion, so they form a legal attended set.
-
Otherwise, g rejected both possible brackets at every position still unassigned at that point. Later assignments cannot add any selected positions. The full set of selected token-position pairs is therefore the same in every completion and has size less than b; take this set as .
This argument also covers , when is empty. The suffixes must be fixed before this construction because can depend on the entire suffix.
Completing the prefixes. Let be the number of opening brackets assigned among the last positions. For each , construct a prefix by assigning exactly of the remaining positions to and all others to . This is possible because , at least
positions remain unassigned, and . The leading V opening brackets prevent underflow anywhere in , regardless of the order of the last V brackets. Its final balance is
It follows that
Forcing distinct prefix summaries. Suppose for distinct . With suffix , the same attended set is legal for both prefixes, so the suffix oracle can receive identical arguments:
But is valid and is not. Correctness for every legal attended set therefore requires all prefix summaries to be distinct. However, has only possible outputs, so this is impossible. Our assumption must therefore be false, giving
The second inequality uses and . Taking logarithms gives , proving the claimed bound. For any fixed , if , the bound forces , ruling out . Because every constructed string uses only one bracket type, the result holds for every .
F.7 Fixed-hop induction
We use k-HOP INDUCTION and its hop map from Definition 6, with fixed finite alphabet and . Since its answer is a symbol in , we view -HOP INDUCTION as the languages of inputs whose answer is , and a theory predicts Easy if each is easy under it.
Proposition 18 (k-HOP INDUCTION in Star-free). For fixed and , each language , , is definable by an sentence. Thus each is star-free and has DLOGTIME-uniform and circuits.
Proof. Our construction defines one hop as a relation between input positions, then composes it k times. Use SUCC and max from Proposition 1.
One hop. Define
which holds exactly when . The hop relation is
Here is the latest previous occurrence of , and . Thus holds exactly when is defined and equals . This also handles adjacent repeats: if , then .
Fixed-hop composition. Define
For , these abbreviate finite first-order formulas obtained by expanding the definition. Induction on shows that holds exactly when all hops are defined and .
Output sentences. For each , define
This holds exactly when the final-position output is a. The output is exactly when no k-hop endpoint exists:
Since and are fixed, each sentence has fixed size. The -Star-free correspondence and the inclusions in Equation (3) give the result.
Proposition 19 (k-HOP INDUCTION not in C-RASP). For every fixed and fixed alphabet with at least symbols, the final-position output of k-HOP INDUCTION is not computable in base C-RASP.
Proof. We use the language
In words, is the language of strings such that deleting all es leaves a string containing two consecutive bs. By Huang et al. (2025a, Proposition 31 and Lemma 35), is not definable even in C-RASP[periodic, local], and hence not in base C-RASP. We show that a C-RASP program for k-HOP INDUCTION would let us recognize .
To do this, we use a construction underlying a closure property of C-RASP (Huang et al., 2025a, Lemma 42). If replaces each symbol by a string of the same fixed length (what we call a block), a C-RASP program operating on can be simulated by a new C-RASP program operating on , with a separate stream for each position within a block. Huang et al. (2025a, Lemma 42) show this closure property for C-RASP[periodic, local], but their construction uses no positional operators when the simulated program uses none, so it also applies to base C-RASP.
Encoding. Use distinct symbols . Replace each source symbol by a block of length according to the mapping :
Call each copy of , for , a group. An - or -block contains groups.
Recovering the previous non-neutral symbol. Consider the first position of the block for a source symbol . Its token is . For , a hop from goes to the immediately following the previous occurrence of , which lies in the preceding group. A hop from similarly goes to the data symbol at the end of the preceding group. Thus hops move back exactly groups and return that group's data symbol. Any intervening -blocks are skipped because they contain no .
Since every original and contributes exactly groups, the -hop output at position of (the first position of the block for ) is the last non- symbol in . If this source prefix contains no non- symbol, the first hop is undefined. In particular, when , the output at that encoded position is exactly when completes an occurrence of in the source word. For example, with , the groups around two successive non-neutral symbols are
Simulating the encoded input in C-RASP. Suppose for a contradiction that a base C-RASP program P has final Boolean stream F testing whether the k-HOP INDUCTION output is b on every input over . We run P on the encoded string . Because the program is causal, F gives the correct answer at every position: its value there is also its final value on the prefix ending at that position.
The simulation of Huang et al. (2025a, Lemma 42) converts , running on , into a new program running on . For each block offset , the new program has a stream equal to the value of at position in the original run on . In particular, as we showed above, if , then is true exactly when the previous non- source symbol is also , i.e., when completes an occurrence of . We therefore recognize by accepting when
at the end of the source word. This is a base C-RASP test, contradicting the lower bound for .
G An Exponential Width Separation between C-RASP and Softmax Transformers on Content-Dependent Retrieval
Under C-RASP (Yang and Chiang, 2024), cross-token communication in causal transformers is modeled as an act of temporal counting. Under this framework, the only cross-position primitive is unary prefix counting, , which computes how many tokens in the history satisfy a position-wise predicate . C-RASP programs compile to causally-masked softmax transformers by zeroing the query and key projection weights ( ). This forces attention weights to be uniform over the causal prefix (1/i at position ), turning each attention head into a simple prefix-averaging accumulator.
Restricting attention to uniform prefix-averaging appears at first glance to be a severe architectural constraint, as it strips away the defining operational mechanism of the transformer architecture: dynamic, content-dependent information routing based on query-key interactions ( ). Yet, Yang and Chiang (2024) and Yang, Cadilhac, and Chiang (2025) prove a formal equivalence between fixed-precision transformers and C-RASP. Specifically, Yang, Cadilhac, and Chiang (2025) claim a depth-for-depth equivalence:
implying that C-RASP and (fixed-precision) transformers are expressively equivalent, and moreover that the equivalence preserves depth. Because C-RASP compiles to uniform attention, this result in turn implies that uniform-attention transformers can simulate general transformers with content-dependent attention. Taken at face value, this equivalence directly challenges the centrality of content-dependent attention, implying that uniform prefix-averaging suffices to capture the full computational power of causal transformers.
This coarse equivalence claim, however, masks a severe resource blowup. In the simulation construction of Yang and Chiang (2024) and Yang, Cadilhac, and Chiang (2025), simulating content-dependent attention with C-RASP (and, in turn, uniform attention) requires a brute-force exhaustive enumeration of all possible query vectors. For a residual stream of dimension and precision , the state space of possible query vectors has size , where is the set of -bit numbers (Equation (16)). Because uniform attention cannot dynamically condition on a query at test time, the simulation must instantiate separate prefix-count accumulators for every possible query , yielding an exponential blowup of roughly count terms per layer. When compiled back into a uniform-attention transformer, each counting term requires dedicated residual dimensions, yielding a uniform-attention model width of .
This leaves open whether the exponential width blowup in this result is an artifact of the construction, or an unavoidable separation between counting and content-dependent retrieval. To understand whether C-RASP is a useful conceptual and theoretical model of transformers, it is important to understand its relationship not only to uniform-attention transformers, but also to general content-dependent attention transformers. In this section, we show that this exponential gap is fundamental.
We establish an explicit resource separation between C-RASP (and uniform-attention transformers) and standard content-dependent attention on a simple information-routing task: query-dependent retrieval. In this task, a sequence of key-value items is followed by a query key, and the model must retrieve the binary bit value associated with the matching key.
We prove a three-part separation result:
-
A single causal, content-dependent softmax attention head with linear residual width solves this task.
-
In contrast, every C-RASP program requires at least distinct prefix-count nodes to solve the task.
-
Consequently, any depth-D, fixed-precision transformer restricted to uniform attention ( ) requires exponential channel width .
This result exposes a central limitation of C-RASP as a theoretical model of transformer capabilities, and a fundamental separation between a transformer's content-dependent attention and temporal counting. In standard transformers, the query at position i dynamically selects which prior positions j to attend to by matching query and key representations . Uniform attention disables this dynamic selection and forces position i to receive only an unweighted average of all preceding activations. Because position i cannot selectively retrieve items from the history based on its query, a model without content-dependent attention is forced to store the entire history in its residual channels so that positionwise computation can later select the relevant information based on the query. Our separation demonstrates that the width-asymptotic C-RASP expressive equivalence results of Yang and Chiang (2024) and Yang, Cadilhac, and Chiang (2025) fail to capture the dynamic information routing power of transformers. In short, transformers are more than counting machines.
Below, we formally define the query-dependent retrieval task, state the main separation theorem, and prove each part of the result in turn.
G.1 The Query-Dependent Retrieval Task
We consider a query-dependent key-value retrieval task. Each input sequence consists of a database of key-value items followed by a single query token, yielding a total sequence length of , where is the key dimension. We study the complexity of this task as a function of the key dimension , showing an exponential separation between counting and content-dependent retrieval.
The key space is the set of binary vectors , containing distinct keys. The input is a sequence of tokens: the first tokens provide the key-value pairs of the database and the last token is the query. For every key and value , define the vector representation of the item as the concatenation . The first coordinates store the key and the -th coordinate stores the value . Define the query token for a key by .
Fix an enumeration of all keys in . For a value assignment and query index , define the input
The value assignment and query index define the input instance, whereas the key enumeration and the vector representation mappings are taken to be fixed. The task is to output the value specified by the query at the final position.
G.2 Main Separation Result
The query-dependent retrieval task separates C-RASP and uniform attention from standard content-dependent attention by an exponential factor in the key dimension.
Theorem 1 (Query-dependent retrieval separation). Fix and let . Consider the query-dependent retrieval task defined above. Then:
-
A single causal, content-dependent softmax attention head solves the task with residual width .
-
Every C-RASP program that solves the task requires at least
distinct prefix-count nodes.
- Every depth-D, p-bit causal transformer restricted to uniform attention requires width
The key factor driving this separation is that C-RASP and uniform attention aggregate information independently of the query. They must therefore encode enough information about the database to answer any of the L possible queries, distinguishing all value assignments. This requires exponentially many prefix-count nodes or residual channels. In contrast, content-dependent attention can use query-key comparisons to select the unique matching database item and retrieve its value. As a result, content-dependent attention solves the task with linear width, whereas C-RASP and uniform attention require exponential size, even when allowed polynomial depth and precision.
G.3 C-RASP and Uniform Attention Bounds
We first prove the bounds for C-RASP and uniform attention, showing that they need size scaling exponentially in m to solve the task. Recall that, in C-RASP, the only cross-position primitive is unary prefix counting
That is, the only way information can flow across positions is by counting predicates in the history. All other operations are pointwise. We measure the size of a C-RASP program by the number of distinct prefix-count nodes it has.
Proposition 20 (C-RASP bounds). Fix and let . Then:
- Every C-RASP program of any count depth that solves the query-dependent retrieval task has at least
distinct prefix-count nodes.
- There is a depth-one C-RASP program that solves the task with prefix-count nodes.
Proof. Lower bound. Consider a correct C-RASP program with distinct prefix-count nodes, . Order the program nodes topologically so that, in multi-layer programs, depends only on . For each value assignment , let be the vector of all prefix-count values after the first positions, immediately before the query:
Note that the prefix-count vector depends only on the database because the query occurs at position .
Observe that the prefix-count vector and the query token determine the computation at the final position, since information about other positions can reach the query position only through counts. Let be the predicate that counts, such that . Then, for each count node, its value at the final position is
The first term is contained in the prefix-count vector , while the second term depends only on the query token and the values of the earlier program nodes at the final position. In particular, may depend on previous count nodes in the program, and no restriction is made on the count depth of the program.
For the C-RASP program to correctly solve the task, the map must be injective. Suppose that two distinct value assignments produce the same prefix-count vector . Since , there must exist such that . Thus, on the query , the C-RASP program will return the same answer on and . This contradicts correctness.
There are possible value assignments . The prefix-count vector takes values in the space since each of the count nodes has at most possible values. Therefore, injectivity of requires that
Taking the logarithm gives
Upper bound. To establish the upper bound, we provide a C-RASP construction for the task. For each key , define the prefix count
where is the token at position in the input , so that for and . Given the structure of the task, each key occurs exactly once in the database items, and the query token does not equal . Thus, if and if . Convert these counts to Boolean predicates by setting .
At the final query position, we compute the value at the matching key via
The condition holds for exactly one , namely . Thus, this gives True if and False if . This construction uses exactly count nodes and has count depth one.
This shows that C-RASP requires exponential size to simulate query-dependent information retrieval in this task. When compiled to a transformer (Yang and Chiang, 2024; Yang, Cadilhac, and Chiang, 2025), this yields a transformer with exponential width, as each counting term requires dedicated residual dimensions.
We next prove a direct width lower bound for uniform-attention transformers.
We consider depth-D causal transformers with bounded-precision activations. For integers and , let
denote the set of -bit fixed-point numbers with fractional bits. We keep fixed throughout and omit it from the notation, since none of the bounds depend on it. Every activation is assumed to lie in , so each coordinate takes one of values. A rounding map is any function round: that maps every element of to itself. Uniform attention means that in every attention head, so every head attends uniformly over its causal prefix. For head in layer , let denote the value vector at position , and let
(17) denote the total value dimension across all layers and heads. Under uniform attention with causal masking, the output of head h in layer at position i is
where the sum and the division are computed exactly before the result is rounded back into . The lower bound holds for any rounding map, since the argument below uses only the structure of .
Proposition 21 (Uniform-attention width lower bound). Fix and let . Consider a depth-D causal transformer with uniform attention, causal masking, and activations in . If it solves the query-dependent retrieval task, then its total value dimension satisfies
In particular, if the total value dimension in each layer is at most d, then and
Proof. For each layer and head , define the sum of its value vectors over the database positions:
By causality, the representation at each database position depends only on the first database items. Hence is a function of the value assignment alone and does not depend on the query. Define the prefix-sum vector as the concatenation of these sums across all layers and heads:
This vector has V entries.
We claim that and the query token determine the output at the final position . The proof is by induction on the layer index . The inductive hypothesis is that the representation at position entering layer is determined by and the query token. This holds at because the input embedding at position is a function of the query token. Assuming it at layer , each head attends uniformly over all positions, so
The first term in the numerator is an entry of . The second is a function of the representation at position entering layer , and is therefore determined by and the query by the inductive hypothesis. Thus, is determined by and the query. The remaining operations of the layer are positionwise, so the representation at position entering layer is also determined by and the query.
By the same argument as in Proposition 20, the map must be injective for any uniform-attention transformer that solves this task. Otherwise, suppose two distinct value assignments have the same prefix-sum vector . Choose such that . The query would produce the same output on and , contradicting correctness.
We now bound the number of possible values of . Each entry is a sum of elements of having the form , where . Thus, this sum lies in , so each entry takes at most
(24) possible values. Since has V entries, it takes at most
possible values.
There are possible value assignments. Injectivity therefore requires
Taking logarithms gives . If each layer has total value dimension at most , then , which gives the stated width bound.
G.4 Content-Dependent Attention Upper Bound
The previous results showed that C-RASP and uniform attention transformers require width scaling exponentially with the task parameter . At the heart of these lower bounds is the fact that C-RASP and uniform attention aggregate over the database in a way that cannot depend on the query, so the aggregate must retain enough information to answer all possible queries. In contrast, we will show in this section that content-dependent attention can dynamically route information in a query-dependent manner, yielding an exponentially more efficient representation.
Specifically, we will show that a single attention head solves the task with residual width .
Proposition 22 (Content-dependent attention upper bound). Fix and let . There is a one-layer, one-head causal softmax transformer with residual width that solves the query-dependent retrieval task for every value assignment and every query index . The construction uses no feedforward layer, no positional encoding, and attention scores bounded in magnitude by .
Proof. Construction. We begin by presenting the construction, before proving its correctness. The residual stream has width . Write the residual state at position as , and initialize it by embedding the input token into the first coordinates:
Coordinates 1 through m hold the key, coordinate holds the value, and coordinate is initially zero and receives the attention output.
Let denote coordinates 1 through of and let denote coordinate . For a database position we have and , and at the query position we have and . Define the single attention head by
Note that the key dimension is m and the value dimension is 1. The output matrix is chosen so that the head writes its output into coordinate . The model outputs the sign of coordinate at the final position.
Attention weights at the query position. The unnormalized score of position j at the final position is
Each key is a vector in , so , where is the Hamming distance between and . The database contains each key exactly once, so exactly of the database positions are at Hamming distance from . The query position has and therefore . Writing , the softmax normalizer is
Here, we used the binomial theorem with : . The attention weights are therefore
They are large at the query position itself and at the matched key position, and small elsewhere. The choice of controls A, and therefore the sharpness of the attention weights.
Output. The head output at the final position is . We want to lower bound away from zero to guarantee that has the right sign. We compute directly,
(32)
Here, the second equality uses the fact that , and the inequality uses the fact that and that . This implies that . Next, we choose such that this is lower bounded away from zero. The choice gives , hence
Therefore . In particular is nonzero and its sign equals , so the model outputs as required. Finally, every score satisfies .
Remark (finite precision). The construction also works with fixed-point parameters and activations, with . Take to be the smallest element of that is at least . Since decreases in , the bound still holds. The parameters and activations , and are then exactly representable. As in Proposition 21, the head output is computed exactly and then rounded into ; with round-to-nearest, this changes by at most when , which does not change its sign. This shows that bits suffice.
Proposition 22 completes the proof of Theorem 1. Together with Proposition 20 and Proposition 21, it establishes the separation. One content-dependent attention head with width solves the task, whereas C-RASP requires prefix-count nodes and uniform attention requires width . The gap is exponential in and persists for any depth and precision that are polynomial in .
G.5 Experiments
In this section, we empirically test the theoretical separation between softmax attention and uniform attention transformers on the query-dependent retrieval task. Theorem 1 predicts that softmax attention solves the task with small width, while uniform attention needs width that grows exponentially in m.
Experimental setup. We use key dimensions , so the database has items and the input has tokens. We sample the values independently and uniformly from , and the query index uniformly from . Chance accuracy is therefore 50%. We shuffle the database items with a uniformly random permutation, drawn independently for each input. A learned linear layer maps each input vector or into the -dimensional residual stream.
All models use pre-LayerNorm blocks with a GELU MLP of width 4d, no positional encoding (NoPE), and a learned BOS token. Softmax attention models learn the query and key projections , while uniform-attention models fix , so each head averages uniformly over all earlier positions. A linear readout at the query position produces two output logits. We train two model sizes. The “minimal” model has one layer, one head, and width based on the construction in Proposition 22. Unlike the construction, it also has an MLP, LayerNorm, and a BOS token, to match real transformers more closely. The “standard” model has four layers, four heads, and width .
We train with cross-entropy loss for 2,048 steps of AdamW, with batch size 256, a constant learning rate of , no weight decay, gradient clipping at 1.0, and bf16 mixed precision. We sample a fresh batch at every step, for 524,288 training inputs in total. We report accuracy after the final step on a separate sample of 2,048 inputs. At small m the input space is small, so these inputs also appear in training. We run 5 seeds for each combination of m, attention type, and model size, for 100 runs in total.
(a) , 1 layer, 1 head

(b) , 4 layers, 4 heads
Figure 11: Softmax versus uniform attention on query-dependent retrieval. Accuracy against the key dimension m, for (a) width with one layer and one head and (b) width 256 with four layers and four heads. Small markers are individual seeds.
Results. We find that softmax attention models solve the task at every m and at both model sizes, while uniform attention models quickly degrade as m grows. With uniform attention, the standard model solves the task at m = 2 and the minimal model reaches 90%, but both fall to about 55% at m = 6, close to chance. By contrast, softmax attention models reach 100% accuracy in every seed, at every m, and at both model sizes. These results agree with the predictions of Theorem 1. The failure of uniform attention transformers may reflect not only the representational limitations of uniform attention, but also the difficulty of learning to emulate content-dependent retrieval with uniform attention.