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

Explaining an Image Classifier with a Generative Model Conditioned by Uncertainty

Adrien Le-Coz, Stéphane Herbin, Faouzi AdjedPKDD/ECML Workshops 2023

Abstract

We propose to condition a generative model by a given image classifier uncertainty in order to analyze and explain its behavior. Preliminary experiments on synthetic data and a corrupted version of MNIST dataset illustrate the idea.

Introduction

Deep learning image classifiers are notoriously opaque. While they perform well, identifying the specific conditions under which they are likely to fail remains a challenge. Traditional explainability methods, such as saliency maps, are typically post-hoc and explain single predictions.

This research addresses the need for a global understanding of a classifier's failure modes. Instead of analyzing why a model failed on a specific image, we ask: "What kind of images, in general, make this model fail?" By treating uncertainty as a measure of potential failure, we aim to describe the nature of uncertain data for a given classifier.

Methodology

The core of the proposed method is a generator of uncertain data. We utilize a StyleGAN2 architecture modified to function as a conditional GAN.

The proposed training architecture for the uncertainty-conditioned GAN, showing the flow from real images through a frozen classifier to the generator and discriminator.

The Training Pipeline

  1. Frozen Classifier: We utilize a pre-trained image classifier with its weights frozen to serve as the reference for uncertainty.
  2. Conditioning Inputs: The generator is fed three distinct inputs: a noise vector (for visual variety), a class label (to specify the target object), and a target Maximum Softmax Probability (MSP) value. MSP is used as a proxy for the classifier's confidence.
  3. Discriminator Training: During training, the discriminator evaluates whether the combination of the generated image, class label, and MSP is realistic. To ensure the GAN learns the classifier's specific "worldview," the MSP values used during training are those actually produced by the frozen classifier on real images.

Once trained, a user can "dial in" a specific confidence level (e.g., MSP = 0.7) to generate an infinite stream of images that the classifier finds difficult, revealing the specific visual attributes—like blur, noise, or ambiguous shapes—that trigger model uncertainty.

Experimental Results

Synthetic "Moons" Data

As a proof-of-concept, the model was tested on a synthetic 2D dataset consisting of two interleaving half-circles. This experiment demonstrated that the generator could successfully capture areas where classes physically overlap, effectively capturing aleatoric uncertainty.

Visualization of the synthetic Moons dataset, where point colors represent the classifier's Maximum Softmax Probability (MSP).

Corrupted MNIST

The approach was further evaluated on the MNIST dataset of handwritten digits. To simulate realistic failure modes, a corrupted MNIST variant was created by adding Gaussian blur and noise to half of the images.

On clean MNIST, the model generated clear digits for high MSP and slightly deformed ones for lower MSP. On the corrupted variant, the results were more striking: images generated with a low MSP condition (0.7) were visibly plagued by the specific corruptions (blur and noise) that the classifier struggled with. While the correlation between requested and actual MSP was lower on MNIST than on the synthetic data, a clear trend remained: high MSP requests yielded high-confidence predictions, while low MSP requests resulted in a wider, lower-confidence distribution.

Discussion and Limitations

By making uncertainty an input to the generative model, we turn a potential weakness (model failure) into a feature—a searchable space of failure modes. This provides a "global" view of model behavior while also allowing for "local" understanding by observing how a specific digit style must change to confuse the classifier.

However, several limitations persist:

  • MSP as a Proxy: Maximum Softmax Probability is an imperfect measure of uncertainty. Future work could involve conditioning on the full softmax vector or more robust metrics.
  • Calibration: If the classifier is poorly calibrated (overconfident), the GAN will learn to generate "certain-looking" images that are actually incorrect.
  • Complexity: Scaling this to complex datasets like ImageNet would require significantly more computational power and more sophisticated conditioning strategies, such as adding loss terms to force the generated image's actual MSP to match the input condition more strictly.

Summary updated

BibTeX
@inproceedings{lecoz2023explaining,
  author = {Adrien Le-Coz and Stéphane Herbin and Faouzi Adjed},
  title = {{Explaining an Image Classifier with a Generative Model Conditioned by Uncertainty}},
  booktitle = {PKDD/ECML Workshops},
  year = {2023},
  url = {https://openreview.net/forum?id=9I5EOZwUDB},
}
Figure