Beyond Distribution Shift: Spurious Features Through the Lens of Training Dynamics

Nihal Murali, Aahlad Manas Puli, Ke Yu, Rajesh Ranganath, kayhan Batmanghelich

Abstract

Deep Neural Networks (DNNs) are prone to learning spurious features that correlate with the label during training but are irrelevant to the learning problem. This hurts model generalization and poses problems when deploying them in safety-critical applications. This paper aims to better understand the effects of spurious features through the lens of the learning dynamics of the internal neurons during the training process. We make the following observations: (1) While previous works highlight the harmful effects of spurious features on the generalization ability of DNNs, we emphasize that not all spurious features are harmful. Spurious features can be "benign" or "harmful" depending on whether they are "harder" or "easier" to learn than the core features for a given model. This definition is model and dataset dependent. (2) We build upon this premise and use instance difficulty methods (like Prediction Depth) to quantify "easiness" for a given model and to identify this behavior during the training phase. (3) We empirically show that the harmful spurious features can be detected by observing the learning dynamics of the DNN's early layers. In other words, easy features learned by the initial layers of a DNN early during the training can (potentially) hurt model generalization. We verify our claims on medical and vision datasets, both simulated and real, and justify the empirical success of our hypothesis by showing the theoretical connections between Prediction Depth and information-theoretic concepts like $\mathcal{V}$-usable information. Lastly, our experiments show that monitoring only accuracy during training (as is common in machine learning pipelines) is insufficient to detect spurious features. We, therefore, highlight the need for monitoring early training dynamics using suitable instance difficulty metrics.

Introduction: The Learnability of Shortcuts

The machine learning community typically views spurious correlations through the lens of "distribution shift"—the failure of a model when test data differs from training data. However, this perspective fails to explain why a model prioritizes a specific shortcut over the intended task.

The authors argue that the critical factor is learnability. A spurious feature is only harmful if it is "easier" for the model to extract than the core features. For example, a hospital-specific watermark on an X-ray is significantly easier to detect than subtle pathological patterns. Conversely, if a spurious feature is more complex than the core task, it may remain "benign" as the model naturally prioritizes the simpler, relevant features.

Figure 1: Comparison of difficult (benign) and easy (harmful) spurious features. Scenario 1 shows a difficult feature (prime number) while Scenario 2 shows an easy feature (white patch).

Methods: Probing Internal Dynamics with Prediction Depth

To detect these shortcuts early, the researchers utilize Prediction Depth (PD). PD measures the minimum number of layers required to correctly classify an image by training simple k-Nearest Neighbor (k-NN) classifiers on the feature embeddings of every layer.

A "red flag" for spurious features is a low PD observed early in training. If the initial layers of a network can classify a large portion of the data almost immediately, it suggests the model has latched onto a simplistic shortcut. This empirical observation is supported by a theoretical bridge to V-usable information, confirming that low PD correlates with features that are computationally inexpensive for a specific architecture to process.

Figure 2: The data generation model (left) and common test data used to evaluate models without spurious correlations (right).

Key Insights and Results

The study yields several critical insights into DNN training dynamics:

  • Spuriousness is Relative: A feature's impact depends on the model's architecture. What is "harmful" for an MLP might be "benign" for a more complex architecture if the feature is harder for the latter to learn than the core task.
  • Early Detection: In experiments across synthetic (Dominoes, KMNIST) and real-world (Medical Imaging, NICO++) datasets, harmful spurious features were detectable within the first two epochs of training by monitoring PD plots.
  • Accuracy is Deceptive: Standard training accuracy often fails to distinguish between a model learning the core task and one learning a shortcut. Both might reach 99% accuracy, but only the latter will fail on out-of-distribution test data.
  • Real-World Impact: In medical datasets like NIH Chest X-ray, PD plots identified a reliance on surgical tubes (chest drains) to identify pneumothorax, a finding confirmed by Grad-CAM visualizations in the early layers.

Conclusion

This work shifts the focus from distribution shift to the internal learning dynamics of DNNs. By identifying that "easy" features are the primary drivers of harmful spurious correlations, the authors provide a tool—Prediction Depth—to detect these issues early in the training pipeline. While the current research focuses on detection, future work is needed to develop intervention strategies that can "unlearn" these detected shortcuts without sacrificing performance on the core task.

Summary updated

BibTeX
@article{murali2023beyond,
  author = {Nihal Murali and Aahlad Manas Puli and Ke Yu and Rajesh Ranganath and kayhan Batmanghelich},
  title = {{Beyond Distribution Shift: Spurious Features Through the Lens of Training Dynamics}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=Tkvmt9nDmB},
}
Figure