Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformers
On the map: LLM reasoning → Reasoning benchmarks and evaluation
Abstract (arXiv)
Large language models (LLMs) can acquire new knowledge through fine-tuning, but this process exhibits a puzzling duality: models can generalize remarkably from new facts, yet are also prone to hallucinating incorrect information. However, the reasons for this phenomenon remain poorly understood. In this work, we argue that both behaviors stem from a single mechanism known as out-of-context reasoning (OCR): the ability to deduce implications by associating concepts, even those without a causal link. Our experiments across five prominent LLMs confirm that OCR indeed drives both generalization and hallucination, depending on whether the associated concepts are causally related. To build a rigorous theoretical understanding of this phenomenon, we then formalize OCR as a synthetic factual recall task. We empirically show that a one-layer single-head attention-only transformer with factorized output and value matrices can learn to solve this task, while a model with combined weights cannot, highlighting the crucial role of matrix factorization. Our theoretical analysis shows that the OCR capability can be attributed to the implicit bias of gradient descent, which favors solutions that minimize the nuclear norm of the combined output-value matrix. This mathematical structure explains why the model learns to associate facts and implications with high sample efficiency, regardless of whether the correlation is causal or merely spurious. Ultimately, our work provides a theoretical foundation for understanding the OCR phenomenon, offering a new lens for analyzing and mitigating undesirable behaviors from knowledge injection.
Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Placed in Reasoning benchmarks and evaluation, one of 17 directions in LLM reasoning. Builds on 52 of its 65 references that are in the map. First posted on arXiv 12 Jun 2025.
Builds on
52 of 65 references.
References · 52
- 2014Adam: A Method for Stochastic Optimizationcited by 37,240
- 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,128
- 2017The Implicit Bias of Gradient Descent on Separable Datacited by 655
- 2016CVXPY: A Python-Embedded Modeling Language for Convex Optimizationcited by 641
- 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 407
- 2019Implicit Regularization in Deep Matrix Factorizationcited by 405
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2017Implicit Regularization in Matrix Factorizationcited by 322
- 2019Gradient Descent Maximizes the Margin of Homogeneous Neural Networkscited by 320
- 2018Characterizing Implicit Bias in Terms of Optimization Geometrycited by 266
- 2018Implicit Bias of Gradient Descent on Linear Convolutional Networkscited by 251
- 2023Evaluating the Ripple Effects of Knowledge Editing in Language Modelscited by 242
38 more
- 2024Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?cited by 232
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2024Do Large Language Models Latently Perform Multi-Hop Reasoning?cited by 169
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2020Towards Resolving the Implicit Bias of Gradient Descent for Matrix Factorization: Greedy Low-Rank Learningcited by 150
- 2023Taken out of context: On measuring situational awareness in LLMscited by 143
- 2023Physics of Language Models: Part 3.2, Knowledge Manipulationcited by 143
- 2020Implicit Regularization in Deep Learning May Not Be Explainable by Normscited by 119
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2023In-Context Convergence of Transformerscited by 115
- 2018Convergence of Gradient Descent on Separable Datacited by 110
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
- 2022Vision Transformers provably learn spatial structurecited by 93
- 2024Unfamiliar Finetuning Examples Control How Language Models Hallucinatecited by 87
- 2024Transformers, parallel computation, and logarithmic depthcited by 79
- 2021Small random initialization is akin to spectral learning: Optimization and generalization guarantees for overparameterized low-rank matrix reconstructioncited by 78
- 2024Hopping Too Late: Exploring the Limitations of Large Language Models on Multi-Hop Queriescited by 78
- 2023Transformers as Support Vector Machinescited by 74
- 2023Generalization on the Unseen, Logic Reasoning and Degree Curriculumcited by 73
- 2023Max-Margin Token Selection in Attention Mechanismcited by 58
- 2024Active-Dormant Attention Heads: Mechanistically Demystifying Extreme-Token Phenomena in LLMscited by 56
- 2019Lexicographic and Depth-Sensitive Margins in Homogeneous and Non-Homogeneous Deep Modelscited by 53
- 2023Transformers learn through gradual rank increasecited by 52
- 2023JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attentioncited by 52
- 2024Understanding Factual Recall in Transformers via Associative Memoriescited by 51
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 46
- 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 40
- 2021On Margin Maximization in Linear and ReLU Networkscited by 34
- 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformerscited by 34
- 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
- 2024One-layer transformers fail to solve the induction heads taskcited by 32
- 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiencycited by 29
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2025How Do LLMs Perform Two-Hop Reasoning in Context?cited by 20
- 2024Implicit Regularization of Gradient Flow on One-Layer Softmax Attentioncited by 19
- 2022Learning to Reason with Neural Networks: Generalization, Unseen Data and Boolean Measurescited by 17
- 2024Extractive Structures Learned in Pretraining Enable Generalization on Finetuned Factscited by 14
50 most cited of 52 All 52 (JSON)
Built on by
Citing papers per year: 2025: 3; 2026: 7.
10 papers.
- 2025Emergence of Superposition: Unveiling the Training Dynamics of Chain of Continuous Thoughtcited by 16
- 2025Unveiling the Mechanisms of Multi-Hop Reasoning in Transformers via Identity Bridgecited by 4
- 2026DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoningcited by 4
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridgecited by 2
- 2026Transformers Provably Learn to Internalize Chain-of-Thoughtcited by 2
- 2026Why Deep Jacobian Spectra Separate: Depth-Induced Scaling and Singular-Vector Alignmentcited by 1
- 2025GSM-Agent: Understanding Agentic Reasoning Using Controllable Environmentscited by 0
- 2026A Theoretical Analysis of Why Masked Diffusion Models Mitigate the Reversal Cursecited by 0
- 2026Feature Resemblance: Towards a Theoretical Understanding of Analogical Reasoning in Transformerscited by 0
- 2026RAIL: An Automatic Classifier of the Artificial Intelligence Readiness Levelcited by 0
- 2026RAIL: An Automatic Classifier of the Artificial Intelligence Readiness Level13 Aug 2026
- 2026DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoning1 Jul 2026
- 2026Transformers Provably Learn to Internalize Chain-of-Thought27 May 2026
- 2026Feature Resemblance: Towards a Theoretical Understanding of Analogical Reasoning in Transformers5 Mar 2026
- 2026Why Deep Jacobian Spectra Separate: Depth-Induced Scaling and Singular-Vector Alignment12 Feb 2026
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridge2 Feb 2026
- 2026A Theoretical Analysis of Why Masked Diffusion Models Mitigate the Reversal Curse2 Feb 2026
- 2025Unveiling the Mechanisms of Multi-Hop Reasoning in Transformers via Identity Bridge29 Sep 2025
- 2025Emergence of Superposition: Unveiling the Training Dynamics of Chain of Continuous Thought27 Sep 2025
- 2025GSM-Agent: Understanding Agentic Reasoning Using Controllable Environments26 Sep 2025
Similar, not cited
Close in wording, no citation either way
- 2026Why LLMs Hallucinate on Structured Knowledge: A Mechanistic Analysis of Reasoning over Linearized Representations
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformers
- 2022Achieving and Understanding Out-of-Distribution Generalization in Systematic Reasoning in Small-Scale Transformers
- 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalization
- 2026Loop, Think, & Generalize: Implicit Reasoning in Recurrent-Depth Transformers
- 2026When Do Hallucinations Arise? A Graph Perspective on the Evolution of Path Reuse and Path Compression
- 2025More Thinking, Less Seeing? Assessing Amplified Hallucination in Multimodal Reasoning Models
- 2025Disentangling Recall and Reasoning in Transformer Models through Layer-wise Attention and Activation Analysis