# G-Transformer: Counterfactual Outcome Prediction under Dynamic and Time-varying Treatment Regimes

arXiv: https://arxiv.org/abs/2406.05504 · HTML: https://mlsanity.com/paper/2406.05504/

## Key facts

- Cited by 8 papers in the map (data through 14 Oct 2026).
- Builds on 7 of its 26 references that are in the map.
- First posted on arXiv 8 Jun 2024.

## Builds on (most cited first, 7 of 7)

- [Attention Is All You Need](https://mlsanity.com/paper/1706.03762/) (2017)
- [Estimating Counterfactual Treatment Outcomes over Time Through Adversarially Balanced Representations](https://mlsanity.com/paper/2002.04083/) (2020)
- [Causal Transformer for Estimating Counterfactual Outcomes](https://mlsanity.com/paper/2204.07258/) (2022)
- [Time Series Deconfounder: Estimating Treatment Effects over Time in the Presence of Hidden Confounders](https://mlsanity.com/paper/1902.00450/) (2019)
- [Continuous-Time Modeling of Counterfactual Outcomes Using Neural Controlled Differential Equations](https://mlsanity.com/paper/2206.08311/) (2022)
- [Estimating average causal effects from patient trajectories](https://mlsanity.com/paper/2203.01228/) (2022)
- [ODE Discovery for Longitudinal Heterogeneous Treatment Effects Inference](https://mlsanity.com/paper/2403.10766/) (2024)

## Built on by (most cited first, 8 of 8)

- [Causal Diffusion Models for Counterfactual Outcome Distributions in Longitudinal Data](https://mlsanity.com/paper/2604.12992/) (2026)
- [Causal Longitudinal Prior-Fitted Networks for Counterfactual Outcome Prediction](https://mlsanity.com/paper/2606.05797/) (2026)
- [Time After Time: Deep-Q Effect Estimation for Interventions on When and What to do](https://mlsanity.com/paper/2503.15890/) (2025)
- [medR: Reward Engineering for Clinical Offline Reinforcement Learning via Tri-Drive Potential Functions](https://mlsanity.com/paper/2602.03305/) (2026)
- [A Causal Framework for Evaluating ICU Discharge Strategies](https://mlsanity.com/paper/2603.25397/) (2026)
- [Conditional Attribute Estimation with Autoregressive Sequence Models](https://mlsanity.com/paper/2605.14004/) (2026)
- [Chance-constrained selection of sequential intervention strategies from counterfactual estimates](https://mlsanity.com/paper/2608.13209/) (2026)
- [Admissible Diffusion for Multimodal Interventional Trajectories](https://mlsanity.com/paper/2609.34433/) (2026)

## Abstract (arXiv)

In the context of medical decision making, counterfactual prediction enables clinicians to predict treatment outcomes of interest under alternative courses of therapeutic actions given observed patient history. In this work, we present G-Transformer for counterfactual outcome prediction under dynamic and time-varying treatment strategies. Our approach leverages a Transformer architecture to capture complex, long-range dependencies in time-varying covariates while enabling g-computation, a causal inference method for estimating the effects of dynamic treatment regimes. Specifically, we use a Transformer-based encoder architecture to estimate the conditional distribution of relevant covariates given covariate and treatment history at each time point, then produces Monte Carlo estimates of counterfactual outcomes by simulating forward patient trajectories under treatment strategies of interest. We evaluate G-Transformer extensively using two simulated longitudinal datasets from mechanistic models, and a real-world sepsis ICU dataset from MIMIC-IV. G-Transformer outperforms both classical and state-of-the-art counterfactual prediction models in these settings. To the best of our knowledge, this is the first Transformer-based architecture that supports g-computation for counterfactual outcome prediction under dynamic and time-varying treatment strategies.
