Preemptively Pruning Clever-Hans Strategies in Deep Neural Networks

Lorenz Linhardt, Klaus-Robert Müller, Grégoire Montavon

TL;DR

Machine learning models often rely on hidden "Clever Hans" shortcuts (spurious correlations) that go undetected during validation if the validation data lacks those specific artifacts. This paper introduces Explanation-Guided Exposure Minimization (EGEM), a post-hoc soft-pruning method that uses a small clean dataset to preserve verified decision pathways while preemptively suppressing unverified model dimensions, making the model robust against hidden distribution shifts.

What Problem Does This Paper Address?

Deep learning models are notorious for finding shortcuts—learning to classify images based on background textures, watermarks, or text formatting rather than the actual object of interest. This is known as the Clever Hans (CH) effect.

While Explainable AI (XAI) tools can help humans spot these flaws by visualizing what the model is looking at, they suffer from a major catch: they can only expose a shortcut if the validation data actually contains the spurious feature. If a practitioner evaluates a third-party foundation model using a small, clean dataset, the model's explanations will look perfectly healthy ("right for the right reasons"). However, the hidden vulnerability remains dormant until deployment, where a distribution shift can cause catastrophic failures.

Figure 1: Comparison of a naive XAI-based validation/deployment pipeline and our proposed approach incorporating an additional exposure minimization step. Left: A third party trains a flawed (Clever Hans) model which exploits a spurious correlation (images of the horse class have a copyright tag in the bottom-left corner). Middle: The user receives the model. Because the user has limited data (in particular, no data with copyright tag), the flaw of the model cannot be easily detected with XAI methods and the model appears to be both accurate and right for the right reasons. Right: Because of the undetected flaw, a naive deployment of the model is likely to result in prediction errors on new data (e.g. cats with copyright tags predicted to be horses). Our proposed approach preemptively reduces exposure to unseen features (the copyright tag), thereby avoiding these incorrect predictions.

The authors address this exact blind spot: How do we robustify a model against hidden Clever Hans strategies when we don't even know what those strategies are, and our validation data is completely clean?

Methods

The authors propose Explanation-Guided Exposure Minimization (EGEM). Instead of trying to find and fix a specific shortcut, EGEM acts as a defensive shield by minimizing the model's overall sensitivity (or "exposure") to any unverified feature space.

  1. EGEM (Standard): Formulated as a knowledge distillation problem, EGEM forces the refined model to replicate the original model's predictions and explanations on the available clean data. Crucially, it adds a regularization term that minimizes the model's exposure to variations outside this clean data. For common XAI methods (like LRP or Integrated Gradients), this optimization problem elegantly reduces to a simple, closed-form soft-pruning rule that scales down neural weights based on how inactive or irrelevant they are on clean data.
  2. PCA-EGEM: Standard EGEM prunes individual neurons. However, shortcut features and valid features are often entangled across the same neurons. To solve this, PCA-EGEM projects the model's activations into a virtual PCA space derived from the clean data. It then applies soft-pruning to the principal components before projecting back, effectively separating and preserving the dominant patterns of valid strategies from unobserved shortcuts.
Figure 2: Top: Cartoon depicting the removal of unseen Clever Hans strategies via our proposed exposure minimization approaches (EGEM and PCA-EGEM). The refined model only retains the dependence on a2 (a neuron detecting the actual horse) and removes its reliance on a3 (a neuron responsive to spurious copyright tags). Bottom: Qualitative behavior of PCA-EGEM on ML models trained on real datasets. The models produced by our approach become robust to spurious features not seen at inspection time but occurring at deployment time. (Pixel-wise explanations are computed using the zennit package [4].)

Datasets

The authors evaluated their methods across several vision and text benchmarks engineered to contain distinct, class-correlated shortcuts during training:

