Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Models
Zili ZhangYilin WangHeng WangHerun WanMinnan Luo
Aug 2026
Natural Language Processing
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 .
NINJA (short for Needle-in-haystack jailbreak attack), a method that jailbreaks aligned LMs by appending benign, model-generated content to harmful user goals to reveal fundamental vulnerabilities in modern LMs.
R. Shah, C. Wu, Shashwat Saxena et al.· arXiv.org· 4 citations
SimulRAG, a simulator-based RAG framework with a generalized retrieval interface that translates between text and simulator parameters/outputs, is proposed, which improves informativeness and factuality over the strongest adapted RAG baselines, while UE+SBA enhances claim-level efficiency and quality.
Haozhou Xu, D. Wu, M. Chinazzi et al.· arXiv.org· 3 citations
This paper identifies two different routes through which models can acquire geometrically separable features: they can learn them from complementary co-occurrence signals in general language data, including text-number co-occurrence and cross-number interaction, or from multi-token addition problems.
Interactions are introduced as a fine-grained tool to analyze prompt sensitivity of LLMs and it is discovered that subtle changes to prompts can trigger severe instability in interactions, even when the outputs of the LLM remain the same.
Ruiyang Qin, Qingzhuo Wang, Tianhao Wang et al.· 2 citations· ⚡1
A benchmark built on the Speech Accessibility Project (SAP) dataset is introduced that tests whether diagnosis labels, clinician-derived speech ratings, and progressively richer clinical descriptions improve transcription accuracy for dysarthric speech, finding that current models do not meaningfully use this context.
P. Moure, Niclas Pokel, Bilal Bounajma et al.· arXiv.org· 2 citations
A pipeline that integrates a large language model to generate intermediate implicit premises based on the explicit premise and claim, a neuro-symbolic reasoner based on a SAT solver to determine entailment, and a neuro-symbolic reasoner based on a SAT solver to determine entailment is proposed.
Xuyao Feng, Anthony Hunter· arXiv.org· 2 citations
Related blog posts
MIT News · Artificial Intelligence· news.mit.eduAug 31, 2026
With millions of users across the world, Julia has been used to conduct cutting-edge research and to design new drugs, jet engines, heat pumps, and more.
A new machine-learning framework aims to improve the success rate of computational protein design while moving away from results that reproduce sequences found in nature.