Faith and Fate: Limits of Transformers on Compositionality

Authors: Nouha Dziri, Ximing Lu, Melanie Sclar, Xiang Lorraine Li, Liwei Jian, Bill Yuchen Lin, Peter West, Chandra Bhagavatula, Ronan Le Bras, Jena D. Hwang, Soumya Sanyal, Sean Welleck, Xiang Ren, Allyson Ettinger, Zaid Harchaoui, Yejin Choi

Submitted to arXiv on 29 May. 2023
Abstract

Transformer large language models (LLMs) have sparked admiration for their exceptional performance on tasks that demand intricate multi-step reasoning. Yet, these models simultaneously show failures on surprisingly trivial problems. This begs the question: Are these errors incidental, or do they signal more substantial limitations? In an attempt to demystify Transformers, we investigate the limits of these models across three representative compositional tasks -- multi-digit multiplication, logic grid puzzles, and a classic dynamic programming problem. These tasks require breaking problems down into sub-steps and synthesizing these steps into a precise answer. We formulate compositional tasks as computation graphs to systematically quantify the level of complexity, and break down reasoning steps into intermediate sub-procedures. Our empirical findings suggest that Transformers solve compositional tasks by reducing multi-step compositional reasoning into linearized subgraph matching, without necessarily developing systematic problem-solving skills. To round off our empirical study, we provide theoretical arguments on abstract multi-step reasoning problems that highlight how Transformers' performance will rapidly decay with increased task complexity.

The papers around it, by date and closeness

Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper

How to read this map? Illustrated guide

Closest papers Prior work it builds on Papers that cite it

