Abstract
Causal understanding is essential for many kinds of decision-making, but causal inference from observational data has typically only been applied to structured, low-dimensional datasets. While text classifiers produce low-dimensional outputs, their use in causal inference has not previously been studied. To facilitate causal analyses based on language data, we consider the role that text classifiers can play in causal inference through established modeling mechanisms from the causality literature on missing data and measurement error. We demonstrate how to conduct causal analyses using text classifiers on simulated and Yelp data, and discuss the opportunities and challenges of future work that uses text data in causal inference.
Introduction
Causal inference—the science of determining if a variable $X$ causes an outcome $Y$ rather than merely being correlated with it—traditionally relies on low-dimensional, structured data. However, a vast amount of valuable information is stored in unstructured text, such as medical records, social media posts, and customer reviews.
To bridge this gap, researchers often employ Natural Language Processing (NLP) to extract variables from text (e.g., sentiment or topic) and then treat these classifier outputs as ground truth in causal models. This paper identifies a critical danger in this approach: text classifiers are imperfect. If the systematic errors and biases of a classifier are not accounted for, the resulting causal estimates can be significantly skewed. This work frames the use of text classifiers within two rigorous causal frameworks: missing data and measurement error.
Methodological Frameworks
The authors utilize Causal Directed Acyclic Graphs (DAGs) to formalize how text classifiers interact with causal variables. They focus on two primary scenarios where text data is used to recover a treatment variable $A$:
- Missing Data: In this scenario, ground-truth labels for the treatment $A$ are available for a subset of the data but missing for the rest. Text $T$ is used as part of the "missingness process" to help recover the distribution of the latent variable.
- Measurement Error: Here, the ground truth is never observed. Instead, researchers rely on a "noisy proxy" $A^*$ (the classifier output). To correct for this, the authors apply "matrix adjustment," a technique designed to mathematically "undo" the expected error of the classifier based on its performance on a validation set.
The Role of Text in Causal Models
When text $T_i$ is introduced into the causal structure, it is typically modeled as being influenced by the underlying variables of interest, such as the confounder $C$, the treatment $A$, and the outcome $Y$. By understanding this relationship, we can use the text to infer the values of variables that are otherwise unobserved or mismeasured.
Empirical Evaluation
The authors evaluated these frameworks using both synthetic and real-world data:
- Synthetic Data: A controlled environment with binary variables ($A, C, Y$) and associated "bag-of-words" text. This allowed for a direct comparison between estimated effects and a known ground truth.
- Yelp Dataset: Using 4.7 million reviews, the authors studied the effect of a review's rating (Treatment $A$) on whether it was flagged as "Useful" (Outcome $Y$), while controlling for the author's "power user" status (Confounder $C$).
Key Insights: The Instability of Adjustment
A major finding of the study is the inherent instability of matrix adjustment when applied to high-dimensional language data. While mathematically sound for low-dimensional variables, the method is "brittle" in NLP contexts. Because the adjustment involves dividing by estimated probabilities—which can be very small—tiny errors in the classifier's performance estimate can lead to massive, erratic swings in the final causal estimate.
In contrast, the Missing Data approach proved much more stable. Using text to fill in missing values (where some ground truth is known) consistently outperformed naive baselines and produced more reliable estimates than the measurement error adjustment.
Results and Discussion
The study measured the squared distance between the estimated causal effect and the "perfect data" estimate.
- Missing Data Results: The "Full" model, which correctly incorporated text, consistently outperformed naive models that ignored text or treated classifier outputs as perfect.
- Measurement Error Results: The "Adjusted" model showed enormous fluctuations. In many instances, the "Unadjusted" model (treating the classifier as ground truth) was actually more stable, simply because the adjustment mathematics were too sensitive to estimation noise.
Conclusion and Future Work
This research highlights that classifier error in causal inference is not just random noise; it is a systematic bias that propagates through causal equations. Given the instability of point-estimate adjustments, the authors suggest that future work should explore using text to find "bounds" (a range of possible causal effects) rather than single point estimates. Additionally, while this study used simple bag-of-words models, the integration of modern Transformers presents both an opportunity for higher accuracy and a challenge for maintaining clear causal assumptions.
Summary updated