Source-linked AI summary

Diffusion Visual Counterfactual Explanations

Maximilian Augustin, Valentyn Boreiko, Francesco Croce, Matthias Hein

arXiv:2210.11841v1cs.CVcs.LG

TL;DR

Visual counterfactual explanations can help interpret image classifiers, but existing methods are constrained by realism, classifier coverage, or the number of classes they handle. DVCE uses diffusion with adaptive distance guidance and cone regularization to generate explanations for arbitrary ImageNet classifiers. The paper reports higher realism by FID and more meaningful target-class features in a user study than recent comparison methods.

  • Problem

    Existing visual counterfactual approaches may require adversarially robust classifiers, produce non-realistic changes, or be limited to few-class tasks or particular classifiers.

    Source: §1 · p. 2
  • Method

    DVCE guides a diffusion process with adaptive distance regularization and cone-projected classifier gradients through an adversarially robust model.

    Source: §1 · p. 2, §3.1 · p. 4, §3.2 · p. 6
  • Results

    DVCEs achieve higher realism according to FID and more meaningful target-class features in a user study than the recent methods and.

    Source: §1 · p. 2
  • Takeaways & Limitations

    DVCE can be applied to datasets for which both a generative diffusion model and an adversarially robust model are available.

    Source: §1 · p. 2

    Diffusion sampling can be costly for large numbers of explanations, deployment in time-sensitive settings is challenging, and DVCE relies on a robust model whose training can be difficult.

    Source: §5 · p. 10

Abstract

from arXiv · show

Visual Counterfactual Explanations (VCEs) are an important tool to understand the decisions of an image classifier. They are 'small' but 'realistic' semantic changes of the image changing the classifier decision. Current approaches for the generation of VCEs are restricted to adversarially robust models and often contain non-realistic artefacts, or are limited to image classification problems with few classes. In this paper, we overcome this by generating Diffusion Visual Counterfactual Explanations (DVCEs) for arbitrary ImageNet classifiers via a diffusion process. Two modifications to the diffusion process are key for our DVCEs: first, an adaptive parameterization, whose hyperparameters generalize across images and models, together with distance regularization and late start of the diffusion process, allow us to generate images with minimal semantic changes to the original ones but different classification. Second, our cone regularization via an adversarially robust model ensures that the diffusion process does not converge to trivial non-semantic changes, but instead produces realistic images of the target class which achieve high confidence by the classifier.

1 Introduction

The section frames visual counterfactual explanations as a way to inspect black-box image classifiers, but existing approaches face limitations in realism, classifier coverage, or scale. DVCE uses diffusion with adaptive distance guidance and cone regularization to generate explanations for arbitrary ImageNet classifiers.

1 Introduction

  • Counterfactual explanations provide a concrete input with a changed classification, allowing developers to test whether a model learned class-relevant features.Source: §1 · p. 1
  • Existing visual counterfactual methods are limited by non-semantic adversarial changes, dependence on robust classifiers, or restricted class and classifier coverage.Generative-model approaches can also produce realistic images that differ so much from the original that they provide little insight.Source: §1 · p. 2
  • DVCE generates explanations for arbitrary ImageNet classifiers using diffusion, with adaptive parameterization and distance guidance controlling similarity to the original image.The hyperparameters can be fixed across images and models.Source: §1 · p. 2
  • Cone regularization through an adversarially robust model guides diffusion away from trivial non-semantic changes toward realistic, high-confidence target-class images.Source: §1 · p. 2

2 Diffusion models

Diffusion models progressively add noise to data and learn a reverse process that reconstructs samples. For classifier-guided sampling, the section adapts that process to use classifier information while retaining tractable reverse transitions.

2 Diffusion models

  • The forward diffusion process adds noise until the data distribution approaches a normal prior, while the reverse process transforms the prior back toward the data distribution.A variance schedule defines the forward Markov chain, and q(x_t|x_0) can be sampled in closed form.Source: §2 · pp. 2–3
  • A neural network predicts the source noise εθ(x_t,t) to parameterize the reverse process, and training combines a denoising-style loss with a variational-bound loss for learning the covariance.Source: §2 · p. 3

