DiffExplainer: Towards cross-modal global explanations with diffusion models

Matteo Pennisi, Giovanni Bellitto, Simone Palazzo, Isaak Kavasidis, Mubarak Shah, Concetto Spampinato

Introduction

Deep neural networks (DNNs) have achieved remarkable performance in computer vision, yet they remain largely "black boxes." A critical challenge in deploying these models is their tendency to rely on spurious features—statistical shortcuts in training data that do not represent the actual object of interest. For instance, a classifier might identify a "padlock" based on the wooden texture of a door rather than the lock's geometry. While local explanation methods like Grad-CAM highlight specific regions in an input image, they fail to provide a global understanding of a model's learned concepts. Traditional global methods, such as Activation Maximization, often produce uninterpretable, noisy patterns. We present DiffExplainer, a framework that leverages Latent Diffusion Models (LDMs) to generate high-quality, human-interpretable global explanations.

Methodology

DiffExplainer bridges the gap between text and vision to synthesize interpretable explanations through a multi-step process:

  1. Text-Conditioned Optimization: Instead of optimizing raw pixels, which often leads to adversarial noise, DiffExplainer optimizes a "soft prompt" within the text embedding space. This prompt serves as the conditioning input for a Latent Diffusion Model.
  2. Activation Maximization: The framework performs gradient descent on the text embeddings to find a prompt that maximizes the activation of a target neuron or class output in a pre-trained classifier (e.g., ResNet-50).
  3. Efficiency via Latent Consistency Models (LCMs): To ensure the optimization loop is computationally feasible, DiffExplainer utilizes LCMs. This allows for high-quality image generation in fewer than 10 steps, significantly accelerating the explanation process compared to standard diffusion.
  4. Automated Bias Discovery: By combining the generated explanations with grounding models (DINO and SAM), the system can automatically flag biases. If a model shows high activation for a class but the grounding model fails to detect the actual object in the generated image, a spurious correlation is identified.

Experimental Setup and Datasets

The framework was evaluated using several benchmarks:

  • ImageNet: Used for training target classifiers, including Robust ResNet-50 and CaffeNet.
  • Salient ImageNet: Utilized to validate the automated detection of human-annotated spurious features.
  • FairFaces: Employed to demonstrate the identification of ethnicity-based biases in age-classification models.

Key Insights: Uncovering Model Biases

A significant advantage of DiffExplainer is its ability to reveal hidden associations. For example, when maximizing the activation for the "bee" class, the system frequently generates images of flowers rather than the insects themselves. This indicates that the classifier has learned a stronger association with the environment (flowers) than the primary subject (bees).

Figure 1: A global explanation for the 'bee' class, revealing a learned bias towards floral backgrounds rather than the insect itself.

Furthermore, the use of a joint text-image space allows for granular control. Researchers can prefix prompts with specific descriptors (e.g., "A texture of...") to isolate whether a neuron responds to geometric shapes or surface textures.

Results and Evaluation

DiffExplainer demonstrates a marked improvement over previous state-of-the-art global explanation methods.

  • Visual Fidelity: Unlike earlier methods that produced hallucinated or repetitive patterns, DiffExplainer generates realistic images that are easily interpreted by humans.
  • Human Preference: A user study involving 100 participants showed that DiffExplainer’s images were rated significantly higher (3.08/5) for their resemblance to model features compared to traditional feature attacks (2.40/5).
  • Bias Detection Accuracy: The system achieved over 80% agreement with human experts in identifying biased classes within the Salient ImageNet dataset.
Figure 6: A high-fidelity global explanation for the 'Kuvasz' dog breed, demonstrating the realistic visual quality achieved by DiffExplainer.

Conclusion and Future Work

DiffExplainer represents a significant step toward making DNNs more transparent. By using diffusion models as a "natural prior," it ensures that global explanations remain grounded in realistic visual concepts. While the method faces challenges such as convergence instability and potential ethical risks associated with the underlying diffusion model's training data, it provides a powerful tool for auditing and understanding complex AI systems. Future research will focus on improving optimization stability and implementing safeguards against inappropriate content generation.

Summary updated

BibTeX
@article{pennisi2024diffexplainer,
  author = {Matteo Pennisi and Giovanni Bellitto and Simone Palazzo and Isaak Kavasidis and Mubarak Shah and Concetto Spampinato},
  title = {{DiffExplainer: Towards cross-modal global explanations with diffusion models}},
  journal = {Comput. Vis. Image Underst.},
  year = {2024},
}
Figure