Do CLIPs Always Generalize Better than ImageNet Models?

Qizhou Wang, Yong Lin, Yongqiang Chen, Ludwig Schmidt, Bo Han, Tong Zhang · OpenReview

Abstract

Large vision language models, such as CLIPs, have revolutionized modern machine learning. CLIPs have demonstrated great generalizability under distribution shifts, supported by an increasing body of literature. However, the evaluation datasets for CLIPs are variations primarily designed for ImageNet benchmarks, which may not fully reflect the extent to which CLIPs, e.g., pre-trained on LAION, robust to spurious correlations. To bridge the gap, we collect a real-world dataset called CounterAnimal that contains realistic spurious features found in animal photos. CounterAnimal consists of a) the common group: comprising animals on common backgrounds, and b) the counter group: including animals on unusual backgrounds. The performance drops from the common to counter groups quantify the reliance of models on spurious features (i.e., backgrounds) to predict the animals. We find that CLIPs trained on either LAION or the OpenAI data exhibit notable performance drops on the counter group. Surprisingly, we observe that single-modal models trained on ImageNet are more robust than CLIPs. We provide both theoretical and empirical explanations for why CLIPs still learn spurious features. Our findings suggest that distribution shifts remain an open problem for CLIPs, and one needs to be cautious about test setups when evaluating foundation models pre-trained on a significantly different scale and distribution.

Introduction

Contrastive Language-Image Pre-training (CLIP) models are widely celebrated for their "zero-shot" robustness. However, this robustness is often evaluated on benchmarks derived from ImageNet, which may share the same biases as the models being tested. This paper investigates whether CLIP's perceived robustness is an artifact of these evaluation setups. By introducing CounterAnimal, a benchmark designed to expose reliance on spurious correlations like animal backgrounds, the authors demonstrate that CLIP models are highly susceptible to "shortcuts" found in their web-scale training data.

The CounterAnimal Dataset

To systematically uncover hidden biases, the researchers developed a pipeline using raw photos from iNaturalist. They focused on animal classes present in ImageNet and manually annotated their backgrounds (e.g., snow, grass, water). Using a proxy CLIP model, they identified classes where performance significantly dropped when the background changed.

CounterAnimal is divided into two groups:

  • Common Group (Easy): Animals in typical environments, such as a polar bear on snow.
  • Counter Group (Hard): Animals in unusual but plausible environments, such as a polar bear on grass.
A polar bear in its common background (snow), representing the 'Easy' group in CounterAnimal.

The final dataset contains 7,174 "easy" photos and 5,926 "hard" photos across 45 animal classes. This structure allows researchers to quantify a model's reliance on background features for prediction.

Key Findings

The Robustness Illusion

The evaluation reveals a significant performance gap between common and counter groups. For instance, a standard CLIP model (ViT-B/32) achieves 97.62% accuracy on polar bears in the snow but drops to 70.91% when the bear is on grass—a 26.7% drop. This suggests that CLIP models have not eliminated bias but have instead traded ImageNet-specific biases for a new set of web-scale spurious correlations.

A polar bear in a counter background (grass), illustrating the 'Hard' group where CLIP performance often drops.

Comparison with ImageNet Models

Surprisingly, traditional ImageNet-trained models often exhibit greater robustness to the spurious features in CounterAnimal than CLIP models. This finding challenges the assumption that the sheer scale and diversity of web data (like LAION-400M or LAION-2B) automatically teach a model to ignore irrelevant background features.

Factors Influencing Robustness

  • Data Quality: While increasing data quantity does not necessarily reduce bias, using filtered, high-quality datasets (e.g., DataComp or DFN) significantly improves robustness.
  • Model Scaling: Increasing the backbone size (e.g., moving from ViT-B to ViT-G) helps the model better distinguish between objects and backgrounds.
  • Theoretical Basis: Theoretical analysis using a linearized contrastive loss confirms that the CLIP objective does not inherently prevent learning spurious features if they are strongly correlated with text captions in the training set.

Conclusion

CounterAnimal serves as a sobering benchmark for the machine learning community. It highlights that distribution shifts remain a critical challenge for foundation models. Future work should focus on expanding such benchmarks beyond animal classes and developing automated mitigation strategies during pre-training to ensure models learn truly robust representations rather than sophisticated shortcuts.

Summary updated

BibTeX
@inproceedings{wang2024do,
  author = {Qizhou Wang and Yong Lin and Yongqiang Chen and Ludwig Schmidt and Bo Han and Tong Zhang},
  title = {{Do CLIPs Always Generalize Better than ImageNet Models?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=wWyumwEYV8},
}
Figure