Using Text Embeddings for Causal Inference

Victor Veitch, Dhanya Sridhar, David M. BleiarXiv 2019

Introduction

Causal inference aims to determine if a treatment $T$ causes an outcome $Y$. In many real-world scenarios, the variables that affect both the cause and the effect—known as confounders—are hidden within high-dimensional text data. For instance, in scientific publishing, the "subject" of a paper is a confounder: technical subjects might require more theorems (treatment) but also have different baseline acceptance rates (outcome). Similarly, on social media, an author's writing style or topic choice might confound the relationship between their gender label and a post's popularity.

Causal DAGs illustrating confounding and mediating roles of text variables (W_i).

Standard causal adjustment methods fail when covariates are as complex as a 5,000-word essay. Directly using raw text leads to massive overfitting and high variance. To solve this, researchers propose "causally sufficient embeddings"—low-dimensional representations designed to retain all information necessary to block confounding without losing linguistic nuance.

Methodology: Causally Sufficient Embeddings

The core innovation lies in adapting modern language models to create embeddings specifically for causal adjustment. Two primary models are introduced:

  1. Causal BERT (C-BERT): A state-of-the-art BERT model fine-tuned with two additional "heads" to predict the treatment ($T$) and the outcome ($Y$) alongside its standard language modeling objective.
  2. Causal Amortized Topic Model (Causal ATM): A Variational Autoencoder (VAE) based topic model that reconstructs text while simultaneously predicting $T$ and $Y$.

This multi-task loss forces the embedding to model language structure while retaining only the features relevant to the causal relationship. This approach is supported by a theoretical proof showing that if an embedding is "predictively sufficient" for $T$ and $Y$, it is also "causally sufficient" for adjustment.

Empirical Evaluation

Because ground-truth causal effects are rarely known in real-world text data, the framework was tested on semi-synthetic datasets:

  • PeerRead: Real scientific abstracts with simulated "acceptance" outcomes based on known confounders like title "buzziness."
  • Reddit: 90,000 comments where the effect of gender labels on post scores is analyzed, using subreddit and content as confounders.

Key Results

The experiments yielded several critical insights regarding the construction of these embeddings:

  • Supervision is Essential: Models supervised to predict $T$ and $Y$ (C-BERT, C-ATM) significantly outperformed unsupervised methods like standard LDA or out-of-the-box BERT embeddings.
  • Language Modeling as a Prior: C-BERT outperformed versions of BERT that used only supervised prediction. The knowledge gained from understanding language structure helps the model identify subtle confounders that simple neural networks might miss.
Performance comparison showing how language modeling and supervision contribute to more accurate causal estimates across different datasets.

In real-world applications on the PeerRead data, the models revealed that while theorems appear to increase acceptance rates, much of that effect disappears once the paper's subject is adjusted for using these embeddings. This suggests that "technicality" is the true driver of acceptance, rather than the mere presence of a theorem.

Conclusion and Future Work

This framework demonstrates that predictive sufficiency can effectively serve as a proxy for causal sufficiency in high-dimensional text analysis. By combining supervised learning with robust language modeling, researchers can obtain more accurate causal estimates from observational data.

Future work remains in opening the "black box" of these embeddings to visualize which linguistic features drive adjustment, as well as extending the framework to cases where the treatment itself is a linguistic property (e.g., the "politeness" of a text) rather than an external label.

Summary updated

BibTeX
@misc{veitch2019using,
  author = {Victor Veitch and Dhanya Sridhar and David M. Blei},
  title = {{Using Text Embeddings for Causal Inference}},
  year = {2019},
  eprint = {1905.12741},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.12741},
}
Figure