Efficient Contrastive Explanations on Demand

Yacine Izza, Joao Marques-SilvaarXiv 2024

TL;DR

This paper introduces SwiftCXp, a high-performance algorithm designed to generate formal contrastive explanations for deep neural networks (DNNs) by leveraging adversarial robustness tools. By parallelizing dichotomic (binary) search and employing novel feature-disjunction heuristics, the authors achieve significant speedups, enabling the computation of rigorous explanations for large convolutional models that were previously computationally out of reach.

What Problem Does This Paper Address?

Deep Neural Networks are notoriously "black boxes," making their decisions difficult for humans to trust in critical applications. Explainable AI (XAI) seeks to fix this. Two primary types of formal explanations exist:

  1. Abductive Explanations (AXps): "Why did the model pick this class?" (A minimal set of features sufficient for the prediction).
  2. Contrastive Explanations (CXps): "Why didn't the model pick a different class?" (A minimal set of features that, if changed, would flip the prediction).

While symbolic (logic-based) XAI provides rigorous guarantees, it suffers from a massive performance bottleneck when dealing with high-dimensional data like images. Previous research established a link between finding these explanations and finding adversarial examples (small perturbations that fool a model). However, even with this link, existing algorithms were too slow for complex models. This paper tackles the scalability challenge, aiming to provide "on-demand" explanations for modern DNNs.

Methods

The authors propose a suite of algorithms that move beyond simple sequential feature inspection:

  • Distance-Restricted Explanations ($\partial$CXps): The search is confined within a specific distance $\epsilon$ (using $l_p$ norms) from the original input. This ensures the explanation is locally relevant and relates directly to the model's local robustness.
  • Dichotomic Search: Instead of checking pixels one by one, the algorithm uses a binary search strategy to find "transition features"—pixels that are critical to flipping the model's decision.
  • SwiftCXp (Parallelized Search): This is the core contribution. It splits the feature set into "chunks" and queries a robustness oracle (a tool that checks for adversarial examples) in parallel across multiple CPU/GPU cores. As soon as one parallel job finds a transition, the others are terminated, saving massive amounts of time.
  • Feature Disjunction Check (FeatDisjunct): Inspired by algorithms for finding Minimal Correction Subsets in logic, this optimization identifies multiple relevant features simultaneously in a single parallel step.
  • MARCO & Abstraction Refinement: The paper also adapts existing logic-based algorithms to enumerate multiple explanations and to find the minimum-size (most sparse) contrastive explanation.

Datasets

The researchers evaluated their approach on standard image recognition benchmarks using both fully-connected (dense) and convolutional (conv) neural networks:

  • MNIST: The classic dataset of $28\times28$ handwritten digits.
  • GTSRB (German Traffic Sign Recognition Benchmark): A more complex dataset of real-world traffic signs.

They utilized MN-BaB, a state-of-the-art neural network verifier, as the underlying "robustness oracle" to check for the existence of adversarial examples during the search process.

Key Insights and Ideas

  • Robustness as an Explainer: The fundamental "aha" moment is that a contrastive explanation is essentially a minimal set of features that defines a "path" to an adversarial example. If you can find adversarial examples efficiently, you can find explanations efficiently.
  • Chunking for Speed: By analyzing chunks of features in parallel rather than individual pixels, the algorithm can discard large swaths of irrelevant features very quickly.
  • Duality is Preserved: The paper proves that the logical duality between abductive and contrastive explanations (where one is a Minimal Hitting Set of the other) holds even when you add distance constraints.
  • Sparsity of Explanations: Formal contrastive explanations are often remarkably sparse. As seen in the visualizations, only a small fraction of pixels are actually responsible for the model's "why not" reasoning.
Figure 1: Visualize Feature Attribution-based Contrastive explanations for image datasets: MNIST and GTSRB.

Key Results

  • Scalability: The baseline dichotomic search failed (timed out after 4 hours) on large convolutional models. In contrast, SwiftCXp successfully delivered explanations for the same models in an average of ~16 minutes.
  • Efficiency: On smaller models, SwiftCXp was often 6-10x faster than the baseline.
  • Heuristic Success: The "Feature Disjunction" technique was highly effective, often allowing the algorithm to move up to 70% of relevant features into the explanation set in just a few iterations.
  • Feature Importance: By enumerating 100 explanations per sample, the authors generated "Feature Attribution" maps (see Figure 1c and 1f above) that provide a heat-map style view of which pixels are most critical across different possible counterfactuals.

Limitations and Future Work

  • Oracle Bottleneck: The speed of SwiftCXp is still fundamentally limited by the speed of the underlying robustness verifier (the oracle). As verifiers improve, so will these explanation algorithms.
  • Heuristic Sensitivity: The authors noted that their "pixel sensitivity" heuristic performed well on MNIST but poorly on GTSRB, suggesting that feature-ordering strategies need to be more adaptive to the specific data domain.
  • Computational Cost: While 16 minutes is a massive improvement over "never," it is still not "instant." Future work could look into further reducing this latency for real-time interactive XAI systems.

Summary updated

BibTeX
@misc{izza2024efficient,
  author = {Yacine Izza and Joao Marques-Silva},
  title = {{Efficient Contrastive Explanations on Demand}},
  year = {2024},
  eprint = {2412.18262},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.18262},
}
Figure