Causal Inference with Transformer Models

Susan Athey

International Conference on Machine Learning 2026 · Invited Talk

Overview

This talk explores the intersection of machine learning, economics, and causal inference, specifically addressing how the rise of large language models (LLMs) and transformer architectures complicates—and potentially improves—our ability to estimate causal effects in high-dimensional settings. Susan Athey, presenting joint work with Guido Imbens and Zoe Ji, addresses the fundamental paradox of personalization: as recommendation and generative AI systems become better at tailoring content to individual users, it becomes increasingly difficult to learn how to personalize, because users never observe the counterfactual alternative of what would have happened had they been shown something else.

Watch on SlidesLive

Visual summary for Causal Inference with Transformer Models by Susan Athey
Visual summary for Causal Inference with Transformer Models by Susan Athey

Key moments

  1. 0:00 Introduction and background on causal inference and AI
  2. 4:00 Motivating questions and challenges in generative AI causality
  3. 12:00 Introducing logged counterfactual exposures and data structure
  4. 18:00 The core obstacles: confounding and response heterogeneity
  5. 32:00 Leveraging LLM randomization and the new estimator
  6. 42:00 Interpreting the micro-experiment causal effect estimates
  7. 48:00 Labor market applications and transformer fine-tuning

Causal Inference with Transformer Models

Speakers: Susan Athey

Conference: ICML

Video: https://slideslive.com/39078638

Overview

This talk explores the intersection of machine learning, economics, and causal inference, specifically addressing how the rise of large language models (LLMs) and transformer architectures complicates—and potentially improves—our ability to estimate causal effects in high-dimensional settings. Susan Athey, presenting joint work with Guido Imbens and Zoe Ji, addresses the fundamental paradox of personalization: as recommendation and generative AI systems become better at tailoring content to individual users, it becomes increasingly difficult to learn how to personalize, because users never observe the counterfactual alternative of what would have happened had they been shown something else.

The presentation focuses on two distinct methodologies for tackling this challenge. The first introduces a novel data structure and estimator called Conditional Treatment Average Causal Effect (CTAE), which leverages logged counterfactual exposures and the explicit stochastic sampling of LLMs to estimate the causal effects of specific low-dimensional features (such as tone or conciseness) without requiring full, unobserved user-query conditioning. The second brief application demonstrates how modifying the training objective during post-training or fine-tuning of transformer models—shifting from standard predictive mean squared error to a residual-on-residual regression—allows researchers to solve classic econometric decomposition problems, such as estimating gender wage gaps from career path sequences.

Ultimately, this work matters because it bridges a long-standing gap between rigorous statistical causal inference and modern generative AI deployment. By taking advantage of the probabilistic nature of modern LLMs, practitioners and researchers can evaluate system nudges and feature impacts using observational data without needing proprietary platform access or running expensive, full-scale combinatorial experiments.

Background

▶ Watch: Introduction and background on causal inference and AI (0:00)

The convergence of machine learning and causal inference spans several decades, drawing on literature from econometrics, statistics, computer science, and the social sciences. Historically, platforms like search engines and e-commerce recommendation systems faced the challenge of observational data—data generated by recommendation algorithms where content was matched to users based on non-random criteria. In traditional recommendation settings (e.g., recommending a movie or a book from a finite catalog of a few thousand items), systems could attempt to learn user preference embeddings or run combinatorial A/B tests to isolate the causal effect of specific content features.

However, the advent of generative AI and large language models pushes dimensionality to an extreme. In a generative AI setting, every user query is unique, and every generated response is a "unique and special snowflake"—no two users ever see the exact same generated text, video, or chatbot response. Standard observational techniques face severe confounding: features of interest (such as a warm, friendly chatbot tone) naturally covary with other unobserved features (such as the number of steps in a math solution or the conciseness of an answer), and these features respond non-linearly to the heterogeneity of the user query.

