mlsanityData to 14 Oct 2026

Counterfactual reasoning: an analysis of in-context emergence

arXiv 2506.05188 ↗First posted 5 Jun 2025cs.CL cs.AI cs.LGcited by 4

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

  1. 2023Counterfactual reasoning: Testing language models' understanding of hypothetical scenarios26 May

Other references · 42

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  4. 2023GPT-4 Technical Reportcited by 18,396
  5. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
  6. 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
  7. 2022Emergent Abilities of Large Language Modelscited by 2,512
  8. 2017Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPRcited by 1,089
  9. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  10. 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
  11. 2017Counterfactual Fairnesscited by 804
  12. 2022Transformers learn in-context by gradient descentcited by 732
30 more
  1. 2023The Linear Representation Hypothesis and the Geometry of Large Language Modelscited by 716
  2. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  3. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  4. 2015Unitary Evolution Recurrent Neural Networkscited by 294
  5. 2020Scalable Gradients for Stochastic Differential Equationscited by 271
  6. 2013Causal Discovery with Continuous Additive Noise Modelscited by 255
  7. 2019Causality for Machine Learningcited by 243
  8. 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
  9. 2021Counterfactual Generative Networkscited by 111
  10. 2024In-Context Language Learning: Architectures and Algorithmscited by 89
  11. 2019Counterfactual Story Reasoning and Generationcited by 88
  12. 2024Beyond Accuracy: Evaluating the Reasoning Behavior of Large Language Models -- A Surveycited by 83
  13. 2019WIQA: A dataset for "What if..." reasoning over procedural textcited by 71
  14. 2020Counterfactual Credit Assignment in Model-Free Reinforcement Learningcited by 64
  15. 2020Sample-Efficient Reinforcement Learning via Counterfactual-Based Data Augmentationcited by 59
  16. 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 57
  17. 2023Counterfactual Identifiability of Bijective Causal Modelscited by 43
  18. 2022Causal de Finetti: On the Identification of Invariant Causal Structure in Exchangeable Datacited by 42
  19. 2014From Ordinary Differential Equations to Structural Causal Models: the deterministic casecited by 41
  20. 2016Recurrent Orthogonal Networks and Long-Memory Taskscited by 38
  21. 2023The Impact of Depth on Compositional Generalization in Transformer Language Modelscited by 38
  22. 2020Causal models for dynamical systemscited by 34
  23. 2023In-context Learning and Gradient Descent Revisitedcited by 20
  24. 2023Causal Modeling with Stationary Diffusionscited by 19
  25. 2024Identifiable Exchangeable Mechanisms for Causal Structure and Representation Learningcited by 16
  26. 2024Gumbel Counterfactual Generation From Language Modelscited by 14
  27. 2024Counterfactual Generation with Identifiability Guaranteescited by 13
  28. 2024Do Finetti: On Causal Effects for Exchangeable Datacited by 11
  29. 2024Exchangeable Sequence Models Quantify Uncertainty Over Latent Conceptscited by 7
  30. 2025The Role of Diversity in In-Context Learning for Large Language Modelscited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 4.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2023What If the TV Was Off? Examining Counterfactual Reasoning Abilities of Multi-modal Language Models
  2. 2025CounterBench: Evaluating and Improving Counterfactual Reasoning in Large Language Models
  3. 2025On the Eligibility of LLMs for Counterfactual Reasoning: A Decompositional Study
  4. 2026Better Think Thrice: Learning to Reason Causally with Double Counterfactual Consistency
  5. 2022Counterfactual reasoning: Do language models need world knowledge for causal understanding?
  6. 2024Evidence from counterfactual tasks supports emergent analogical reasoning in large language models
  7. 2025Executable Counterfactuals: Improving LLMs' Causal Reasoning Through Code
  8. 2024Reasoning Elicitation in Language Models via Counterfactual Feedback