2.1 Class conditional sampling

  • Class-unconditional diffusion lets the classifier supply class-conditional information; for an ordinary classifier, the method evaluates it on a denoised estimate of the noisy sample.The denoised estimate is mapped from x_t using the diffusion model's predicted noise.Source: §2.1 · p. 3
  • Because each sample requires hundreds of reverse transitions, the method approximates classifier-guided transitions with shifted versions of the original diffusion transitions for closed-form sampling.The adapted transition kernels are used to generate VCEs.Source: §2.1 · pp. 3–4

3 Diffusion Visual Counterfactual Explanations

DVCEs use diffusion to produce valid, realistic counterfactual images with minimal semantic changes, including for arbitrary classifiers. The method adapts diffusion guidance to preserve proximity to the original image and uses cone projection for non-robust classifiers.

3 Diffusion Visual Counterfactual Explanations

  • DVCEs use diffusion to generate realistic counterfactuals for arbitrary classifiers, targeting validity, realism, and minimal semantic change.The image should be classified as the target class while remaining close to the original, with changes such as altering the object while leaving the background unchanged.Source: §3 · p. 4

3.1 Adaptive Parameterization

  • Adaptive parameterization, l1-distance regularization, and starting at step T/2 yield sparse but semantically meaningful changes with parameters that generalize across images and classifiers.The same Cc = 0.1 and Cd = 0.15 work across images and classifiers, unlike Blended Diffusion's image-specific tuning.Source: §3.1 · pp. 4–5, Figure 2 · p. 5

3.2 Cone Projection for Classifier Guidance

  • For non-robust classifiers, cone projection uses a robust classifier's gradient within a cone centered on the target classifier's gradient, regularizing noisy guidance toward semantic changes.For cone angles below 90°, the projected gradient remains an ascent direction for the target classifier's log probability.Source: §3.2 · pp. 5–6

3.3 Final Scheme for Diffusion Visual Counterfactuals

  • The final scheme replaces the diffusion algorithm's update step with the guided mean update, omitting cone projection for robust classifiers and using it for non-robust classifiers.Experiments fix Cc = 0.1, Cd = 0.15, and the cone angle α = 30° unless parameter ablations are shown.Source: §3.3 · p. 6

4 Experiments

The experiments compare DVCEs with existing VCE methods and test them across robust and non-robust ImageNet classifiers. DVCEs perform well on the stated VCE criteria, with trade-offs in closeness and stronger user ratings for meaningful changes.

4.1 Comparison of Methods for VCE Generation

  • DVCEs alone satisfy all desired VCE properties in the qualitative comparison, preserving the bowl while changing mashed potato into guacamole or carbonara.The same DVCE hyperparameters handle different classes, similar classes, and different object sizes.Source: §4.1 · p. 7, Figure 4 · p. 7
  • BDVCEs can miss high target confidence or produce unrealistic or distant images, while l1.5-SVCEs often need large radii that yield unrealistic images.The comparison also notes artifacts and lower image quality in l1.5-SVCEs.Source: §4.1 · pp. 7–8, Figure 4 · p. 7
  • In a 20-user study, DVCEs score 62.0% meaningful, 34.7% realistic, and 45.0% subtle, versus 48.4%, 24.6%, and 50.6% for l1.5-SVCEs and 38.7%, 52.2%, and 31.0% for BDVCEs.The authors attribute the realism-rating difference from quantitative evaluation to users judging realism regardless of whether the target class is shown.Source: §4.1 · p. 8
  • DVCEs are the most realistic method by Avg. FID, have validity comparable to l1.5-SVCEs, make larger changes than SVCEs, and outperform BDVCEs across metrics.The comparison reports DVCEs as worse than l1.5-SVCEs in closeness; BDVCEs are worst in all categories.Source: Table 1 · p. 8, §4.1 · p. 8

