Identifying and Disentangling Spurious Features in Pretrained Image Representations

Rafayel Darbinyan, Hrayr Harutyunyan, Aram H. Markosyan, Hrant KhachatrianarXiv 2023 · DOI

Abstract

Pretrained image models frequently exploit spurious correlations, such as identifying a bird by its background rather than its physical characteristics. This study demonstrates that these features are often linearly entangled within the representation space. The authors introduce the Group-aware Autoencoder (GwAE), a linear decomposition method that isolates core features from spurious ones. Experimental results on the Waterbirds dataset show that surgically removing these features significantly enhances Worst Group Accuracy (WGA) across ResNet, RegNet, and DINOv2 architectures, nearing the performance of models trained on perfectly balanced data.

The Challenge of Spurious Correlations

Deep learning models often prioritize "shortcuts"—spurious correlations that hold true in the training set but fail in the real world. For instance, if waterbirds are predominantly photographed on water, a model may learn to associate "water" with the label "waterbird." While average accuracy remains high, performance often "craters" on the "worst group"—such as a waterbird on land. This paper explores whether these spurious features can be surgically removed from pretrained representations without retraining the entire model.

Methodology: Group-aware Autoencoder (GwAE)

The authors propose the Group-aware Autoencoder (GwAE) to disentangle representations. The process involves:

  1. Linear Decomposition: A linear encoder splits the representation ($z$) into core features ($z_y$), spurious features ($z_c$), and residual noise ($z_n$).
  2. Supervised Separation: The model is trained to ensure $z_y$ predicts the class label and $z_c$ predicts the spurious attribute (e.g., background).
  3. Independence Constraint: The Hilbert-Schmidt Independence Criterion (HSIC) loss is used to penalize mutual information between core and spurious vectors.
  4. Refinement: Once isolated, techniques like Principal Component Analysis (PCA) are applied to the core vector ($z_y$) to further ensure only the most robust features remain.

Insights into Feature Entanglement

A key finding is that representations in models like ResNet-50 are often "axis-aligned," meaning specific individual neurons correspond directly to spurious features. In contrast, Vision Transformers like DINOv2 exhibit more holistic, naturally disentangled representations. Despite these architectural differences, the entanglement of features is largely linear, allowing a simple linear transformation like GwAE to effectively "un-mix" them.

Worst Group Accuracy (WGA) vs. number of features (N) for ResNet-50, RegNetY, and DINOv2 across different attribution and disentanglement methods.

Experimental Results

The primary benchmark was the Waterbirds dataset, testing the model's ability to distinguish landbirds from waterbirds regardless of background. The proposed pipeline significantly improved Worst Group Accuracy (WGA) across all tested backbones.

Performance comparison on the Waterbirds dataset for ResNet-50, highlighting the gains in Worst Group Accuracy (WGA) using the proposed GwAE and PCA pipeline.

For ResNet-50, standard training yielded a WGA of 60.2%. The GwAE method combined with PCA boosted this to 81.7%. Similarly, RegNetY improved from 83.5% to 90.4%, and DINOv2 reached 94.0% WGA. These results are significant as they approach the theoretical upper bound achievable with perfectly balanced, unbiased datasets.

Limitations and Future Work

While effective, the GwAE method currently requires explicit labels for spurious features (e.g., "background type") during the autoencoder training phase, which may not always be available in real-world scenarios. Additionally, the method relies on the assumption of linear entanglement; while this held for the models studied, more complex non-linear entanglements might exist in other architectures. Future research will focus on identifying shortcuts without prior labels and testing these methods on a broader range of diverse datasets.

Summary updated

BibTeX
@misc{darbinyan2023identifying,
  author = {Rafayel Darbinyan and Hrayr Harutyunyan and Aram H. Markosyan and Hrant Khachatrian},
  title = {{Identifying and Disentangling Spurious Features in Pretrained Image Representations}},
  year = {2023},
  eprint = {2306.12673},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.12673},
}
Figure