Prior work in the systems and recommendation literature addressed these high-dimensional scaling issues through heuristic methods like negative sampling, where models augment positive interaction logs with fake zeros sampled from a catalog to make matrix factorization or collaborative filtering computationally feasible. While widely deployed in industry, negative sampling introduces known biases and lacks formal causal grounding. Similarly, standard off-policy evaluation techniques struggle in continuous or highly generative content spaces because estimating high-dimensional propensity scores (the probability of a user seeing a specific piece of content given their characteristics) is statistically intractable. This talk provides a theoretical and practical framework to bypass these high-dimensional propensity score estimations by focusing on micro-experiments embedded within stochastic LLM outputs.

Key Findings

▶ Watch: Introducing logged counterfactual exposures and data structure (12:00)

The primary methodological contribution of the talk is the introduction of logged counterfactual exposures and the Conditional Treatment Average Causal Effect (CTAE) estimator. Rather than attempting to estimate the entire response surface mapping every possible characteristic of a generated object to user outcomes, CTAE narrows the objective to estimating the causal effect of a small number of low-dimensional features (e.g., emotional language, warmth, or formatting style) by treating each user query as an individual micro-experiment ($n=1$).

Key findings and methodological properties of this approach include:

  • Reusability of Datasets: A single logged dataset containing actual exposures and counterfactual exposures can be indefinitely reused to study arbitrarily different features. By saving the raw text or generated artifacts rather than immediately featurizing them, researchers can perform offline classification months later to study new features without collecting new user interaction data.
  • Bypassing User Propensity Estimation: Unlike classical causal inference frameworks that require estimating the high-dimensional probability of a user receiving a treatment based on their full background characteristics, CTAE relies entirely on within-user relative probabilities (the probability that a specific user saw alternative responses for the same query). This drastically reduces dimensionality and even allows user query contexts to be discarded post-sampling for privacy preservation.
  • Marginal Nudge Alignment: The causal effects estimated via CTAE correspond precisely to the operational decision of a platform deciding whether to nudge a model toward a specific feature (e.g., tilting slightly more toward warmth when the model is already on the fence between a warm and a neutral response).
  • Domain-Specific Transformer Fine-Tuning: In the secondary application modeling labor market transitions with a vocabulary of 330 jobs, fine-tuning transformer models using a modified objective function (residual-on-residual regression) rather than standard predictive mean squared error successfully recovers causal parameters for economic decomposition tasks, such as estimating the unexplained portion of the gender wage gap.

Technical Deep Dive

▶ Watch: The core obstacles: confounding and response heterogeneity (18:00)

The technical machinery of CTAE relies on augmenting standard interaction logs with specific counterfactual data structures obtainable from modern stochastic generative models.

Data Construction and Estimation

In a standard LLM deployment pipeline, a user query $q$ is passed to the model, which samples a response $A$ from a conditional token probability distribution $\prod P(t_i | t_{<i}, q)$. To construct logged counterfactual exposures, the system records:

  1. The actual response $A$ shown to the user alongside their outcome (e.g., a binary thumbs-up/thumbs-down rating).
  2. At least one unexposed candidate response $B$ that the user could have seen, generated either by querying the model with positive temperature during off-peak GPU hours or by extracting log probabilities directly from API outputs.
  3. The relative probability ratio between the actual exposure and the counterfactual exposure.

Once this augmented dataset is logged, the estimation pipeline proceeds via the following algorithmic steps:

  • Feature Classification: Run offline classifiers over both actual and counterfactual responses ($A$ and $B$) to tag the features of interest (e.g., measuring warm tone versus neutral tone).
  • Discordant Pair Filtering: Discard all observation pairs where both the actual exposure and the counterfactual exposure share the same feature value (i.e., drop ties where both responses were warm or both were neutral).
  • Probability Reweighting & Averaging: Using the saved log probabilities, compute a weighted average difference in outcomes over the discordant pairs. The weighting ensures that comparisons are restricted to instances where the model's stochasticity made it feasible for the user to encounter either high or low feature values, averaging across these micro-experiments to isolate the conditional treatment effect.

Objective Function Modification for Causal Fine-Tuning

In the labor market transformer application, standard transformer architectures are adapted for causal decomposition rather than next-token prediction. By modifying the stochastic gradient descent (SGD) objective function, the training loop optimizes for a residual-on-residual formulation:

$$\tilde{Y} = \beta \tilde{D} + \epsilon$$

