Implicit Reasoning in Transformers: Bridging the Compositionality Gap in GPT-2-like Models
Abstract
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.
Create a lesson
Metadata
- Categories
- cs.CL, cs.AI
- Comments
- Code available at: https://github.com/Davide011/implicit-reasoning-bridging-compositionality-gap
Related papers
LUCID: Statistically Grounded Self-Correction for LLM Reasoning Evaluation
Shared title terminologycs.CLSatiyabooshan Murugaboopathy, Adel Daoud, Connor T. Jerzak
Learn the Effects, Not the Examples: Implicit ICL via Attention Patching
Shared title terminologycs.CLSeungwon Woo, Hyunseo Shin, Wonseok Hwang
When Does Reasoning Help Entity Disambiguation? Small LLMs In-Domain and Under Shift
Shared title terminologycs.CLSamy Haffoudhi, Fabian M Suchanek, Nils Holzenberger
When 1+1 ≠ 2: Benchmarking Civil-Time Reasoning in Large Language Models
Shared title terminologycs.CLMelika Shirian, Kianoosh Vadaei, Arshia Hemmat et al.
Grammar Sparsity Sets How Transformers Learn Random Languages
Shared title terminologycs.CLEdgar Andres Hernandez Moreno, Francesco Cagnetta
Explainable Emotion and Mental Health Reasoning in Large Language Models Using Theories of Emotion
Shared title terminologycs.CLTadesse Destaw Bela, Iqra Ameer, Helena Gómez Adorno et al.