NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Counterfactual Fairness

Matt J. Kusner, Joshua R. Loftus, Chris Russell, Ricardo Silva

Introduction

Machine learning models are increasingly used to make life-altering decisions, from hiring to criminal sentencing. While researchers have proposed various statistical fairness metrics, such as Demographic Parity or Equality of Opportunity, these often fail to account for the underlying causal mechanisms of bias. This paper introduces Counterfactual Fairness, a framework rooted in causal inference that ensures decisions are fair at an individual level by asking: "Would the decision change if this person's protected attributes, such as race or gender, were different?"

The Limits of Statistical Parity

Most existing fairness metrics are purely observational. They look for equal outcomes across groups but ignore why the data is biased. Data is rarely a neutral reflection of reality; it is often a product of historical prejudices. For instance, if a neighborhood is over-policed, arrest records will reflect that bias. A model trained on this data might "fairly" predict higher risk for residents, thereby perpetuating systemic discrimination.

The authors argue that to achieve true fairness, we must move beyond surface-level correlations. We must address the causal pathways that link protected attributes ($A$) to outcomes ($Y$).

Defining Counterfactual Fairness

The core of this framework is Judea Pearl’s Structural Causal Models (SCMs). A predictor $\hat{Y}$ is considered counterfactually fair if, for any individual, the probability distribution of the prediction remains the same in the actual world as it would be in a counterfactual world where their protected attribute $A$ was changed, while holding all other latent causal factors constant.

This definition captures the intuition that a fair decision should not depend on a protected attribute, either directly or through its causal descendants. A classic example is the "Red Car" paradox: if race influences car color preference but not driving ability, using car color to predict accidents is unfair because changing the driver's race would counterfactually change the car color and thus the prediction.

The FAIRLEARNING Algorithm

To implement this definition, the authors propose a three-step process:

  1. Abduction: Use observed data (e.g., test scores) and a causal model to infer the distribution of latent "background" variables ($U$). These variables represent factors not caused by the protected attribute, such as innate diligence or knowledge.
  2. Action: Imagine a counterfactual scenario where the protected attribute $A$ is modified (e.g., changing "Race: Black" to "Race: White").
  3. Prediction: Make the final prediction using only the inferred latent variables ($U$) and observed variables that are not descendants of $A$ in the causal graph.

Case Study: Law School Success

The framework was tested on the Law School Success (LSAC) dataset, which includes entrance exam scores (LSAT), pre-law GPA, and first-year average grades (FYA). The goal is to predict FYA fairly across race and sex.

Causal graph for the Law School Success dataset (Level 2 model).

In the model shown above, the latent variable $Know$ (Knowledge) is assumed to be the "fair" driver of success, while GPA and LSAT are seen as potentially biased observations influenced by both knowledge and protected attributes like Race and Sex.

Results: Visualizing Unfairness

The authors compared their counterfactually fair models against "Full" (using all data) and "Unaware" (simply dropping protected attributes) baselines. While the "Full" model achieved the highest accuracy (RMSE 0.873), it was demonstrably unfair.

Density plots of predicted FYA for "Full" and "Unaware" models under counterfactual changes.

As shown in the density plots, the "Full" model's predictions shift dramatically when race is counterfactually changed. Even the "Unaware" model—often thought to be fair—shows significant shifts, proving that removing a label is not enough to eliminate its causal influence. In contrast, the authors' fair models produced stable, overlapping distributions, proving the predictions remained stable regardless of the counterfactual race, albeit with a slight trade-off in accuracy (RMSE ~0.92).

Discussion and Limitations

Counterfactual fairness provides a rigorous path forward, but it is not a silver bullet. Its primary limitation is model dependence: the fairness guarantees are only as good as the assumed causal graph. Furthermore, counterfactuals are inherently unfalsifiable, making it difficult to empirically prove fairness without strong structural assumptions. Despite these challenges, the framework forces researchers to be explicit about their causal assumptions, turning fairness from a statistical check into a transparent, defensible conjecture about how the world works.

Summary updated

BibTeX
@inproceedings{kusner2017counterfactual,
  author = {Matt J. Kusner and Joshua R. Loftus and Chris Russell and Ricardo Silva},
  title = {{Counterfactual Fairness}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
}
Figure