Counterfactual reasoning: an analysis of in-context emergence
On the map: LLM reasoning → Causal reasoning in LLMs
Abstract (arXiv)
Large-scale neural language models exhibit remarkable performance in in-context learning: the ability to learn and reason about the input context on the fly. This work studies in-context counterfactual reasoning in language models, that is, the ability to predict consequences of a hypothetical scenario. We focus on a well-defined, synthetic linear regression task that requires noise abduction. Accurate prediction is based on (1) inferring an unobserved latent concept and (2) copying contextual noise from factual observations. We show that language models are capable of counterfactual reasoning. Further, we enhance existing identifiability results and reduce counterfactual reasoning for a broad class of functions to a transformation on in-context observations. In Transformers, we find that self-attention, model depth and pre-training data diversity drive performance. Moreover, we provide mechanistic evidence that the latent concept is linearly represented in the residual stream and we introduce designated textitnoise abduction heads central to performing counterfactual reasoning. Lastly, our findings extend to counterfactual reasoning under SDE dynamics and reflect that Transformers can perform noise abduction on sequential data, providing preliminary evidence on the potential for counterfactual story generation. Our code is available under https://github.com/mrtzmllr/iccr.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Placed in Causal reasoning in LLMs, one of 17 directions in LLM reasoning. Builds on 43 of its 66 references that are in the map. First posted on arXiv 5 Jun 2025.
Builds on
43 of 66 references.
Closest ancestors · 1
Same direction, newest first
- 2023Counterfactual reasoning: Testing language models' understanding of hypothetical scenarios26 May
Other references · 42
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2023GPT-4 Technical Reportcited by 18,396
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2017Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPRcited by 1,089
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
- 2017Counterfactual Fairnesscited by 804
- 2022Transformers learn in-context by gradient descentcited by 732
30 more
- 2023The Linear Representation Hypothesis and the Geometry of Large Language Modelscited by 716
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2015Unitary Evolution Recurrent Neural Networkscited by 294
- 2020Scalable Gradients for Stochastic Differential Equationscited by 271
- 2013Causal Discovery with Continuous Additive Noise Modelscited by 255
- 2019Causality for Machine Learningcited by 243
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2021Counterfactual Generative Networkscited by 111
- 2024In-Context Language Learning: Architectures and Algorithmscited by 89
- 2019Counterfactual Story Reasoning and Generationcited by 88
- 2024Beyond Accuracy: Evaluating the Reasoning Behavior of Large Language Models -- A Surveycited by 83
- 2019WIQA: A dataset for "What if..." reasoning over procedural textcited by 71
- 2020Counterfactual Credit Assignment in Model-Free Reinforcement Learningcited by 64
- 2020Sample-Efficient Reinforcement Learning via Counterfactual-Based Data Augmentationcited by 59
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 57
- 2023Counterfactual Identifiability of Bijective Causal Modelscited by 43
- 2022Causal de Finetti: On the Identification of Invariant Causal Structure in Exchangeable Datacited by 42
- 2014From Ordinary Differential Equations to Structural Causal Models: the deterministic casecited by 41
- 2016Recurrent Orthogonal Networks and Long-Memory Taskscited by 38
- 2023The Impact of Depth on Compositional Generalization in Transformer Language Modelscited by 38
- 2020Causal models for dynamical systemscited by 34
- 2023In-context Learning and Gradient Descent Revisitedcited by 20
- 2023Causal Modeling with Stationary Diffusionscited by 19
- 2024Identifiable Exchangeable Mechanisms for Causal Structure and Representation Learningcited by 16
- 2024Gumbel Counterfactual Generation From Language Modelscited by 14
- 2024Counterfactual Generation with Identifiability Guaranteescited by 13
- 2024Do Finetti: On Causal Effects for Exchangeable Datacited by 11
- 2024Exchangeable Sequence Models Quantify Uncertainty Over Latent Conceptscited by 7
- 2025The Role of Diversity in In-Context Learning for Large Language Modelscited by 6
Built on by
Citing papers per year: 2026: 4.
4 papers.
- 2026Superposition Without Interference? Towards Isolated Interventions via Almost Orthogonal Features in Language Modelscited by 2
- 2026On the Emergence and Test-Time Use of Structural Information in Large Language Modelscited by 1
- 2026One mechanism for many mental spaces: a shared router over a value slot in language modelscited by 0
- 2026Beyond the Shadows of Plato's Cave: Evaluating False Memory in Autonomous Agents via Counterfactual Reasoningcited by 0
- 2026Beyond the Shadows of Plato's Cave: Evaluating False Memory in Autonomous Agents via Counterfactual Reasoning30 Sep 2026
- 2026One mechanism for many mental spaces: a shared router over a value slot in language models11 Jul 2026
- 2026Superposition Without Interference? Towards Isolated Interventions via Almost Orthogonal Features in Language Models4 Feb 2026
- 2026On the Emergence and Test-Time Use of Structural Information in Large Language Models25 Jan 2026
Similar, not cited
Close in wording, no citation either way
- 2023What If the TV Was Off? Examining Counterfactual Reasoning Abilities of Multi-modal Language Models
- 2025CounterBench: Evaluating and Improving Counterfactual Reasoning in Large Language Models
- 2025On the Eligibility of LLMs for Counterfactual Reasoning: A Decompositional Study
- 2026Better Think Thrice: Learning to Reason Causally with Double Counterfactual Consistency
- 2022Counterfactual reasoning: Do language models need world knowledge for causal understanding?
- 2024Evidence from counterfactual tasks supports emergent analogical reasoning in large language models
- 2025Executable Counterfactuals: Improving LLMs' Causal Reasoning Through Code
- 2024Reasoning Elicitation in Language Models via Counterfactual Feedback