Lune

ICLR2025Top-tier venue

Gumbel Counterfactual Generation From Language Models

Shauli Ravfogel, Anej Svete, Vésteinn Snæbjarnarson, Ryan Cotterell

Abstract

Understanding and manipulating the causal generation mechanisms in language models is essential for controlling their behavior. Previous work has primarily relied on techniques such as representation surgery-e.g., model ablations or manipulation of linear subspaces tied to specific concepts-to intervene on these models. To understand the impact of interventions precisely, it is useful to examine counterfactuals-e.g., how a given sentence would have appeared had it been generated by the model following a specific intervention. We highlight that counterfactual reasoning is conceptually distinct from interventions, as articulated in Pearl's causal hierarchy. Based on this observation, we propose a framework for generating true string counterfactuals by reformulating language models as a structural equation model using the Gumbel-max trick, which we called Gumbel counterfactual generation. This reformulation allows us to model the joint distribution over original strings and their counterfactuals resulting from the same instantiation of the sampling noise. We develop an algorithm based on hindsight Gumbel sampling that allows us to infer the latent noise variables and generate counterfactuals of observed strings. Our experiments demonstrate that the approach produces meaningful counterfactuals while at the same time showing that commonly used intervention techniques have considerable undesired side effects. https://github.com/shauli-ravfogel/lm-counterfactuals

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

8 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Inference-Time Intervention: Eliciting Truthful Answers from a Language Model cites Locating and Editing Factual Associations in GPT
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers8

  1. Robust Reward Modeling via Causal RubricsPragya Srivastava, Harman Singh, Rahul Madhavan, Gandharv Patil et al.ICLR 2026 · 20 citations
  2. On the Reasoning Abilities of Masked Diffusion Language ModelsAnej Svete, Ashish SabharwalICLR 2026 · 8 citations
  3. Counterfactual reasoning: an analysis of in-context emergenceMoritz Miller, Bernhard Schölkopf, Siyuan GuoNeurIPS 2025 · 5 citations
  4. Preserving Task-Relevant Information Under Linear Concept RemovalFloris Holstege, Shauli Ravfogel, Bram WoutersNeurIPS 2025 · 4 citations
  5. Abstract Counterfactuals for Language Model AgentsEdoardo Pona, Milad Kazemi, Yali Du, David Watson et al.NeurIPS 2025 · 3 citations

Builds on22

  1. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations
  2. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  3. Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 citations
  4. Inference-Time Intervention: Eliciting Truthful Answers from a Language ModelKenneth Li, Oam Patel, Fernanda B. Viégas, Hanspeter Pfister et al.NeurIPS 2023 · 1,549 citations
  5. Reducing Sentiment Bias in Language Models via Counterfactual EvaluationPo-Sen Huang, Huan Zhang, Ray Jiang, Robert Stanforth et al.EMNLP Findings 2020 · 124 citations

Related papers

  1. Learning Generalized Gumbel-max Causal MechanismsGuy Lorberbom, Daniel D. Johnson, Chris J. Maddison, Daniel Tarlow et al.NeurIPS 2021 · 25 citations
  2. Counterfactual Temporal Point ProcessesKimia Noorbakhsh, Manuel Gomez-RodriguezNeurIPS 2022 · 31 citations
  3. Natural Counterfactuals With Necessary BacktrackingGuang-Yuan Hao, Jiji Zhang, Biwei Huang, Hao Wang et al.NeurIPS 2024 · 2 citations
  4. On the Eligibility of LLMs for Counterfactual Reasoning: A Decompositional StudyShuai Yang, Qi Yang, Luoxi Tang, Yuqiao Meng et al.ICLR 2026 · 9 citations
  5. Counterfactual Explanations in Sequential Decision Making Under UncertaintyStratis Tsirtsis, Abir De, Manuel Gomez RodriguezNeurIPS 2021 · 59 citations
Dusk over the sea between two cliffs drawn in fine vertical lines