where $\tilde{Y}$ represents the residual of the economic outcome (wages) against predicted outcomes, and $\tilde{D}$ represents the treatment assignment residual (e.g., gender) conditioned on estimated historical embeddings. This demonstrates that standard post-training and fine-tuning pipelines can be repurposed to target specific econometric parameters of interest.

Experimental Setup & Results

▶ Watch: Interpreting the micro-experiment causal effect estimates (42:00)

Because the primary methodology (CTAE) is presented as a novel theoretical and structural framework for observational data augmentation, extensive traditional benchmark comparisons are not the focus of this particular presentation. Instead, the validity of the approach is contextualized against established empirical findings in behavioral economics and platform data science.

  • Kiva Peer-to-Peer Lending Validation: The speaker references prior published work evaluating the causal effect of borrower profile features (such as smiling in photographs) on lending behavior in developing nations. In that research, observational estimates derived via featurized image controls successfully matched the ground-truth estimates obtained from a randomized controlled trial (RCT) where generative AI was used to modify images. This empirical alignment supports the underlying premise that properly structured observational adjustments can accurately recover causal parameters.
  • Labor Market Sequence Modeling: In the secondary study utilizing a constrained job vocabulary of 330 states, a transformer foundation model was pre-trained on scraped resume datasets and subsequently fine-tuned on smaller government survey datasets containing verified wage information. This setup bridged the gap between unrepresentative, large-scale textual corpora and scarce, high-quality economic panel data, enabling robust gender wage gap decompositions.

Practical Implications

▶ Watch: Labor market applications and transformer fine-tuning (48:00)

For infrastructure teams, model builders, and application developers deploying LLMs at scale, these findings offer a practical, low-barrier alternative to full-scale combinatorial A/B testing.

  • Access via API Logs: Developers operating outside major AI labs do not need proprietary internal infrastructure or formal corporate partnerships to estimate causal effects. By leveraging API access to frontier models—specifically those exposing log probabilities or by performing offline multi-sample generation during off-peak hours—small teams can construct counterfactual logs independently.
  • Privacy Tradeoffs: A notable operational advantage for data privacy teams is that once the counterfactual exposure is sampled and logged, the raw user query context can be entirely discarded. Because CTAE relies strictly on within-user relative probabilities, causal effects can be estimated without retaining sensitive user prompt text, mitigating compliance and PII leakage risks.
  • Scope Limitations: Practitioners must recognize the exact boundaries of what CTAE estimates. It does not estimate the global causal effect of arbitrarily transforming an entire response (e.g., taking a concise 4-word recipe answer and artificially forcing it to become a long, chatty narrative). Instead, it estimates the marginal effect of nudging a model toward a feature when the system is already "on the fence" between competing stochastic outputs.

Key Takeaways

  • The Personalization Paradox: Highly optimized personalization systems naturally obscure counterfactual outcomes, making standard causal inference difficult in generative AI environments where every response is unique.
  • Logged Counterfactual Exposures: By recording alternative unexposed responses and their relative probabilities (via log probabilities or temperature sampling), developers can treat every user query as an isolated $n=1$ micro-experiment.
  • Dataset Reusability: Saving raw generated text or media artifacts allows engineering teams to perform offline classification iteratively, enabling a single logged dataset to answer an unlimited variety of causal feature questions over time.
  • Propensity Simplicity: Unlike classical causal inference that requires high-dimensional propensity score estimation across user characteristics, CTAE requires only within-user relative probabilities, significantly simplifying computation.
  • Targeted Training Objectives: Modifying transformer fine-tuning and post-training objective functions (such as replacing predictive mean squared error with residual-on-residual regression) enables models to directly output causal parameters and economic decompositions.

About the Speaker(s)

  • Susan Athey: Susan Athey joined Microsoft Research in the late 2000s where she helped found the New England lab (an interdisciplinary effort between economics and computer science) and held an operational role focused on search engine problems. She is an economist with expertise in causal inference, machine learning, AI, and personalization, having worked at the intersection of economics and computer science since the late 2000s.

Reviews

→ Top-rated talks at International Conference on Machine Learning 2026

All talks from International Conference on Machine Learning 2026