mlsanityData to 7 Oct 2026

How Do LLMs Perform Two-Hop Reasoning in Context?

arXiv 2502.13913 ↗First posted 19 Feb 2025cs.CL cs.AIcited by 20

On the map: LLM reasoning → Knowledge- and tool-augmented reasoning

Abstract (arXiv)

``Socrates is human. All humans are mortal. Therefore, Socrates is mortal.'' This form of argument illustrates a typical pattern of two-hop reasoning. Formally, two-hop reasoning refers to the process of inferring a conclusion by making two logical steps, each connecting adjacent concepts, such that the final conclusion depends on the integration of both steps. It is one of the most fundamental components of human reasoning and plays a crucial role in both formal logic and everyday decision-making. Despite recent progress in large language models (LLMs), we surprisingly find that they can fail at solving simple two-hop reasoning problems when distractors are present. We observe on a synthetic dataset that pre-trained LLMs often resort to random guessing among all plausible conclusions. However, after few steps of fine-tuning, models achieve near-perfect accuracy and exhibit strong length generalization. To understand the underlying mechanisms, we train a 3-layer Transformer from scratch on a synthetic two-hop reasoning task and reverse-engineer its internal information flow. We observe a clear progression in the attention logits throughout training. This pictures a sharp phase transition from an initial stage of random guessing to the emergence of a structured sequential query mechanism, where the model first retrieves the preceding and the bridge concepts in the early layers and then uses them to infer the final answer. Finally, we show that these dynamics can be captured by a minimal three-parameter attention-only network.

Key facts. Cited by 20 papers in the map (data through 7 Oct 2026). Placed in Knowledge- and tool-augmented reasoning, one of 17 directions in LLM reasoning. Builds on 45 of its 48 references that are in the map. First posted on arXiv 19 Feb 2025.

Builds on

45 of 48 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024Do Large Language Models Latently Perform Multi-Hop Reasoning?26 Feb

Other references · 44

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2023GPT-4 Technical Reportcited by 18,132
  3. 2024The Llama 3 Herd of Modelscited by 14,192
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  5. 2021Training Verifiers to Solve Math Word Problemscited by 9,743
  6. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
  7. 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
  8. 2024Qwen2.5 Technical Reportcited by 4,713
  9. 2022Locating and Editing Factual Associations in GPTcited by 2,609
  10. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
  11. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  12. 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
32 more
  1. 2022Transformers learn in-context by gradient descentcited by 714
  2. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  3. 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 700
  4. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  5. 2023Eliciting Latent Predictions from Transformers with the Tuned Lenscited by 579
  6. 2023Dissecting Recall of Factual Associations in Auto-Regressive Language Modelscited by 512
  7. 2023Trained Transformers Learn Linear Models In-Contextcited by 331
  8. 2023MQuAKE: Assessing Knowledge Editing in Language Models via Multi-Hop Questionscited by 292
  9. 2023Function Vectors in Large Language Modelscited by 292
  10. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  11. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  12. 2023Physics of Language Models: Part 3.1, Knowledge Storage and Extractioncited by 264
  13. 2023Does Localization Inform Editing? Surprising Differences in Causality-Based Localization vs. Knowledge Editing in Language Modelscited by 237
  14. 2022Towards Understanding Grokking: An Effective Theory of Representation Learningcited by 229
  15. 2023Birth of a Transformer: A Memory Viewpointcited by 154
  16. 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 115
  17. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 114
  18. 2023In-Context Convergence of Transformerscited by 112
  19. 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 105
  20. 2023How do Language Models Bind Entities in Context?cited by 102
  21. 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 82
  22. 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalizationcited by 78
  23. 2024Hopping Too Late: Exploring the Limitations of Large Language Models on Multi-Hop Queriescited by 78
  24. 2024Transformers, parallel computation, and logarithmic depthcited by 75
  25. 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
  26. 2024Active-Dormant Attention Heads: Mechanistically Demystifying Extreme-Token Phenomena in LLMscited by 54
  27. 2024Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformerscited by 46
  28. 2024One-layer transformers fail to solve the induction heads taskcited by 30
  29. 2024Hypothesis Testing the Circuit Hypothesis in LLMscited by 29
  30. 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
  31. 2022What is my math transformer doing? -- Three results on interpretability and generalizationcited by 19
  32. 2024Extractive Structures Learned in Pretraining Enable Generalization on Finetuned Factscited by 13

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 8; 2026: 12.

20 papers.

Sort:

By area:

  1. 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thoughtcited by 73
  2. 2025A Survey on Latent Reasoningcited by 71
  3. 2026Large Language Model Reasoning Failurescited by 20
  4. 2025Emergence of Superposition: Unveiling the Training Dynamics of Chain of Continuous Thoughtcited by 16
  5. 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformerscited by 10
  6. 2026Do Latent-CoT Models Think Step-by-Step? A Mechanistic Study on Sequential Reasoning Taskscited by 10
  7. 2026Learning from Synthetic Data Improves Multi-hop Reasoningcited by 6
  8. 2026Loop the Loopies!cited by 4
  9. 2025Latent Concept Disentanglement in Transformer-based Language Modelscited by 3
  10. 2025Weak-to-Strong GraphRAG: Aligning Weak Retrievers with Large Language Models for Graph-based Retrieval Augmented Generationcited by 3
  11. 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridgecited by 2
  12. 2025Deductive Logic in Language Models: Horizontal vs Vertical Reasoningcited by 1
8 more
  1. 2026Do Language Models Reason Across Languages?cited by 1
  2. 2026Is Grokking Worthwhile? Functional Analysis and Transferability of Generalization Circuits in Transformerscited by 1
  3. 2026Opening the Black Box: A Survey on the Mechanisms of Multi-Step Reasoning in Large Language Modelscited by 1
  4. 2026Transformers Provably Learn to Internalize Chain-of-Thoughtcited by 1
  5. 2026Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalizationcited by 1
  6. 2025Can Language Models Compose Skills In-Context?cited by 0
  7. 2026Why Knowing Both Hops Is Not Enough: Understanding Two-Hop Generalization in Language Modelscited by 0
  8. 2026Transformers Stop Thinking Too Early, and a Tiny LoRA Fixes Itcited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024Lessons from Studying Two-Hop Latent Reasoning
  2. 2024Seemingly Plausible Distractors in Multi-Hop Reasoning: Are Large Language Models Attentive Readers?
  3. 2024Distributional reasoning in LLMs: Parallel reasoning processes in multi-hop reasoning
  4. 2025From System 1 to System 2: A Survey of Reasoning Large Language Models
  5. 2024Large Language Models Still Face Challenges in Multi-Hop Reasoning with External Knowledge
  6. 2025How do Transformers Learn Implicit Reasoning?
  7. 2025Unveiling the Mechanisms of Multi-Hop Reasoning in Transformers via Identity Bridge
  8. 2026Scaling Reasoning Hop Exposes Weaknesses: Demystifying and Improving Hop Generalization in Large Language Models