Implicit Reasoning in Transformers: Bridging the Compositionality Gap in GPT-2-like Models
On the map: LLM reasoning → Prompting and chain-of-thought reasoning also fits: Test-time compute and efficient thinking
Abstract (arXiv)
Compositional generalization remains a persistent limitation of transformer language models: even when a model learns to combine known facts correctly in-distribution (ID), the same compositional mechanism may fail when applied to out-of-distribution (OOD) knowledge. We investigate this compositionality gap in a controlled two-hop reasoning setting using a GPT-2-like transformer model trained from scratch. Building on prior work identifying a circuit associated with compositional generalization, we test whether the failure of OOD transfer is related to how atomic knowledge is structurally exposed during training. We modify the training distribution by presenting both ID and OOD atomic facts in a format positionally aligned with the second-hop retrieval step of the learned compositional circuit, without modifying the model architecture or adding OOD compositional supervision. Under this intervention, the model successfully transfers the learned ID compositional behaviour to held-out OOD atomic facts, closing the observed compositionality gap in the controlled setting. Our results provide evidence that the observed compositionality gap is not a fundamental architecture limitation and that it can be overcome through mechanistically informed training distribution design.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Prompting and chain-of-thought reasoning, one of 17 directions in LLM reasoning. Builds on 10 of its 14 references that are in the map. Submitted 28 Oct 2026.
Builds on
10 of 14 references.
Closest ancestors · 1
Same direction, newest first
Other references · 9
- 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,156
- 2023The Unlocking Spell on Base LLMs: Rethinking Alignment via In-Context Learningcited by 268
- 2024Do Large Language Models Latently Perform Multi-Hop Reasoning?cited by 191
- 2024Hopping Too Late: Exploring the Limitations of Large Language Models on Multi-Hop Queriescited by 95
- 2026Loop, Think, & Generalize: Implicit Reasoning in Recurrent-Depth Transformerscited by 48
- 2025How do Transformers Learn Implicit Reasoning?cited by 20
- 2026DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoningcited by 11
- 2025Unveiling the Mechanisms of Multi-Hop Reasoning in Transformers via Identity Bridgecited by 7
- 2026Multi-Hop Knowledge Composition is Bound by Pretraining Exposurecited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalization
- 2025Are Transformers Able to Reason by Connecting Separated Knowledge in Training Data?
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoning
- 2023Faith and Fate: Limits of Transformers on Compositionality
- 2022Achieving and Understanding Out-of-Distribution Generalization in Systematic Reasoning in Small-Scale Transformers
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Tasks
- 2026Is Grokking Worthwhile? Functional Analysis and Transferability of Generalization Circuits in Transformers
- 2025Compositional Generalization from Learned Skills via CoT Training: A Theoretical and Structural Analysis for Reasoning