Towards Desiderata-Driven Design of Visual Counterfactual Explainers

Sidney Bender, Jan Herrmann, Klaus Robert Muller, Grégoire Montavon

TL;DR

Visual counterfactual explainers (VCEs) show how to alter an image to change a classifier's prediction, but current methods often produce imperceptible or adversarial tweaks instead of meaningful explanations. This paper introduces the Smooth Counterfactual Explorer (SCE), a framework designed around core explanation desiderata: fidelity, understandability, and sufficiency. By smoothing classifier gradients and enforcing diverse, sparse updates, SCE generates robust, human-interpretable counterfactual images that reveal the true global strategies of a model.

What Problem Does This Paper Address?

Visual counterfactual explainers answer the question: "What is the minimum change needed to flip this model's prediction (e.g., from 'blond' to 'non-blond')?"

Traditionally, VCEs optimize for two primary criteria: keeping the generated image realistic (staying on the data manifold) and minimizing the distance of the change. However, the authors argue this approach is fundamentally flawed for explainability. Minimizing pixel-level distance often exploits fragile, spurious local variations in the model's decision boundary—essentially creating adversarial perturbations rather than finding semantically meaningful features. Furthermore, existing methods fail to provide diverse alternative explanations (sufficiency) or truly concise ones (understandability).

Desiderata-driven approach vs classical approach

Methods

The authors propose the Smooth Counterfactual Explorer (SCE), which introduces novel mechanisms to satisfy three core explanation desiderata:

  1. Fidelity (via Gradient Smoothing): Standard deep networks have highly fractured gradient fields. To avoid getting trapped in local adversarial pockets on the data manifold, SCE distills the target classifier $f$ into a smooth surrogate model $\hat{f}$. This surrogate is trained using heavy data augmentation (adversarial training, MixUp, label smoothing) and tailored smooth activation functions (LeakyReLU + Softplus), forcing the explainer to focus on global decision boundaries.
  2. Understandability (via Step-wise Sparsity): Instead of applying a sparsity mask at the very end of the generation process, SCE applies the RePaint inpainting function and an $\ell_1$ penalty at every single step of the optimization. This forces the search to navigate entirely within a sparse semantic space.
  3. Sufficiency (via Lock-based Diversification): To generate multiple distinct explanations for a single image, SCE uses a "lock-based" diversifier that explicitly blocks optimization paths taken by previously generated counterfactuals.
Overview of the SCE algorithm pipeline

Datasets

The method was evaluated across a mix of real-world, semi-synthetic, and purely synthetic datasets:

  • CelebA: Real-world face images, evaluating 'smiling' and 'blond' attributes.
  • CelebA + ©: An augmented version of CelebA where a copyright tag is artificially added to a corner to introduce a controlled, spurious correlation with the 'smiling' attribute.
  • Square: A purely synthetic 4D manifold dataset containing a foreground square and a background with correlated intensities, specifically designed to test if explainers catch "Clever Hans" shortcut strategies.
  • Camelyon17: A histopathological dataset exhibiting a spurious correlation between patch type (benign/malignant) and the hospital of origin.

Key Insights and Ideas

  • Image Editing $\neq$ Counterfactual Explanation: High image quality and minimal changes do not inherently make an explanation good. A lower-quality image that clearly highlights a model's flaw (like a background artifact) is far more valuable than a pristine image with imperceptible changes.
  • Sparsity over Minimality: Resolutely altering one major semantic feature (e.g., adding a beard or changing hair color) is much more understandable to a human than faintly tweaking thousands of unrelated pixels across the entire image.
  • The Necessity of Gradient Smoothing: Without distilling the model into a smooth surrogate, optimization algorithms almost always default to adversarial shortcuts on the data manifold rather than identifying true semantic shifts.

Key Results

  • Robustness (Fidelity): SCE achieved exceptionally high Non-Adversarial (NA) rates (e.g., 100% on CelebA-Smile + © with ResNet-18). This means its counterfactuals successfully flipped independent, freshly initialized models, proving they represent true semantic boundaries rather than weight-specific adversarial hacks.
  • Diversity: SCE significantly outperformed competitors (ACE, DiME, FastDIME) in explanation diversity. On the Square dataset, SCE achieved a diversity score of 95.5%, whereas competing methods scored 1.6% or lower.
  • Model Fixing (In-the-loop Gain): When integrated into a model-repair loop (where an oracle fixes model errors based on explanations), SCE provided highly actionable insights. This led to massive accuracy gains on unpoisoned test data (e.g., a gain score of 93.4 on the Square dataset compared to $\le$ 9.3 for other methods).

Limitations and Future Work

  • Computational Overhead: SCE requires an initial phase to train the distilled surrogate model $\hat{f}$ before any counterfactuals can be generated.
  • Optimization Complexity: Finding counterfactuals remains a complex, non-linear, non-convex optimization problem that relies heavily on the interplay of multiple hyper-parameters and auxiliary generative models (like DDPMs).
  • Future Directions: The authors suggest exploring the intersection of VCEs with feature attribution methods (like Layer-wise Relevance Propagation, or LRP). Local surrogates from attribution methods could simplify the counterfactual search, while counterfactuals could provide ideal reference points for attribution.

Summary updated

BibTeX
@article{bender2026towards,
  author = {Sidney Bender and Jan Herrmann and Klaus Robert Muller and Grégoire Montavon},
  title = {{Towards Desiderata-Driven Design of Visual Counterfactual Explainers}},
  journal = {Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=PV7fLGdKd6},
}
Figure