Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Models
TL;DR - A mechanistic study of why LLMs that know both individual hops of a two-hop query still fail to chain them, tracing the failure to a layer-wise mismatch and proposing a recurrent-style training fix. It matters because it explains a concrete compositional-reasoning gap and offers a training remedy.
- Transformers trained from scratch in a controlled symbolic setting generalize on two-hop queries when the second hop matches the training distribution, but consistently fail when it is out-of-distribution.
- Successful generalization coincides with the emergence of consistent intermediate representations for the same entities across contexts.
- Failures stem from a cross-layer mismatch: lower layers build correct intermediate representations, while upper layers—though trained on the corresponding atomic facts—mainly learn to map them to outputs rather than reason over them.
- A proposed recurrent-style training strategy lets transformers reuse reasoning circuitry across input forms, substantially improving OOD two-hop generalization.