mlsanityData to 24 Nov 2026

Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage

arXiv 2611.13498 ↗Submitted 10 Nov 2026cs.LG cs.CLcited by 0

Not on the map. Why?

Abstract (arXiv)

Compositional generalization is an important form of out-of-distribution generalization, defined as the ability to train on some combinations of modules (e.g., functions such as sort, filter) and then generalize to unseen combinations. Despite substantial empirical work evaluating compositional generalization in transformers, findings have been inconsistent because evaluations were often conducted on a limited set of train-test splits, defined in an ad hoc manner. Through a systematic evaluation, we identify two key aspects of the train-test distribution that strongly affect performance: composition equivalence and module coverage. We show that the apparent performance of direct models (trained only on final outputs) results primarily from exploiting composition equivalences, meaning different sequences of modules that reduce to identical end-to-end functions. When benchmarks eliminate these equivalences, performance drops significantly, showing their inability to generalize to compositions of known modules that produce novel end-to-end functions. We further demonstrate that performance degrades monotonically as module coverage shifts increase (when modules appear in different contexts between train and test), affecting both direct and step-by-step models (trained on intermediate and final outputs). These findings have concrete implications for benchmark design: benchmarks that include compositional equivalences can lead to significant overestimation of the generalization abilities of direct models, and benchmarks that include both module coverage violations and compositional equivalences can exacerbate shortcut learning. As a case study, we demonstrate the role of compositional equivalence on the generalization performance of the pre-trained model Llama3-8B on the code-output prediction task in the coding benchmark LiveCodeBench.

Key facts. No citing papers in the map yet (data through 24 Nov 2026). Builds on 33 of its 42 references that are in the map. Submitted 10 Nov 2026.

Builds on

33 of 42 references.

References · 33

  1. 2017Attention Is All You Needcited by 62,125
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,963
  3. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,243
  4. 2020Shortcut Learning in Deep Neural Networkscited by 2,138
  5. 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,454
  6. 2018Self-Attention with Relative Position Representationscited by 1,163
  7. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 754
  8. 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 538
  9. 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 278
  10. 2019Compositionality decomposed: how do neural networks generalise?cited by 276
  11. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 230
  12. 2018Music Transformercited by 226
21 more
  1. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 219
  2. 2021Thinking Like Transformerscited by 201
  3. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 127
  4. 2021The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformerscited by 119
  5. 2022Shortcut Learning of Large Language Models in Natural Language Understandingcited by 91
  6. 2021Making Transformers Solve Compositional Taskscited by 73
  7. 2024On Limitations of the Transformer Architecturecited by 71
  8. 2023Compositional Generalization from First Principlescited by 70
  9. 2023How Do In-Context Examples Affect Compositional Generalization?cited by 54
  10. 2023The Impact of Depth on Compositional Generalization in Transformer Language Modelscited by 41
  11. 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalabilitycited by 41
  12. 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encodingcited by 35
  13. 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 29
  14. 2024On Provable Length and Compositional Generalizationcited by 26
  15. 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Taskscited by 25
  16. 2023Discovering modular solutions that generalize compositionallycited by 25
  17. 2024Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizingcited by 19
  18. 2024Can Models Learn Skill Composition from Examples?cited by 18
  19. 2025Task Generalization With AutoRegressive Compositional Structure: Can Learning From D Tasks Generalize to DT Tasks?cited by 13
  20. 2025Scaling can lead to compositional generalizationcited by 9
  21. 2025Scalable Evaluation and Neural Models for Compositional Generalizationcited by 3

Built on by

Not cited yet.