Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Tasks

Rahul Ramesh, E. Lubana, Mikail Khona, Robert P. Dick, Hidenori Tanaka
2/12/2026

No official code found. Best implementation: rahul13ramesh/compositional_capabilities (10 stars, MIT, last commit 2024-06-26).

Abstract

Transformers trained on huge text corpora exhibit a remarkable set of capabilities, e.g., performing basic arithmetic. Given the inherent compositional nature of language, one can expect the model to learn to compose these capabilities, potentially yielding a combinatorial explosion of what operations it can perform on an input. Motivated by the above, we train autoregressive Transformer models on a synthetic data-generating process that involves compositions of a set of well-defined monolithic capabilities. Through a series of extensive and systematic experiments on this data-generating process, we show that: (1) autoregressive Transformers can learn compositional structures from small amounts of training data and generalize to exponentially or even combinatorially many functions; (2) generating intermediate outputs when composing functions is more effective for generalizing to new, unseen compositions than not generating any intermediate outputs (3) biases in the order of the compositions in the training data result in Transformers that fail to compose some combinations of functions; and (4) the attention layers select which capability to apply while the feed-forward layers execute the selected capability.

View on arXivView PDF

Code Implementations(1)

MIT

Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Tasks

102Shell, PythonJun 4, 20242 years agoMIT
compositional-generalizationicml-2024transformers

Similar Papers

Cite this paper

@article{ramesh2026compositional,
  title  = {Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Tasks},
  author = {Rahul Ramesh and E. Lubana and Mikail Khona and Robert P. Dick and Hidenori Tanaka},
  year   = {2026},
  eprint = {2311.12997},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2311.12997},
  journal = {ICML 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2311.12997.svg)](https://codeofpaper.com/paper/2311.12997)

Discussion