OoD-Bench: Quantifying and Understanding Two Dimensions of Out-of-Distribution Generalization

Nanyang Ye, Kaican Li, Haoyue Bai, Runpeng Yu, Lanqing Hong, Fengwei Zhou, Zhenguo Li, Jun Zhu

Abstract

Deep learning models often fail when encountering Out-of-Distribution (OoD) data. While numerous algorithms aim to improve robustness, progress has been difficult to measure due to a monolithic view of distribution shifts. We introduce OoD-Bench, a framework that decomposes distribution shifts into two measurable dimensions: diversity shift and correlation shift. Our analysis reveals that most state-of-the-art algorithms specialize in only one dimension and frequently fail to consistently outperform simple Empirical Risk Minimization (ERM) across both.

Introduction

Deep learning models are notoriously brittle; they perform exceptionally on data similar to their training set but often crumble when faced with novel environments. Despite the proliferation of Out-of-Distribution (OoD) generalization algorithms, the field has lacked a nuanced understanding of the nature of these data shifts. Treating all distribution shifts as a single problem leads to "overestimated progress," where an algorithm appears successful on one benchmark but fails on another because the underlying shift type differs.

To address this, we propose a way to quantify and categorize shifts, providing a map for researchers to understand where benchmarks sit and why specific algorithms succeed or fail.

A Two-Dimensional Taxonomy of Shifts

We propose a taxonomy based on a causal model where features are split into invariant components ($Z_1$) and environment-specific components ($Z_2$).

The causal model (left) defines how invariant ($Z_1$) and environment-specific ($Z_2$) features influence inputs ($X$) and labels ($Y$). Diversity shift (middle) occurs when the support of $Z_2$ changes, while correlation shift (right) occurs when the relationship between $Z_2$ and $Y$ changes.
  1. Diversity Shift ($S$): This occurs when training and test environments contain different "novel" features that are not shared. For example, training on photos of dogs in parks and testing on sketches of dogs on beaches. The core "dog" features remain, but the styles and backgrounds (the diversity) change.
  2. Correlation Shift ($T$): This happens when "spurious" features (like background color) are correlated with a label in training, but that correlation flips or disappears in testing. If 90% of "cows" in training appear on green grass, a model might learn "green = cow." If the test set features cows on sand, the model fails because the correlation shifted.

To measure these, we train a neural network discriminator to distinguish between environments. We then apply Kernel Density Estimation (KDE) on the extracted features to calculate numerical scores (0 to 1) for both Diversity and Correlation shifts.

Benchmarking the Spectrum

We evaluated 14 popular OoD algorithms across seven major benchmarks, categorizing them by their dominant shift type. This mapping reveals a clear spectrum of challenges in existing datasets.

OoD-Bench categorizes popular datasets along a spectrum from diversity-dominated (e.g., PACS) to correlation-dominated (e.g., Colored MNIST).
  • Diversity-Dominated: PACS, OfficeHome, Terra Incognita, and Camelyon17-WILDS.
  • Correlation-Dominated: Colored MNIST, NICO, and modified CelebA.
  • Realistic/Mixed: ImageNet variants (ImageNet-A, -R, -V2) occupy the middle of the spectrum. Notably, ImageNet-V2 contains more correlation shift than previously thought, explaining why models struggle despite visual similarity to the original ImageNet.

Key Insights and Results

Our benchmarking reveals a significant "trade-off trap." Algorithms are highly specialized: methods like RSC and MMD excel on diversity-heavy datasets (achieving ranking scores +2 over ERM) but struggle with correlation shifts (scoring -1 relative to ERM). Conversely, VREx and GroupDRO are better at ignoring spurious correlations but underperform on diversity shifts.

Crucially, Empirical Risk Minimization (ERM) remains a formidable competitor. In many cases, standard training is as good as, or better than, complex specialized algorithms when averaged across different shift types. No single algorithm in our study achieved a positive ranking score in both categories simultaneously, highlighting the lack of a "universal" OoD generalizer.

Conclusion

OoD-Bench provides a rigorous framework for understanding why models fail to generalize. The "No Free Lunch" result suggests that current research has yet to produce a comprehensive algorithm capable of handling both diversity and correlation shifts. Future work should focus on developing unified approaches and designing benchmarks that capture the subtle, real-world shifts that are often imperceptible to humans but conspicuous to neural networks.

Summary updated

BibTeX
@inproceedings{ye2022ood,
  author = {Nanyang Ye and Kaican Li and Haoyue Bai and Runpeng Yu and Lanqing Hong and Fengwei Zhou and Zhenguo Li and Jun Zhu},
  title = {{OoD-Bench: Quantifying and Understanding Two Dimensions of Out-of-Distribution Generalization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.00779},
}
Figure