Explaining in Diffusion: Explaining a Classifier with Diffusion Semantics

Tahira Kazimi, Ritika Allada, Pinar YanardagCVPR 2025

Introduction

Deep learning classifiers have become indispensable across various domains, yet they remain largely "black boxes." While we can observe their final predictions, understanding the underlying reasoning—the specific visual attributes that drive a decision—is a persistent challenge in AI safety and trust. DiffEx is a novel, training-free framework designed to bridge this gap. By leveraging the generative power of text-to-image diffusion models and the descriptive capabilities of Vision-Language Models (VLMs), DiffEx generates hierarchical, semantically meaningful counterfactual images to explain classifier behavior.

The Interpretability Gap

Traditional explainability tools, such as saliency maps (e.g., Grad-CAM), typically highlight where a model is looking by generating heatmaps. However, they fail to explain what the model sees. For example, a heatmap might identify a bird's head as a region of interest, but it cannot distinguish whether the classifier's decision was based on the beak's shape, the eye's color, or the presence of a crest.

Existing state-of-the-art methods like StylEx attempt to solve this by using Generative Adversarial Networks (GANs) to create counterfactual images—showing how a prediction changes if an attribute is altered. However, GANs require intensive retraining for every new classifier, struggle with complex scenes, and often necessitate manual human labeling of the discovered attributes.

The DiffEx Framework

DiffEx bypasses these limitations by utilizing pre-trained foundation models. The framework operates through a three-step pipeline:

  1. VLM-Based Semantic Space: Instead of manual labeling, a VLM (like GPT-4) extracts a hierarchical list of attributes relevant to a specific domain. For instance, in the bird domain, it might define a hierarchy from Wings to Wing Pattern down to Spotted.
  2. Counterfactual Generation: Using an off-the-shelf editing tool (Ledits++), DiffEx modifies an input image based on these text attributes. It creates a "counterfactual" version of the image—such as the same bird but with spotted wings—to test the classifier's reaction.
  3. The DiffEx Algorithm: To efficiently navigate the vast space of possible attribute combinations, the authors employ a beam search-inspired algorithm. It ranks attributes by their impact on the classifier's confidence (logit) scores, "drilling down" into specific sub-types only when they show significant influence.
The DiffEx architecture: leveraging VLMs for semantic extraction and diffusion models for counterfactual generation to identify influential semantics.

Experimental Evaluation

The researchers evaluated DiffEx across a diverse array of datasets, demonstrating its versatility beyond simple object classification. These included facial analysis (CelebA), animal species (CUB-200-2011, Oxford-IIIT Pet), medical diagnostics (retinal fundus scans and skin lesions), and complex scene understanding (DeepFashion, Food-101).

DiffEx generates counterfactual explanations across diverse domains, including medicine, fashion, and wildlife, identifying the specific attributes that shift classifier confidence.

Key Insights and Results

  • Granular Explanations: DiffEx provides a fine-grained understanding of decisions. In facial analysis, it doesn't just identify a "beard" as influential; it can specify that a "Balbo beard" increases a perceived age score significantly more than a "full beard."
  • Complex Scene Capability: Unlike GAN-based methods, DiffEx handles multi-object scenes. It can explain a "fine dining" classification by identifying semantics like "plate decoration" or "caviar."
  • Joint Attribute Effects: The framework highlights how certain features only trigger a classifier when present together, such as the combined effect of specific makeup styles on age perception.
  • Superior Performance: In user studies, participants correctly identified the manipulated attribute 88.4% of the time with DiffEx, compared to 76.5% for StylEx and 53% for Grad-CAM. In medical contexts, it successfully identified clinically relevant features like "macular holes" that previous methods missed.

Discussion and Future Work

While highly effective, DiffEx's performance is tied to the quality of the VLM's initial semantic corpus. If a VLM lacks niche technical knowledge, the resulting explanations may be incomplete. Additionally, diffusion models can occasionally "leak" changes, where modifying one attribute slightly alters another (e.g., a hairband affecting hairstyle).

Future research aims to integrate Retrieval-Augmented Generation (RAG) to incorporate highly specialized domain knowledge, particularly for medical and technical applications, ensuring the semantic corpus is as robust as possible.

Summary updated

BibTeX
@inproceedings{kazimi2025explaining,
  author = {Tahira Kazimi and Ritika Allada and Pinar Yanardag},
  title = {{Explaining in Diffusion: Explaining a Classifier with Diffusion Semantics}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01379},
}
Figure