Generative Counterfactual Introspection for Explainable Deep Learning

Shusen Liu, Bhavya Kailkhura, Donald Loveland, Yong Han

Abstract

Deep neural networks are often viewed as black boxes, providing predictions without clear causal explanations. This paper presents a framework for Generative Counterfactual Introspection, leveraging Generative Adversarial Networks (GANs) to produce realistic, semantically meaningful counterfactual images. By identifying the minimal changes required to alter a model's prediction, the proposed method moves beyond traditional heatmap-based explanations toward actionable insights and bias detection. The approach is validated on MNIST and CelebA datasets, demonstrating its ability to reveal hidden model biases and provide intuitive decision-boundary visualizations.

Introduction

While deep learning has achieved remarkable success across various domains, the lack of interpretability remains a significant hurdle for deployment in high-stakes environments like medicine or scientific research. Existing Explainable AI (XAI) methods, such as Grad-CAM or LIME, primarily focus on identifying pixel-level correlations (heatmaps). However, these tools often fail to explain why a decision was reached or how a different outcome could be achieved—a concept known as causation.

Furthermore, simple pixel perturbations intended to probe model behavior often result in "adversarial examples"—noise that is imperceptible to humans but flips a classifier's label. This paper addresses these gaps by introducing a framework that generates "counterfactuals": realistic, modified images that demonstrate exactly what features must change to alter a model's prediction.

Methodology

The core of the proposed approach is Generative Counterfactual Introspection. Instead of modifying pixels directly, the framework operates within the latent space of a pre-trained generative model.

Overview of the Generative Counterfactual Introspection framework.

Generative Foundation

The authors utilize GANs (specifically DCGAN for digits and AttGAN for faces) to ensure that all modifications remain on the "data manifold." This ensures that the resulting counterfactuals look like real data rather than noisy artifacts.

Prototypes and Criticisms

The framework identifies two types of modified images:

  • Prototypes: These are versions of the input image that make the classifier more confident in its original prediction, representing the "quintessential" version of a class.
  • Criticisms: These images lie near the decision boundary, showing the minimal semantic change needed to flip the prediction to a target class.

Optimization

The system solves a minimal change problem using gradient descent. It seeks the smallest adjustment to the image's attributes or latent vector that satisfies the target classification while maintaining realism through a distance-based regularization term.

Experimental Results

MNIST: Morphing Decision Boundaries

On the MNIST dataset, the framework was used to test how the model perceives the transition between handwritten digits. By optimizing the latent space, the model generates a path showing how one digit morphs into another.

As seen in the figure above, to turn a '9' into a '2', the model often morphs the digit through a '0' shape first. This reveals the classifier's internal logic regarding shape similarity and the structure of its decision boundaries.

CelebA: Revealing Dataset Bias

Using the CelebA dataset, the researchers explored "actionable knobs" such as age, hair color, and accessories. A key insight emerged when investigating age classification. When the system was tasked with making a "young" face look "old" to the classifier, it consistently added eyeglasses.

Further investigation of the training data confirmed a significant bias: the "old" population in the CelebA dataset has a much higher frequency of eyeglasses than the "young" population. The counterfactual introspection successfully revealed that the classifier was using eyeglasses as a shortcut for age detection rather than relying on actual facial features.

Discussion and Future Work

While powerful, the framework's effectiveness is tied to the quality of the underlying GAN. If the generative model cannot represent certain features, the explanations may be limited. Additionally, the non-convex nature of the optimization problem can occasionally lead to local minima.

Future research will focus on applying these "actionable knobs" to scientific domains, such as material discovery. In these fields, counterfactual changes can correspond to physical experimental parameters, allowing scientists to understand exactly which variables to manipulate in a laboratory setting to achieve a desired outcome.

Summary updated

BibTeX
@inproceedings{liu2019generative,
  author = {Shusen Liu and Bhavya Kailkhura and Donald Loveland and Yong Han},
  title = {{Generative Counterfactual Introspection for Explainable Deep Learning}},
  booktitle = {GlobalSIP},
  year = {2019},
  doi = {10.1109/globalsip45357.2019.8969491},
}
Figure