Overview of the datasets, class structures, and engineered Clever Hans features used for evaluation.
  • Modified MNIST: Digits of class '8' contain a 3-pixel corner artifact.
  • ISIC 2019: A medical skin lesion dataset where some 'Melanocytic nevus' images naturally contain colored patch artifacts.
  • ImageNet Subtasks: Binary classification tasks corrupted with watermarks or gray frame borders.
  • CelebA: A facial attribute dataset used to explore real-world demographic biases (e.g., the model using 'Male' features as an inhibitory signal for detecting 'Blond Hair').
  • IMDB: A text sentiment dataset where a synthetic sentence was appended to positive reviews.

Key Insights and Ideas

  • Agreement $\neq$ Safety: A perfect match between human intuition and model explanations on clean data is an illusion of safety. The model can still maintain highly sensitive, unutilized pathways ready to misfire on new data.
  • Preemptive Pruning: Rather than playing whack-a-mole with specific shortcuts, we can systematically reduce model capacity in directions that the clean data doesn't justify.
  • The Power of PCA Realignment: Standard neuron-level pruning fails when shortcuts are non-additive (like blur or color shifts). Rotating the problem into PCA space provides the geometric flexibility needed to disentangle complex, distributed representations.

Key Results

The refined models were tested on "100% poisoned" test sets where the shortcut features were completely decorrelated from the target class.

  • On Modified MNIST, the original model's accuracy dropped by roughly 30% under poisoning, whereas EGEM and PCA-EGEM virtually eliminated this performance gap.
  • On the highly complex ISIC medical dataset, PCA-EGEM was the only method capable of retaining clean-data accuracy while simultaneously boosting poisoned-data accuracy by more than 10 percentage points.
  • In the CelebA bias use case, PCA-EGEM successfully mitigated the model's reliance on spurious features (like shirt collars), leading to a much more balanced and diverse retrieval of underrepresented subgroups (e.g., men with blond hair).
Figure 3: The accuracy for 0% (lighter shade) and uniform 100% (darker shade) poisoning with the spurious feature. The last four bars for each method refer to the binary tasks constructed from the ImageNet dataset. Solid lines show average 100%-poisoned accuracy and dashed lines show average clean-data accuracy over all datasets. The results shown are the mean accuracy and standard deviation obtained using 700 refinement samples per class on the respective test sets over five runs.

Limitations and Future Work

While highly effective, the authors note a few key limitations:

  • The Accuracy Trade-off: Stronger pruning can sometimes impair useful, generalizing features, causing a slight drop in clean-data accuracy. This requires careful tuning of a "slack" hyperparameter.
  • Incomplete Removal: A complete elimination of the shortcut response is rarely achieved because features remain partially entangled in deep networks.
  • Future Directions: The authors suggest combining exposure minimization with explicit feature disentanglement strategies (like independent component analysis) or using global explanations (class prototypes) to supplement scarce validation data.

Summary updated

Abstract

Robustness has become an important consideration in deep learning. With the help of explainable AI, mismatches between an explained model's decision strategy and the user's domain knowledge (e.g. Clever Hans effects) have been identified as a starting point for improving faulty models. However, it is less clear what to do when the user and the explanation agree. In this paper, we demonstrate that acceptance of explanations by the user is not a guarantee for a machine learning model to be robust against Clever Hans effects, which may remain undetected. Such hidden flaws of the model can nevertheless be mitigated, and we demonstrate this by contributing a new method, Explanation-Guided Exposure Minimization (EGEM), that preemptively prunes variations in the ML model that have not been the subject of positive explanation feedback. Experiments demonstrate that our approach leads to models that strongly reduce their reliance on hidden Clever Hans strategies, and consequently achieve higher accuracy on new data.
BibTeX
@article{linhardt2024preemptively,
  author = {Lorenz Linhardt and Klaus-Robert Müller and Grégoire Montavon},
  title = {{Preemptively Pruning Clever-Hans Strategies in Deep Neural Networks}},
  journal = {Information Fusion},
  year = {2024},
  doi = {10.1016/j.inffus.2023.102094},
}
Figure