Finding and Fixing Spurious Patterns with Explanations

Gregory Plumb, Marco Tulio Ribeiro, Ameet Talwalkar

Abstract

Image classifiers often use spurious patterns, such as “relying on the presence of a person to detect a tennis racket,” which do not generalize. In this work, we present an end-to-end pipeline for identifying and mitigating spurious patterns for such models, under the assumption that we have access to pixel-wise object-annotations. We start by identifying patterns such as “the model’s prediction for tennis racket changes 63% of the time if we hide the people.” Then, if a pattern is spurious, we mitigate it via a novel form of data augmentation. We demonstrate that our method identifies a diverse set of spurious patterns and that it mitigates them by producing a model that is both more accurate on a distribution where the spurious pattern is not helpful and more robust to distribution shift.

The Problem: Shortcuts in Machine Learning

Machine learning models are notorious for finding "shortcuts." If a training dataset consistently shows tennis rackets in the hands of people, a model might learn that "Person = Tennis Racket." These are Spurious Patterns (SPs)—correlations that work on the training data but fail in the real world, such as when trying to detect a racket sitting alone on a court.

Existing methods to fix this often rely on manual inspection of heatmaps, which is unscalable. Furthermore, simple mitigation strategies like random object removal can inadvertently introduce new biases, such as the model learning to associate the "grey boxes" used for masking with a specific class.

The SPIRE Pipeline

The authors introduce SPIRE (Spurious Pattern Identification and REpair), an end-to-end pipeline designed to systematically identify and fix these shortcuts. The pipeline consists of three main stages:

  1. Identification: The system measures how much a model's prediction changes when a specific object is removed or added. For example, if confidence in "tennis racket" drops by 63% when the "person" is masked out, SPIRE flags this as a potential SP.
  2. Labeling: A human expert reviews the flagged patterns to decide if they are truly spurious (based on domain knowledge) or a valid contextual feature.
  3. Mitigation: SPIRE uses a novel data augmentation strategy to create a balanced distribution that breaks the statistical link between the spurious object and the target label.
The SPIRE pipeline: (A) Identifying patterns by masking objects, (B) Human labeling of spuriousness, and (C) Mitigation through balanced data augmentation.

Principled Mitigation through Balanced Augmentation

The core innovation of SPIRE is its mitigation strategy. Rather than just deleting objects, it creates a balanced distribution across four categories: Both (Main + Spurious), Just Main, Just Spurious, and Neither. By carefully adding or removing objects, SPIRE ensures the presence of the spurious object provides zero statistical information about the target label.

SPIRE creates a balanced distribution to ensure the spurious pattern (SP) is not helpful for prediction, while maintaining the overall probability of the main class.

Crucially, SPIRE manages the "artifact" problem. If you hide a person with a grey box, the model might learn that "grey box = tennis racket." SPIRE's mathematical framework ensures that the probability of the target class remains the same whether an artifact is present or not, effectively "blinding" the model to the augmentation process itself.

Key Results and Generalization

The authors evaluated SPIRE across several challenging contexts, including COCO, UnRel (unusual spatial relationships), and ISIC (medical skin lesions).

  • Robustness: On COCO "in the wild" experiments, SPIRE reduced the Recall Gap (accuracy drop when the spurious object is missing) by 14.2% and the Hallucination Gap (false positives when the spurious object is present) by 28.1%.
  • Generalization: SPIRE improved zero-shot performance on the UnRel dataset by 2.4% MAP over the baseline, proving that fixing spurious patterns leads to better performance on "weird" real-world data.
  • Medical Accuracy: In the ISIC skin lesion task, SPIRE successfully mitigated the "sticker" bias (where models rely on colored markers near lesions), significantly outperforming prior state-of-the-art regularization methods.

Conclusion

SPIRE demonstrates that model explanations can be used not just for understanding, but for active improvement. By identifying where a model is "cheating" and providing a principled way to re-balance the training signal, SPIRE creates models that are more robust to distribution shifts and more reliable in real-world applications.

Summary updated

BibTeX
@article{plumb2022finding,
  author = {Gregory Plumb and Marco Tulio Ribeiro and Ameet Talwalkar},
  title = {{Finding and Fixing Spurious Patterns with Explanations}},
  journal = {Accepted by TMLR},
  year = {2022},
  url = {https://openreview.net/forum?id=whJPugmP5I},
}
Figure