Skip to main content
QUICK REVIEW

[Paper Review] Diffusion Models for Counterfactual Explanations

Guillaume Jeanneret, Loïc Simon|arXiv (Cornell University)|Mar 29, 2022
Cell Image Analysis TechniquesBiochemistry, Genetics and Molecular Biology7 citations
TL;DR

This paper proposes DiME, a novel method that leverages pre-trained diffusion models to generate counterfactual explanations for image classifiers without fine-tuning. By guiding the diffusion process using classifier gradients, DiME produces realistic, diverse, and minimally perturbed counterfactual images that outperform prior state-of-the-art methods on five out of six metrics on the CelebA dataset, while introducing a new metric, Correlation Difference, to better evaluate spurious correlation detection.

ABSTRACT

Counterfactual explanations have shown promising results as a post-hoc framework to make image classifiers more explainable. In this paper, we propose DiME, a method allowing the generation of counterfactual images using the recent diffusion models. By leveraging the guided generative diffusion process, our proposed methodology shows how to use the gradients of the target classifier to generate counterfactual explanations of input instances. Further, we analyze current approaches to evaluate spurious correlations and extend the evaluation measurements by proposing a new metric: Correlation Difference. Our experimental validations show that the proposed algorithm surpasses previous State-of-the-Art results on 5 out of 6 metrics on CelebA.

Motivation & Objective

  • To develop a post-hoc counterfactual explanation method that generates realistic, minimal, and diverse perturbations for image classifier decisions.
  • To leverage the inherent properties of diffusion models—such as stochasticity and multi-level latent spaces—for generating semantically meaningful counterfactual edits.
  • To address the limitations of existing evaluation metrics by introducing a new metric, Correlation Difference, to better detect subtle spurious correlations in counterfactual explanations.
  • To demonstrate that unconditional diffusion models can be effectively repurposed for counterfactual explanation without retraining or conditional fine-tuning.

Proposed method

  • DiME employs a pre-trained, unconditional denoising diffusion probabilistic model (DDPM) to generate counterfactual images by guiding the reverse denoising process using gradients from a target classifier.
  • The method applies classifier gradients to the latent space of the diffusion model at multiple denoising steps, enabling semantic edits that shift the model’s prediction while preserving image structure.
  • A perceptual loss component is integrated to improve image fidelity, ensuring generated counterfactuals remain realistic and perceptually plausible.
  • The approach avoids retraining or conditioning the diffusion model on counterfactual data, relying instead on gradient-guided sampling from a single pre-trained model.
  • The method is evaluated using standard metrics (FID, FVA, MNAC) and a new metric, Correlation Difference, to assess both image quality and spurious correlation detection.
  • Ablation studies are conducted to analyze the impact of noise level initialization and loss weighting, validating the design choices in the generation pipeline.
Figure 1 : DiME: Di ffusion M odels for Counterfactual E xplanations. Given an input instance $x$ , we perturb it following Eq. 2 to get $z_{\tau}$ (here $\tau=5$ ). At time step $t$ , we use the DDPM model to generate a clean image $x_{t}$ to obtain the clean gradient $L_{class}$ and $L_{perc}$ wit
Figure 1 : DiME: Di ffusion M odels for Counterfactual E xplanations. Given an input instance $x$ , we perturb it following Eq. 2 to get $z_{\tau}$ (here $\tau=5$ ). At time step $t$ , we use the DDPM model to generate a clean image $x_{t}$ to obtain the clean gradient $L_{class}$ and $L_{perc}$ wit

Experimental results

Research questions

  • RQ1Can pre-trained diffusion models be effectively repurposed for generating high-quality, realistic counterfactual explanations without fine-tuning?
  • RQ2How does the guided diffusion process using classifier gradients compare to existing conditional generation or adversarial methods in terms of counterfactual quality and diversity?
  • RQ3To what extent do current evaluation metrics like FID and MNAC accurately reflect the ability of counterfactuals to detect spurious correlations?
  • RQ4Can a new metric, Correlation Difference, better capture subtle spurious correlations in counterfactual explanations than existing approaches?

Key findings

  • DiME achieves state-of-the-art performance on five out of six metrics on the CelebA dataset, surpassing previous methods in FID, FVA, and MNAC for the 'Smile' attribute, and in FID and MNAC for the 'Young' attribute.
  • The proposed Correlation Difference metric reveals that existing metrics like MNAC can give a false sense of correctness, as they may not detect subtle spurious correlations in counterfactuals.
  • The ablation study shows that the unimpaired version of DiME significantly outperforms naive and direct gradient-guided baselines in terms of both fidelity and faithfulness, validating the importance of the proposed refinement in the guided diffusion process.
  • Despite the high computational cost—requiring ~1800 forward passes per counterfactual—DiME generates diverse, semantically meaningful edits, such as changing facial expressions or age appearance, while preserving structural consistency.
  • Qualitative results demonstrate that DiME produces perceptually tangible changes, such as altering smiles or age, while maintaining the original identity and structure, even on out-of-distribution elements like hands or pendants.
  • The unconditional FID is higher than DiME’s, indicating that the perceptual loss and guided generation improve image quality beyond what unconditional sampling achieves.
Figure 2 : Diversity Counterfactual examples. The classifier predicts first two input images as non-smiley and the last two as smiley. In this example all explanations fool the classifier. Our CE pipeline is capable of synthesising diverse counterfactuals without any additional mechanism.
Figure 2 : Diversity Counterfactual examples. The classifier predicts first two input images as non-smiley and the last two as smiley. In this example all explanations fool the classifier. Our CE pipeline is capable of synthesising diverse counterfactuals without any additional mechanism.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.