Papers around this one

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close Review Cites this paper
    Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidth
    Michelle Yuan, Wei-Yi Sun, Amir H. Rezaeian et al. · 2026 · Conference of the European Chapter of the Association for Computational Linguistics · cited 3 times · Not summarized yet

    The survey synthesizes theoretical barriers to Transformer discrete reasoning, while this paper empirically studies compositional tasks and argues that performance degrades with complexity.

    Abstract

    Transformers have become the foundational architecture for a broad spectrum of sequence modeling applications, underpinning state-of-the-art systems in natural language processing, vision, and beyond. However, their theoretical limitations in discrete reasoning tasks, such as arithmetic, logical inference, and algorithmic composition, remain a critical open problem. In this survey, we synthesize recent studies from three theoretical perspectives: circuit complexity, approximation theory, and communication complexity, to clarify the structural and computational barriers that transformers face when performing symbolic computations. By connecting these established theoretical frameworks, we pro…

  2. Very close Same question Cites this paper Uses this paper in depth
    Shattered Compositionality: Counterintuitive Learning Dynamics of Transformers for Arithmetic
    Xing-Yu Zhao, Darsh Sharma, Rheeya Uppaal et al. · 2026 · arXiv.org · preprint, not peer reviewed · cited 4 times · Not summarized yet

    Shattered Compositionality studies how Transformers acquire arithmetic skills, while this paper examines whether Transformers develop systematic compositional reasoning on tasks including multiplication.

    Abstract

    Large language models (LLMs) often achieve strong benchmark accuracy yet remain brittle under small distribution shifts. While recent mechanistic studies reveal the discrepancy between LLMs and humans in skill compositions, the learning dynamics of skill acquisition and the role of data distributions remain elusive. In this study, we train transformers on synthetic arithmetic tasks with black-box model-agnostic metrics for analyzing non-human skill compositions. We discover that transformers often acquire skills for arithmetic in reverse order or in parallel instead of human-like sequential rules--a phenomenon we refer to as shattered compositionality. To explain these behaviors, we provide …

  3. Very close Same question
    On Limitations of the Transformer Architecture
    Bing-Hui Peng, S. Narayanan, Christos H. Papadimitriou · 2024 · arXiv.org · preprint, not peer reviewed · cited 104 times · Not summarized yet

    On Limitations of the Transformer Architecture uses communication complexity to analyze Transformers’ limits on function composition and mathematical tasks, like this paper’s study of compositional limits.

    Abstract

    What are the root causes of hallucinations in large language models (LLMs)? We use Communication Complexity to prove that the Transformer layer is incapable of composing functions (e.g., identify a grandparent of a person in a genealogy) if the domains of the functions are large enough; we show through examples that this inability is already empirically present when the domains are quite small. We also point out that several mathematical tasks that are at the core of the so-called compositional tasks thought to be hard for LLMs are unlikely to be solvable by Transformers, for large enough instances and assuming that certain well accepted conjectures in the field of Computational Complexity a…

  4. Very close Another approach to the problem
    Let's Think Dot by Dot: Hidden Computation in Transformer Language Models
    Jacob Pfau, William Merrill, Samuel R. Bowman · 2024 · Computation and Language · preprint, not peer reviewed · cited 259 times · AI summary available

    Let's Think Dot by Dot tests whether filler tokens enable Transformers to solve hard algorithmic tasks, whereas this paper measures their limits on compositional tasks.

    Abstract

    Chain-of-thought responses from language models improve performance across most benchmarks. However, it remains unclear to what extent these performance gains can be attributed to human-like task decomposition or simply the greater computation that additional tokens allow. We show that transformers can use meaningless filler tokens (e.g., '......') in place of a chain of thought to solve two hard algorithmic tasks they could not solve when responding without intermediate tokens. However, we find empirically that learning to use filler tokens is difficult and requires specific, dense supervision to converge. We also provide a theoretical characterization of the class of problems where filler …

  5. Very close Broader context
    Counting Ability of Large Language Models and Impact of Tokenization
    Xiang Zhang, Juntai Cao, Chen-Yu You · 2024 · arXiv.org · preprint, not peer reviewed · cited 43 times · Not summarized yet

    Counting Ability analyzes Transformer limits on counting and tokenization, a neighboring question to this paper’s investigation of increasing complexity in compositional reasoning.

    Abstract

    Transformers, the backbone of modern large language models (LLMs), face inherent architectural limitations that impede their reasoning capabilities. Unlike recurrent networks, Transformers lack recurrent connections, confining them to constant-depth computation. This restriction places them in the complexity class TC$^0$, making them theoretically incapable of solving tasks that demand increasingly deep reasoning as input length grows. Counting, a fundamental component of many reasoning tasks, also requires reasoning depth to grow linearly to be performed inductively. While previous studies have established the upper limits of counting ability in Transformer-based expert models (i.e., models…

  6. Very close Same question Cites this paper
    Assign and Add: A Mechanistic Study of Compositional Arithmetic
    Brady Exoo, Alberto Bietti, J. Sous · 2026 · arXiv.org · preprint, not peer reviewed · Not summarized yet

    Assign and Add investigates how Transformers compose arithmetic skills through variable assignment and modular addition, while this paper tests compositional reasoning on multi-digit multiplication.

    Abstract

    Large language models are able to compose skills in order to perform complex tasks, many of which might not have been seen during training. The details of how exactly this composition occurs remain elusive. In this paper, we study a mechanism for compositional generalization in transformers by considering a simple controlled setting involving variable assignment and modular addition. By partitioning our training data into disjoint sets, we observe that small transformers are able to generalize to previously unseen combinations of variables and numbers. Our mechanistic analysis shows that the same ``modular addition''MLP module is used whether the inputs are given directly or indirectly throu…

  7. Very close Another approach to the problem Cites this paper
    Loop, Think, & Generalize: Implicit Reasoning in Recurrent-Depth Transformers
    Harsh Kohli, Srinivasan Parthasarathy, Huan Sun et al. · 2026 · arXiv.org · preprint, not peer reviewed · cited 45 times · Not summarized yet

    Loop, Think, & Generalize addresses failures in implicit multi-hop composition by studying recurrent-depth Transformers, unlike this paper’s analysis of standard Transformers’ limits.

    Abstract

    We study implicit reasoning, i.e. the ability to combine knowledge or rules within a single forward pass. While transformer-based large language models store substantial factual knowledge and rules, they often fail to compose this knowledge for implicit multi-hop reasoning, suggesting a lack of compositional generalization over their parametric knowledge. To address this limitation, we study recurrent-depth transformers, which enables iterative computation over the same transformer layers. We investigate two compositional generalization challenges under the implicit reasoning scenario: systematic generalization, i.e. combining knowledge that is never used for compositions during training, an…

  8. Very close Broader context
    Understanding Transformer Reasoning Capabilities via Graph Algorithms
    Clayton Sanford, Bahare Fatemi, Ethan Hall et al. · 2024 · Machine Learning · cited 87 times · AI summary available

    Understanding Transformer Reasoning Capabilities classifies algorithmic problems by the depth, width, and extra tokens Transformers need, complementing this paper’s complexity analysis of compositional tasks.

    Abstract

    Which transformer scaling regimes are able to perfectly solve different classes of algorithmic problems? While tremendous empirical advances have been attained by transformer-based neural networks, a theoretical understanding of their algorithmic reasoning capabilities in realistic parameter regimes is lacking. We investigate this question in terms of the network's depth, width, and number of extra tokens for algorithm execution. Our novel representational hierarchy separates 9 algorithmic reasoning problems into classes solvable by transformers in different realistic parameter scaling regimes. We prove that logarithmic depth is necessary and sufficient for tasks like graph connectivity, whi…

Prior work it builds on

  1. Close* Broader context A method it uses
    Reasoning with Transformer-based Models: Deep Learning, but Shallow Reasoning
    Chadi Helwe, C. Clavel, Fabian M. Suchanek · 2021 · Conference on Automated Knowledge Base Construction · cited 62 times · Not summarized yet

    Reasoning with Transformer-based Models examines shallow reasoning in Transformers, a broader concern related to this paper’s findings about compositional reasoning limits.

  2. Close Another approach to the problem Used in depth by this paper A method it uses
    Show Your Work: Scratchpads for Intermediate Computation with Language Models
    Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari et al. · 2021 · Machine Learning · preprint, not peer reviewed · cited 1,168 times · AI summary available

    Show Your Work uses scratchpads of intermediate computations to improve multi-step tasks, whereas this paper investigates how Transformers handle compositional tasks and where they fail.

    Abstract

    Large pre-trained language models perform remarkably well on tasks that can be done "in one pass", such as generating realistic text or synthesizing computer programs. However, they struggle with tasks that require unbounded multi-step computation, such as adding integers or executing programs. Surprisingly, we find that these same models are able to perform complex multi-step computations -- even in the few-shot regime -- when asked to perform the operation "step by step", showing the results of intermediate computations. In particular, we train transformers to perform multi-step computations by asking them to emit intermediate computation steps into a "scratchpad". On a series of increasin…

  3. Close Same method, another problem
    Unveiling Transformers with LEGO: a synthetic reasoning task
    Yi Zhang, A. Backurs, Sébastien Bubeck et al. · 2022 · arXiv.org · preprint, not peer reviewed · cited 119 times · Not summarized yet

    Unveiling Transformers with LEGO analyzes how Transformers learn a synthetic reasoning task, using task and information-flow analysis related to this paper’s study of compositional computation.

    Abstract

    We propose a synthetic reasoning task, LEGO (Learning Equality and Group Operations), that encapsulates the problem of following a chain of reasoning, and we study how the Transformer architectures learn this task. We pay special attention to data effects such as pretraining (on seemingly unrelated NLP tasks) and dataset composition (e.g., differing chain length at training and test time), as well as architectural variants such as weight-tied layers or adding convolutional components. We study how the trained models eventually succeed at the task, and in particular, we manage to understand some of the attention heads as well as how the information flows in the network. In particular, we have…

  4. Close Another approach to the problem A method it uses
    Faithful Reasoning Using Large Language Models
    A. Creswell, M. Shanahan · 2022 · arXiv.org · preprint, not peer reviewed · cited 168 times · Not summarized yet

    Faithful Reasoning uses chained model calls to produce explicit reasoning traces, whereas this paper evaluates limits of Transformers’ own compositional problem-solving.

    Abstract

    Although contemporary large language models (LMs) demonstrate impressive question-answering capabilities, their answers are typically the product of a single call to the model. This entails an unwelcome degree of opacity and compromises performance, especially on problems that are inherently multi-step. To address these limitations, we show how LMs can be made to perform faithful multi-step reasoning via a process whose causal structure mirrors the underlying logical structure of the problem. Our approach works by chaining together reasoning steps, where each step results from calls to two fine-tuned LMs, one for selection and one for inference, to produce a valid reasoning trace. Our method…

  5. Close Broader context
    Transformers Learn Shortcuts to Automata
    Bingbin Liu, Jordan T. Ash, Surbhi Goel et al. · 2022 · International Conference on Learning Representations · cited 310 times · Not summarized yet

    Transformers Learn Shortcuts to Automata explains how shallow Transformers can implement finite-state computations, providing a theoretical perspective on the reasoning limits examined here.

    Abstract

    Algorithmic reasoning requires capabilities which are most naturally understood through recurrent models of computation, like the Turing machine. However, Transformer models, while lacking recurrence, are able to perform such reasoning using far fewer layers than the number of reasoning steps. This raises the question: what solutions are learned by these shallow and non-recurrent models? We find that a low-depth Transformer can represent the computations of any finite-state automaton (thus, any bounded-memory algorithm), by hierarchically reparameterizing its recurrent dynamics. Our theoretical results characterize shortcut solutions, whereby a Transformer with $o(T)$ layers can exactly repl…

Papers that cite it

  1. Close Same method, another problem Uses this paper in depth
    Compositional Reasoning Depth Predicts Clinical AI Failure: Empirical Evidence Consistent with Transformer Compositionality Limits in Electronic Health Record Question Answering
    Sanjay Basu · 2026 · arXiv.org · preprint, not peer reviewed · Not summarized yet

    Compositional Reasoning Depth Predicts Clinical AI Failure tests whether errors rise with reasoning-step count in EHR questions, applying compositional-depth analysis to a clinical task.

    Abstract

    Aggregate accuracy benchmarks conceal a systematic structure in how large language models fail at electronic health record (EHR) question answering: questions requiring more inferential steps produce disproportionately more errors. Motivated by theoretical results on transformer compositionality limits, we introduce a pre-specified hop-count taxonomy -- the number of distinct reasoning steps required to answer a clinical question from an EHR -- as a principled predictor of model failure. We annotate 313 clinician-generated MedAlign EHR question-answer pairs across four hop levels and evaluate 301 questions in a within-model ablation (claude-sonnet-4-6, zero-shot vs. extended thinking) and cr…

  2. Close Another approach to the problem
    Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Error
    Panagiotis Giannoulis, Yorgos Pantis, Christos Tzamos · 2025 · Neural Information Processing Systems · cited 5 times · Not summarized yet

    Teaching Transformers to Solve Combinatorial Problems uses iterative candidate generation and verification for Sudoku, rather than analyzing Transformers’ compositional limits.

    Abstract

    Despite their proficiency in various language tasks, Large Language Models (LLMs) struggle with combinatorial problems like Satisfiability, Traveling Salesman Problem, or even basic arithmetic. We address this gap through a novel trial&error approach for solving problems in the class NP, where candidate solutions are iteratively generated and efficiently validated using verifiers. We focus on the paradigmatic task of Sudoku and achieve state-of-the-art accuracy (99%) compared to prior neuro-symbolic approaches. Unlike prior work that used custom architectures, our method employs a vanilla decoder-only Transformer (GPT-2) without external tools or function calling. Our method integrates imita…

  3. Close Same question
    A Diagnostic Framework for Compositional Generalization via NL-to-FOL Translation
    Ibrahim Ethem Deveci · 2026 · Journal of Logic, Language and Information · cited 1 time · Not summarized yet

    A Diagnostic Framework evaluates whether Transformers generalize compositional structure by translating sentences into first-order logic, addressing the compositionality question studied here.

    Abstract

    With the emergence of large language models and their impressive performance across diverse natural language processing tasks, the question of whether connectionist models can exhibit compositionality without relying on symbolic processing has regained attention in both cognitive science and artificial intelligence. However, interpretability challenges faced by neural networks make it difficult to determine whether they genuinely generalize compositional structures. In this paper, we introduce a targeted evaluation framework designed to directly assess the ability of transformer-based language models to translate natural language sentences into first-order logic expressions, a task that requ…

  4. Close Same question
    The Kinetics of Reasoning: How Chain-of-Thought Shapes Learning in Transformers?
    Zihan Pengmei, C. Mavromatis, Zhengyuan Shen et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet

    The Kinetics of Reasoning studies how chain-of-thought and task complexity affect Transformer learning on symbolic reasoning, overlapping this paper’s focus on complexity and compositional performance.

    Abstract

    Chain-of-thought (CoT) supervision can substantially improve transformer performance, yet the mechanisms by which models learn to follow and benefit from CoT remain poorly understood. We investigate these learning dynamics through the lens of grokking by pretraining transformers on symbolic reasoning tasks with tunable algorithmic complexity and controllable data composition to study their generalization. Models were trained under two settings: (i) producing only final answers, and (ii) emitting explicit CoT traces before answering. Our results show that while CoT generally improves task performance, its benefits depend on task complexity. To quantify these effects, we model the accuracy of …

  5. Close Different results Uses this paper in depth
    Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers
    Takuya Ito, Ruchir Puri, Murray Campbell et al. · 2026 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet

    Universal Transformers presents a parameterization that solves expressions of any depth or length, contrasting with this paper’s claim that Transformer performance rapidly decays as task complexity grows.

    Abstract

    Learning generalizable algorithmic computations remains a challenge for neural networks, as reflected in persistent failures on compositional and length generalization benchmarks. We present a provably correct, transformer parameterization (with only 280 learnable parameters for Boolean algebra tasks) capable of learning and evaluating problems of any depth or length. We assume inputs are fully parenthesized, well-formed expressions. Our approach conceptualizes algorithmic tasks as circuit models embedded in transformers, enabling depth-1 circuit reduction in a single forward pass. To achieve depth generalization, we introduce a positional encoding that tracks each gate's depth within the ci…

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 5 November 2026.

The illustrated guide to the papers around a paper