Skip to main content
QUICK REVIEW

[Paper Review] Latent Diffusion Counterfactual Explanations

Karim Farid, Simon Schrodi|arXiv (Cornell University)|Oct 10, 2023
Adversarial Robustness in Machine LearningComputer Science3 citations
TL;DR

This paper introduces Latent Diffusion Counterfactual Explanations (LDCE), a model- and dataset-agnostic method that leverages class- or text-conditional foundation latent diffusion models to generate high-quality, semantically meaningful counterfactual images. By employing a novel consensus guidance mechanism that filters adversarial gradients using the diffusion model’s implicit classifier, LDCE avoids reliance on auxiliary robust models or computationally expensive guidance, enabling efficient, realistic counterfactual generation across diverse classifiers and datasets without requiring access to training data.

ABSTRACT

Counterfactual explanations have emerged as a promising method for elucidating the behavior of opaque black-box models. Recently, several works leveraged pixel-space diffusion models for counterfactual generation. To handle noisy, adversarial gradients during counterfactual generation -- causing unrealistic artifacts or mere adversarial perturbations -- they required either auxiliary adversarially robust models or computationally intensive guidance schemes. However, such requirements limit their applicability, e.g., in scenarios with restricted access to the model's training data. To address these limitations, we introduce Latent Diffusion Counterfactual Explanations (LDCE). LDCE harnesses the capabilities of recent class- or text-conditional foundation latent diffusion models to expedite counterfactual generation and focus on the important, semantic parts of the data. Furthermore, we propose a novel consensus guidance mechanism to filter out noisy, adversarial gradients that are misaligned with the diffusion model's implicit classifier. We demonstrate the versatility of LDCE across a wide spectrum of models trained on diverse datasets with different learning paradigms. Finally, we showcase how LDCE can provide insights into model errors, enhancing our understanding of black-box model behavior.

Motivation & Objective

  • To address the limitations of existing counterfactual explanation methods that rely on adversarially robust models or complex guidance schemes, which restrict applicability in data-private settings.
  • To enable efficient, high-quality counterfactual generation across diverse classifiers and datasets without requiring access to the target model’s training data.
  • To filter out noisy, adversarial gradients during counterfactual generation by leveraging the implicit classifier of a foundation diffusion model.
  • To decouple semantic-level changes from pixel-level noise using latent diffusion, ensuring counterfactuals are both semantically meaningful and visually realistic.
  • To provide interpretable insights into black-box model behavior by generating counterfactuals that reveal model decision boundaries.

Proposed method

  • LDCE uses a pre-trained, class- or text-conditional latent diffusion model to generate counterfactual images in the latent space, decoupling semantic content from pixel-level details.
  • It introduces a consensus guidance mechanism that aligns gradients from the target classifier with those from the diffusion model’s implicit classifier to suppress adversarial perturbations.
  • The method optimizes for a counterfactual image by minimizing a loss combining classifier loss (to achieve target prediction) and a distance term (to preserve closeness to the original input).
  • The consensus mechanism computes a weighted average of gradients from the target model and the diffusion model’s implicit classifier, filtering out misaligned, noisy gradients.
  • Counterfactual generation is performed in the latent space of the diffusion model, enabling faster inference and better disentanglement of semantic and pixel-level changes.
  • The approach is agnostic to the target model’s learning paradigm (supervised, self-supervised) and only limited by the domain coverage of the foundation diffusion model.
(a) alp $\rightarrow$ coral reef on ImageNet with ResNet-50
(a) alp $\rightarrow$ coral reef on ImageNet with ResNet-50

Experimental results

Research questions

  • RQ1Can counterfactual explanations be generated efficiently and robustly without requiring access to the target model’s training data or auxiliary robust models?
  • RQ2Can a foundation diffusion model’s implicit classifier be effectively used to filter adversarial gradients during counterfactual generation?
  • RQ3To what extent can LDCE generate semantically meaningful, realistic counterfactuals across diverse datasets and learning paradigms?
  • RQ4How does LDCE compare to existing methods in terms of counterfactual quality, realism, and proximity to the original input?
  • RQ5What are the failure modes of LDCE, and can they be mitigated through hyperparameter tuning or architectural improvements?

Key findings

  • LDCE successfully generates high-quality, semantically meaningful counterfactual images across diverse datasets, including ImageNet, CelebA HQ, Oxford Pets, and Oxford Flowers 102, using only the classifier’s gradients and the diffusion model’s implicit classifier.
  • The consensus guidance mechanism effectively filters out adversarial gradients, preventing the generation of unrealistic artifacts or adversarial perturbations.
  • LDCE achieves model- and dataset-agnostic counterfactual generation, requiring no fine-tuning of the target classifier and no access to its training data.
  • The method significantly reduces reliance on computationally intensive guidance schemes or auxiliary robust models, enabling faster and more scalable counterfactual generation.
  • Failure modes such as blurriness, distorted faces, and large distances to the target class are observed, particularly in complex scenes or with multiple objects, but are attributed to limitations in the foundation diffusion model rather than the core method.
  • Hyperparameter tuning—such as increasing classifier strength and reducing distance strength—can mitigate large distance failures, though at the cost of increased deviation from the original input.
(b) no-smile $\rightarrow$ smile on CelebA HQ with DenseNet-121
(b) no-smile $\rightarrow$ smile on CelebA HQ with DenseNet-121

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.