Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Models

Zili Zhang, Yilin Wang, Heng Wang, Herun Wan, Minnan Luo


Abstract
Large language models (LLMs) can solve complex multi-hop problems yet exhibit puzzling failures on simple two-hop queries: although a model may correctly store each individual hop, it often fails to combine them. To understand the internal mechanisms of this phenomenon, we train transformers from scratch in a controlled symbolic environment. Our experiments reveal a pattern in two-hop generalization: models generalize reliably when the second hop follows the training distribution, but always fail when it deviates. Through mechanistic analysis, we provide a complete explanation for these distinct generalization behaviors: in settings where models generalize successfully, performance is driven by the emergence of consistent intermediate representations for the same entities across contexts, whereas failures on settings where the second hop is out-of-distribution arise from a mismatch across layers: lower layers correctly construct these intermediate representations, but upper layers, while trained on corresponding atomic facts, primarily learn to map them to outputs rather than to reason over them. Driven by this insight, we propose a recurrent-style training strategy, which enables transformers to reuse their reasoning circuitry across input forms and substantially improves generalization on out-of-distribution two-hop queries. Our data and code are available at https://github.com/zzl-strong/two_hop.
Anthology ID:
2026.findings-emnlp.1523
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
32415–32438
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.1523/
DOI:
Bibkey:
Cite (ACL):
Zili Zhang, Yilin Wang, Heng Wang, Herun Wan, and Minnan Luo. 2026. Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Models. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 32415–32438, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Models (Zhang et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.1523.pdf