4.2 Model comparison

  • DVCEs are demonstrated for Swin-TF, ConvNeXt, and EfficientNet using cone projection with a robust model, and the authors report that they satisfy the desired VCE properties.The examples suggest classifiers use different prominent roof and tower structures for stupa and church classes.Source: §4.2 · p. 8, Figure 5 · p. 9
  • Three multiple-norm robust models produce similarly good DVCEs with classifier-specific semantic changes, including robust transformers.The compared models are MNR-RN50, MNR-XCiT, and MNR-DeiT; Figure 6 shows them without cone projection.Source: §4.2 · p. 8, Figure 6 · p. 10

5 Limitations, Future Work and Societal impact

The paper identifies practical and methodological constraints on DVCEs and points to open evaluation and deployment challenges.

5 Limitations, Future Work and Societal impact

  • Multiple reverse-process iterations make diffusion expensive per sample, challenging deployment in time-sensitive settings.The issue is especially relevant when generating many VCEs.Source: §5 · p. 10
  • DVCE creation relies on a robust model for cone projection, while training robust models can be challenging.The authors suggest replacing cone projection with another procedure to denoise gradients from non-robust models.Source: §5 · p. 10
  • Quantitative VCE evaluation remains difficult because FID does not capture validity and meaningful changes, while VAE-based metrics are hard to scale to 1,000 classes and high-resolution images.The paper describes its Tab. 1 evaluation as a first step toward improved metrics.Source: §5 · p. 10

6 Conclusion

The conclusion presents DVCEs as a diffusion-based approach for generating VCEs across state-of-the-art ImageNet classifiers. It reports that they handle diverse images and satisfy the desired VCE properties.

6 Conclusion

  • DVCEs use diffusion models and cone projection to create VCEs for state-of-the-art ImageNet classifiers.Source: §6 · p. 10
  • DVCEs handle varied image configurations, object sizes, and classes.Source: §6 · p. 10
  • The authors report that DVCEs satisfy all desired properties of VCEs.Source: §6 · p. 10

Checklist

The checklist records the paper's reproducibility and ethics disclosures, while the appendix overview maps additional experiments and materials.

Checklist

  • The authors state that code is included in supplemental material and that ImageNet and ImageNet21k are public datasets.They point to the supplement for reproducing results and to Appendix D for compute resources.Source: Checklist · p. 14
  • The paper reports that user-study results and participant instructions are in Appendix C, with participant compensation details also referenced there.Source: Checklist · p. 14

Overview of Appendix

  • The appendix covers regularization, diffusion start time, diversity, robustness, cone-projection angle, user-study results, quantitative evaluation, spurious features, and failure cases.Source: Overview of Appendix · p. 15

B Ablation study of DVCEs

The ablation varies the l1-distance regularization weight for DVCEs generated for a non-robust Swin-TF with cone projection. A weight of 0.15 is selected as a trade-off between closeness to the original and realism.

B.1 Regularization

  • Cd = 0.15 gives a good trade-off between closeness to the original image and realism while retaining meaningful target-class features.The study varies the l1-distance regularization strength from 0.05 to 0.25 and uses 0.15 for the remaining evaluation.Source: §B.1 · p. 15, Figure 7 · p. 15

B.2 Starting Tstart

The ablations examine diffusion start time, stochastic diversity, robust-model choice, and cone angle. They select η = 0.5 and a 30° cone angle, while reporting meaningful, high-confidence DVCEs across robust-model choices.

B.2 Starting Tstart

  • η = 0.5 gives a good trade-off among closeness, realism, and target-class features, so it is used throughout the experiments.The compared start times are η ∈ {0.25, 0.5, 0.75}.Source: §B.2 · pp. 15–16, Figure 8 · p. 16

B.3 Diversity

  • Different random seeds produce subtle variations in DVCEs for the same starting image, consistent with the stochastic diffusion process.The examples use the non-robust Swin-TF with cone projection and the paper’s standard parameters.Source: §B.3 · p. 16, Figure 9 · p. 16

