Skip to main content
QUICK REVIEW

[Paper Review] Causal Transformer for Estimating Counterfactual Outcomes

Valentyn Melnychuk, Dennis Frauen|arXiv (Cornell University)|Apr 14, 2022
Machine Learning in HealthcareComputer Science19 citations
TL;DR

This paper proposes a Causal Transformer (CT) for estimating counterfactual outcomes over time from longitudinal observational data, leveraging a multi-input transformer architecture with cross-attention to model complex, long-range dependencies among time-varying covariates, past treatments, and outcomes. It introduces a novel counterfactual domain confusion (CDC) loss to learn balanced representations that are predictive of outcomes yet non-predictive of treatment assignment, reducing confounding bias; the CT outperforms state-of-the-art LSTM-based baselines in synthetic and real-world evaluations with improved accuracy and efficiency.

ABSTRACT

Estimating counterfactual outcomes over time from observational data is relevant for many applications (e.g., personalized medicine). Yet, state-of-the-art methods build upon simple long short-term memory (LSTM) networks, thus rendering inferences for complex, long-range dependencies challenging. In this paper, we develop a novel Causal Transformer for estimating counterfactual outcomes over time. Our model is specifically designed to capture complex, long-range dependencies among time-varying confounders. For this, we combine three transformer subnetworks with separate inputs for time-varying covariates, previous treatments, and previous outcomes into a joint network with in-between cross-attentions. We further develop a custom, end-to-end training procedure for our Causal Transformer. Specifically, we propose a novel counterfactual domain confusion loss to address confounding bias: it aims to learn adversarial balanced representations, so that they are predictive of the next outcome but non-predictive of the current treatment assignment. We evaluate our Causal Transformer based on synthetic and real-world datasets, where it achieves superior performance over current baselines. To the best of our knowledge, this is the first work proposing transformer-based architecture for estimating counterfactual outcomes from longitudinal data.

Motivation & Objective

  • To address the challenge of estimating counterfactual outcomes over time from observational data, especially in the presence of time-varying confounders.
  • To overcome the limitations of existing LSTM-based models in capturing long-range temporal dependencies in medical sequences.
  • To develop a transformer-based architecture that jointly models time-varying covariates, past treatments, and past outcomes with cross-attention mechanisms.
  • To design a novel end-to-end training procedure using a counterfactual domain confusion (CDC) loss to mitigate confounding bias by learning balanced representations.
  • To demonstrate superior performance and efficiency compared to state-of-the-art methods on synthetic and real-world longitudinal datasets.

Proposed method

  • The Causal Transformer uses three parallel transformer subnetworks for time-varying covariates (X), past treatments (A), and past outcomes (Y), each with masked multi-head self-attention and shared relative positional encoding.
  • The three subnetworks are fused via B stacked multi-input blocks that incorporate cross-attention mechanisms to enable information exchange between the different input modalities.
  • Static covariates (V) are fed into all multi-input blocks to provide patient-specific context.
  • The final representations from each subnetwork are averaged to form a balanced representation Φt, which is used for outcome prediction and treatment classification.
  • A custom end-to-end training procedure employs a counterfactual domain confusion (CDC) loss that minimizes reversed KL-divergence to make representations predictive of future outcomes but non-predictive of current treatment assignment.
  • The CDC loss acts as an adversarial balancing objective to reduce confounding bias, differing from gradient reversal by optimizing for distributional balance via KL divergence minimization.

Experimental results

Research questions

  • RQ1Can a transformer-based architecture effectively model long-range temporal dependencies in longitudinal observational data for counterfactual outcome estimation?
  • RQ2How does the integration of cross-attention between treatment, outcome, and covariate subnetworks improve counterfactual prediction performance?
  • RQ3To what extent does the proposed counterfactual domain confusion (CDC) loss reduce confounding bias compared to existing methods?
  • RQ4Does the Causal Transformer achieve better predictive accuracy and efficiency than existing LSTM-based baselines on both synthetic and real-world datasets?
  • RQ5What is the relative contribution of each input modality (covariates, treatments, outcomes) to the model’s predictive performance across different prediction horizons?

Key findings

  • The Causal Transformer achieves superior performance over state-of-the-art baselines, including RMSNs, CRN, and G-Net, on both synthetic and real-world datasets in terms of counterfactual outcome prediction accuracy.
  • On the semi-synthetic benchmark, the CT achieved lower test RMSE than all baselines across all prediction horizons τ, with a consistent improvement margin.
  • The model demonstrated significantly faster inference and training: total runtime was 13.5 ± 4.8 minutes on a single TITAN V GPU, compared to 75.3 ± 17.5 minutes for CRN and 118.0 ± 2.0 minutes for G-Net.
  • The Causal Transformer used fewer parameters (45K–69K) than RMSNs (477K–947K), CRN (165K–219K), and G-Net (151K–310K), indicating higher parameter efficiency.
  • Ablation studies showed that neither the multi-input transformer architecture nor the CDC loss alone was sufficient; their combination was essential for optimal performance.
  • Subnetwork importance analysis revealed that time-varying covariates contributed most to prediction performance, while treatment subnetwork importance increased with longer prediction horizons, suggesting long-range treatment effects.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.