Counterfactual Fairness for Predictions using Generative Adversarial Networks

Yuchen Ma, Dennis Frauen, Valentyn Melnychuk, Stefan Feuerriegel · OpenReview

Abstract

Fairness in predictions is of direct importance in practice due to legal, ethical, and societal reasons. It is often achieved through counterfactual fairness, which ensures that the prediction for an individual is the same as that in a counterfactual world under a different sensitive attribute. However, achieving counterfactual fairness is challenging as counterfactuals are unobservable. In this paper, we develop a novel deep neural network called Generative Counterfactual Fairness Network (GCFN) for making predictions under counterfactual fairness. Specifically, we leverage a tailored generative adversarial network to directly learn the counterfactual distribution of the descendants of the sensitive attribute, which we then use to enforce fair predictions through a novel counterfactual mediator regularization. If the counterfactual distribution is learned sufficiently well, our method is mathematically guaranteed to ensure the notion of counterfactual fairness. Thereby, our GCFN addresses key shortcomings of existing baselines that are based on inferring latent variables, yet which (a) are potentially correlated with the sensitive attributes and thus lead to bias, and (b) have weak capability in constructing latent representations and thus low prediction performance. Across various experiments, our method achieves state-of-the-art performance. Using a real-world case study from recidivism prediction, we further demonstrate that our method makes meaningful predictions in practice.

Introduction

In machine learning, ensuring fairness is critical for ethical and legal compliance. A rigorous standard for this is counterfactual fairness: a prediction is considered fair if it remains unchanged even if an individual's sensitive attribute (e.g., race or gender) were different, holding all other non-descendant factors constant. The primary obstacle is that counterfactuals are unobservable; we only observe factual data. Previous approaches often utilized Variational Autoencoders (VAEs) to infer latent variables. However, these methods suffer from a lack of identifiability—multiple latent representations can fit the same data but yield different counterfactuals, providing no guarantee of actual fairness.

Methodology: Generative Counterfactual Fairness Network (GCFN)

We propose GCFN, which shifts the focus from latent variables to "mediators"—variables causally influenced by sensitive attributes. The framework consists of two primary components:

  1. Counterfactual GAN Ensemble: We employ a specialized GAN architecture to learn the distribution of mediators. The generator $G$ produces counterfactual versions of the data, while the discriminator $D$ distinguishes between factual and generated samples. To account for counterfactual uncertainty, we train an ensemble of $s$ GANs and optimize against the "worst-case" (most unfair) generator.
  2. Counterfactual Mediator Regularization ($R_{cm}$): During predictor training, we introduce a novel regularization term. This term penalizes the model if its prediction $\hat{Y}$ shifts when the factual mediator $M$ is replaced by the GAN-generated counterfactual mediator $\hat{M}_{A'}$.
The GCFN architecture, illustrating the GAN ensemble for learning counterfactual mediators and the subsequent predictor training with regularization.

Mathematically, we prove that if the GAN accurately learns the counterfactual distribution, the resulting predictor is guaranteed to satisfy counterfactual fairness.

Experiments and Results

We evaluated GCFN across four datasets: synthetic data (with known ground truth), LSAC (bar exam prediction), UCI Adult (income prediction), and COMPAS (recidivism prediction).

Performance and Trade-offs

GCFN achieves state-of-the-art (SOTA) performance, particularly in the utility-fairness trade-off. On synthetic and semi-synthetic benchmarks, it outperforms VAE-based baselines like mCEVAE and DCEVAE by up to 30%.

Utility value $U$ versus utility weight $\gamma$ for various models, demonstrating GCFN's superior performance.

Real-World Impact: COMPAS

In the context of recidivism prediction using the COMPAS dataset, GCFN significantly reduced the False Positive Rate (FPR) for Black defendants from 41.98% to 35.19%. This improvement was achieved while maintaining higher overall accuracy compared to the original COMPAS scoring system, demonstrating the practical utility of our approach in sensitive domains.

Discussion and Conclusion

GCFN provides a robust, theoretically grounded framework for counterfactual fairness. By leveraging GANs and mediator regularization, it avoids the identifiability issues of latent-variable models. However, the method requires knowledge of the causal graph to distinguish between covariates and mediators. Future work will explore handling unobserved confounding factors that influence both sensitive attributes and outcomes.

Summary updated

BibTeX
@misc{ma2023counterfactual,
  author = {Yuchen Ma and Dennis Frauen and Valentyn Melnychuk and Stefan Feuerriegel},
  title = {{Counterfactual Fairness for Predictions using Generative Adversarial Networks}},
  year = {2023},
  eprint = {2310.17687},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.17687},
}
Figure