Evaluating and Mitigating Bias in Image Classifiers: A Causal Perspective Using Counterfactuals

Saloni Dash, Vineeth N. Balasubramanian, Amit Sharma

Abstract

Machine learning models often inherit and amplify societal biases, leading to unfair outcomes for marginalized groups. This paper introduces ImageCFGen, a framework designed to generate high-quality counterfactual images that respect the underlying causal relationships between attributes. By leveraging Structural Causal Models (SCMs) and a novel generative architecture, the authors provide a robust methodology to detect, explain, and mitigate hidden biases in image classifiers. Experimental results on CelebA demonstrate a significant reduction in bias while maintaining high classification accuracy.

Introduction

To evaluate if a classifier is truly fair, researchers frequently employ counterfactual reasoning: if a sensitive attribute (such as skin tone) were changed while keeping all other factors constant, would the model's prediction remain the same? However, generating such images is technically challenging. Standard Generative Adversarial Networks (GANs) often struggle to isolate specific features without altering identity or violating causal dependencies (e.g., changing 'age' should logically influence 'gray hair'). ImageCFGen addresses these hurdles by integrating causal logic directly into the image generation process.

The ImageCFGen Framework

The authors propose a three-step approach based on Judea Pearl’s "Ladder of Causation":

  1. Abduction (Inference): An encoder infers the latent "style" and "content" ($z$) of an existing image.
  2. Action (Intervention): A specific attribute is modified (e.g., setting a binary attribute for skin tone).
  3. Prediction (Generation): A Structural Causal Model (SCM) updates any downstream attributes affected by the intervention. Finally, a generator creates the counterfactual image ($x_c$) using the original latent $z$ and the updated attribute set.
The ImageCFGen architecture: An encoder infers latent variables, an SCM updates attributes based on interventions, and a generator produces the counterfactual image.

Technical Innovation: Cyclic Style ALI (CSALI)

To ensure high image quality and identity preservation, the authors developed Cyclic Style ALI (CSALI). This framework integrates StyleGAN components and a cyclic cost minimization (reconstruction loss). This ensures that the reconstructed version of an original image remains nearly identical to the source, providing a stable baseline for counterfactual comparison.

Experimental Evaluation

The framework was tested on two primary datasets:

  • Morpho-MNIST: A modified digit dataset with causal attributes like stroke thickness, intensity, and slant, used as a sanity check for causal logic.
  • CelebA: A large-scale dataset of 200,000 faces with 40 attributes, used to evaluate complex, real-world features.
Counterfactual generation on Morpho-MNIST: Interventions on thickness (t), intensity (i), slant (s), and length (l) demonstrate the model's ability to isolate specific causal factors.

ImageCFGen outperformed previous SCM-based methods like DeepSCM in generating realistic counterfactuals. On CelebA, the CSALI model achieved a Fréchet Inception Distance (FID) of 21.269, a substantial improvement over the vanilla ALI baseline of 67.133.

Bias Mitigation Strategy

The paper introduces a counterfactual regularizer to mitigate identified biases. During training, the classifier is penalized if its prediction for an original image differs from its prediction for that image's counterfactual. This forces the model to achieve invariance toward sensitive attributes.

In a test case involving an "attractiveness" classifier, the authors found significant bias: the model was far more likely to label a face as attractive if the counterfactual had "Pale Skin." By applying the counterfactual regularizer, they reduced the bias score for "Pale Skin" from 0.159 to 0.032—an 80% reduction—while maintaining an overall classification accuracy of approximately 82%.

Conclusion

ImageCFGen demonstrates that causality is non-negotiable for meaningful bias evaluation. By ensuring that counterfactuals are both visually realistic and causally consistent, the framework provides a powerful tool for building fairer AI systems. Future work will focus on refining causal graphs for more complex social attributes and improving the modeling of attributes where social perceptions are inconsistent.

Summary updated

BibTeX
@inproceedings{dash2022evaluating,
  author = {Saloni Dash and Vineeth N. Balasubramanian and Amit Sharma},
  title = {{Evaluating and Mitigating Bias in Image Classifiers: A Causal Perspective Using Counterfactuals}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2022},
  doi = {10.1109/wacv51458.2022.00393},
}
Figure