Accuracy on the Line: On the Strong Correlation Between Out-of-Distribution and In-Distribution Generalization

John Miller, Rohan Taori, Aditi Raghunathan, Shiori Sagawa, Pang Wei Koh, Vaishaal Shankar, Percy Liang, Yair Carmon, Ludwig Schmidt

Introduction

A fundamental challenge in machine learning is the performance degradation of models when deployed in environments that differ from their training data—a phenomenon known as distribution shift. While conventional wisdom suggests that out-of-distribution (OOD) performance is highly unpredictable, the research paper "Accuracy on the Line" demonstrates that OOD accuracy is actually a remarkably predictable function of in-distribution (ID) accuracy.

The "Accuracy on the Line" Phenomenon

The researchers discovered that across a vast array of models and datasets, there exists a strong linear correlation between ID and OOD performance when viewed through a probit transform (the inverse of a Gaussian cumulative distribution function). This transformation linearizes the relationship, revealing a consistent trend that holds across different architectures and training regimes.

Figure 1: OOD accuracy plotted against ID accuracy across various datasets. The linear trend is consistent across different model types and distribution shifts.

Experimental Methodology

To validate this observation, the authors conducted an extensive empirical study involving over 3,000 models and 100,000 evaluations. The "model zoo" included diverse architectures ranging from classical machine learning (SVMs, KNN, Random Forests) to state-of-the-art deep learning models (CNNs, Vision Transformers).

The study spanned multiple dataset "universes":

  • Natural Shifts: CIFAR-10.1/10.2 and ImageNetV2.
  • Real-World Shifts (WILDS): Satellite imagery (FMoW) and wildlife monitoring (iWildCam).
  • Synthetic Corruptions: CIFAR-10-C and YCB-Objects.

Key Results and Universality

The most striking finding is the universality of the linear trend. Surprisingly, classical models like KNN or Random Forests often fall on the same performance line as advanced neural networks. This suggests that the correlation is primarily a property of the data shift itself rather than specific model inductive biases.

Figure 4: Quantitative summary of the linear fit ($R^2$) and the number of models evaluated across different ID/OOD dataset pairs.

As shown in the table above, the $R^2$ values for the linear fit in the probit domain frequently exceed 0.99, indicating an extremely high degree of predictability for most natural distribution shifts.

Implications for Robustness

This research has significant implications for how we approach model robustness. Many "robustness interventions" intended to make models more resilient to distribution shifts may simply be moving the model along the existing performance line by improving general accuracy, rather than fundamentally changing the model's sensitivity to the shift.

However, the authors identified a notable exception: Pre-training. Models pre-trained on massive external datasets (e.g., ImageNet-21k or CLIP) can "break" the line, achieving significantly higher OOD accuracy for a given ID accuracy level compared to models trained from scratch.

Limitations and Future Directions

While the empirical evidence is robust, theoretical explanations are currently limited to linear classifiers on Gaussian data. The linear trend is also weaker on certain synthetic shifts (like Gaussian noise) and specific domains like medical imaging (Camelyon17), where high intra-hospital correlation can lead to increased variance in OOD performance. Future research aims to identify "line-breaking" techniques that can specifically improve the slope of OOD generalization.

Summary updated

Abstract

For machine learning systems to be reliable, we must understand their performance in unseen, out-of-distribution environments. In this paper, we empirically show that out-of-distribution performance is strongly correlated with in-distribution performance for a wide range of models and distribution shifts. Specifically, we demonstrate strong correlations between in-distribution and out-of-distribution performance on variants of CIFAR-10 & ImageNet, a synthetic pose estimation task derived from YCB objects, satellite imagery classification in FMoW-WILDS, and wildlife classification in iWildCam-WILDS. The strong correlations hold across model architectures, hyperparameters, training set size, and training duration, and are more precise than what is expected from existing domain adaptation theory. To complete the picture, we also investigate cases where the correlation is weaker, for instance some synthetic distribution shifts from CIFAR-10-C and the tissue classification dataset Camelyon17-WILDS. Finally, we provide a candidate theory based on a Gaussian data model that shows how changes in the data covariance arising from distribution shift can affect the observed correlations.
BibTeX
@inproceedings{miller2021accuracy,
  author = {John Miller and Rohan Taori and Aditi Raghunathan and Shiori Sagawa and Pang Wei Koh and Vaishaal Shankar and Percy Liang and Yair Carmon and Ludwig Schmidt},
  title = {{Accuracy on the Line: On the Strong Correlation Between Out-of-Distribution and In-Distribution Generalization}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=HfzWp257Bgq},
}
Figure