B.4 Different robust models

  • Across robust-model choices, non-robust classifiers retain high target-class confidence and meaningful target-specific changes, with DVCE variation small and comparable to seed variation.The comparisons include three robust and three non-robust models; the robust models are fine-tuned for multiple-norm adversarial robustness.Source: §B.4 · p. 16, Figure 10 · p. 17, Figure 11 · p. 18

B.5 Cone projection

  • Cone angles of at least 30° yield class-specific features in all shown images, and 30° is fixed to keep the direction close to the target model’s gradient.Angles at or below 15° often fail to produce class-specific features.Source: §B.5 · p. 19, Figure 12 · p. 20

C User study

The user study compares DVCEs, l1.5-SVCEs, and BDVCEs on meaningfulness, realism, and subtlety. DVCEs lead on meaningful changes, while each method has a different strength across the three criteria.

C User study

  • Twenty volunteer researchers rated 44 VCEs for meaningful target-class features, realism, and subtle but understandable changes.They viewed original images and VCEs from the three methods in random order; participants had not previously seen the generated VCEs and did not work on VCEs.Source: C User study · p. 21, Figure 13 · p. 21
  • DVCEs are rated meaningful in 62.0% of cases, versus 48.4% for l1.5-SVCEs and 38.7% for BDVCEs; BDVCEs lead realism and l1.5-SVCEs lead subtlety.The respective realism ratings are 34.7%, 24.6%, and 52.2%; subtlety ratings are 45.0%, 50.6%, and 31.0%.Source: C User study · pp. 21–22

D Resources and hardware used

  • Generating a batch of six DVCEs with cone projection took five minutes on Tesla V100 GPUs, compared with three minutes without cone projection.The cone-projection batch required loading an additional model and calculating its gradient.Source: D Resources and hardware used · p. 22

E Quantitative evaluation

The quantitative evaluation compares realism, validity, and closeness using a crossover FID procedure and other metrics. DVCEs stand out on realism while remaining similarly valid to l1.5-SVCEs, with a closeness trade-off.

E Quantitative evaluation

  • DVCEs achieve an FID score of 17.6, compared with 27.9 for BDVCEs and 25.6 for l1.5-SVCEs.The crossover evaluation divides WordNet-cluster classes into disjoint sets and evaluates target classes from the opposite set.Source: E Quantitative evaluation · p. 26
  • DVCEs have similar validity to l1.5-SVCEs, while BDVCEs have significantly lower mean target-class confidence.Validity is measured as the mean classifier confidence on VCEs for the selected target classes.Source: E Quantitative evaluation · p. 26
  • l1.5-SVCEs outperform DVCEs and BDVCEs on l_p distances because they directly modify the image without a generative model.Closeness is assessed with l1, l1.5, l2, and AlexNet LPIPS metrics.Source: E Quantitative evaluation · p. 26
  • Qualitative and quantitative results show DVCEs and l1.5-SVCEs are equally valid, while DVCEs significantly outperform all other approaches in image quality (realism) and remain close to the original images.Source: E Quantitative evaluation · p. 26

F Spurious features

DVCEs serve as a debugging tool by reproducing known spurious features and revealing additional class-linked cues in ImageNet classifiers. They can also be blurry or fail when the target-class change is difficult to realize.

F Spurious features

  • DVCEs reproduce ’s white-shark cage and tench human-feature cues, while granny-smith text appears for MNR-RN50 but not Swin-TF or ConvNeXt.The paper links the shark and tench cues to training-set image co-occurrences; the possible role of ImageNet-22k pretraining for the granny-smith difference needs further analysis.Source: Figure 15 · p. 27, F Spurious features · pp. 27–28
  • DVCEs reveal flower cues for “bee” and tiger-face cues for “tiger cat”; the authors connect these patterns to ImageNet training images, including tiger images in the “tiger cat” class.The “bee” counterfactuals emphasize flowers rather than the bee itself.Source: F Spurious features · p. 28

G Failure cases

  • DVCEs can be blurry or fail when the original image is dissimilar to the target class, making the required change difficult to realize.The paper reports these as two general failure cases; blurriness also occurs for BDVCEs.Source: G Failure cases · p. 29
Loading 2210.11841v1…