Limits of Transformer Language Models on Learning to Compose Algorithms
Jonathan Thomm, Giacomo Camposampiero, Aleksandar Terzic, Michael Hersche, Bernhard Schölkopf, Abbas Rahimi
Abstract
We analyze the capabilities of Transformer language models in learning compositional discrete tasks. To this end, we evaluate training LLaMA models and prompting GPT-4 and Gemini on four tasks demanding to learn a composition of several discrete sub-tasks. In particular, we measure how well these models can reuse primitives observable in the sub-tasks to learn the composition task. Our results indicate that compositional learning in state-of-the-art Transformer language models is highly sample inefficient: LLaMA requires more data samples than relearning all sub-tasks from scratch to learn the compositional task; in-context prompting with few samples is unreliable and fails at executing the sub-tasks or correcting the errors in multi-round code generation. Further, by leveraging complexity theory, we support these findings with a theoretical analysis focused on the sample inefficiency of gradient descent in memorizing feedforward models. We open source our code at https://github.com/IBM/limitations-lm-algorithmic-compositional-learning.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext c2097d36-8187-4219-a7ff-c68887f9d779Cited by top-tier papers6
- Continuous Chain of Thought Enables Parallel Exploration and ReasoningHalil Alperen Gozeten, Muhammed Emrullah Ildiz, Xuechen Zhang, Hrayr Harutyunyan et al.ICLR 2026 · 40 citations
- Lost in Transmission: When and Why LLMs Fail to Reason GloballyTobias Schnabel, Kiran Tomlinson, Adith Swaminathan, Jennifer NevilleNeurIPS 2025 · 9 citations
- Behavioural vs. Representational Systematicity in End-to-End Models: An Opinionated SurveyIvan Vegner, Sydelle de Souza, Valentin Forch, Martha Lewis et al.ACL 2025 · 3 citations
- Compositional-ARC: Assessing Systematic Generalization in Abstract Spatial ReasoningPhilipp Mondorf, Shijia Zhou, Monica Riedler, Barbara PlankICLR 2026 · 3 citations
- Scalable Evaluation and Neural Models for Compositional GeneralizationGiacomo Camposampiero, Pietro Barbiero, Michael Hersche, Roger Wattenhofer et al.NeurIPS 2025 · 3 citations
Builds on20
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Faith and Fate: Limits of Transformers on CompositionalityNouha Dziri, Ximing Lu, Melanie Sclar, Xiang Lorraine Li et al.NeurIPS 2023 · 728 citations
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
- Measuring Compositional Generalization: A Comprehensive Method on Realistic DataDaniel Keysers, Nathanael Schärli, Nathan Scales, Hylke Buisman et al.ICLR 2020 · 401 citations
- Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language ModelsKushal Tirumala, Aram H. Markosyan, Luke Zettlemoyer, Armen AghajanyanNeurIPS 2022 · 304 citations
Related papers
- Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete FunctionsSatwik Bhattamishra, Arkil Patel, Phil Blunsom, Varun KanadeICLR 2024 · 77 citations
- ExeDec: Execution Decomposition for Compositional Generalization in Neural Program SynthesisKensen Shi, Joey Hong, Yinlin Deng, Pengcheng Yin et al.ICLR 2024 · 21 citations
- What Makes Large Language Models Reason in (Multi-Turn) Code Generation?Kunhao Zheng, Juliette Decugis, Jonas Gehring, Taco Cohen et al.ICLR 2025
- Better & Faster Large Language Models via Multi-token PredictionFabian Gloeckle, Badr Youbi Idrissi, Baptiste Rozière, David Lopez-Paz et al.ICML 2024 · 286 citations
- Understanding the Generalization of In-Context Learning in Transformers: An Empirical StudyXingxuan Zhang, Haoran Wang, Jiansheng Li, Yuan Xue et al.ICLR 2025
