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
cs.LG, stat.ML
2021-07-10
3,000+ models across many distribution shifts: OOD accuracy is a linear function of ID accuracy in probit space (R2 up to 0.997), and hyperparameter changes only move models along the line.
Models deployed outside the lab face test data from a different distribution than the training set, and it has been hard to say how far accuracy falls. Classical domain adaptation theory bounds the difference between in-distribution and out-of-distribution accuracy by a distance between the two distributions. Those bounds delimit a wide region and predict no trend inside it. Starting around 2018, dataset reproduction experiments, which rebuild a benchmark test set by closely following the original collection process, noticed something odd: model accuracies on the original and rebuilt test sets fell almost on a straight line. Whether that was a quirk of reproductions or a general law of distribution shift was open. This paper maps the territory.
The core experiment is a scatter plot, and two design choices do the work.
First, on a single training distribution, the authors independently train a large pool of models: logistic regression, k-NN, and random forests alongside ResNets, vision transformers, and self-supervised models, with variations in hyperparameters, training duration, and training set size (1% to 80%). Over 3,000 models and 100,000 test evaluations in total. Second, both axes are accuracies passed through the probit transform, the inverse CDF of the standard normal, which maps [0,1] onto the whole real line. Accuracy is bounded and crowds together near the top of its range; probit scaling stretches those ends until the relation becomes precise.
Putting classical methods in the same plot rules out one explanation: that the line is an artifact of the deep learning model zoo. k-NN and ResNet land on the same trend, which points at the data distribution rather than the model family.
The counterexample analysis pairs with a mechanism experiment, and the theory side offers a binary Gaussian model where features are isotropic Gaussians and the shift rotates the mean direction and rescales the variance. As long as the shift direction is independent of the trained classifier, probit-transformed accuracies stay near-linear, with deviations vanishing as dimension grows.
| Shift | Type | R² (probit) | Models |
| CIFAR-10 → CIFAR-10.2 | dataset reproduction | 0.997 | 1,060 |
| CIFAR-10 → CINIC-10 | different benchmark | 0.991 | 949 |
| CIFAR-10 → CIFAR-10-C Fog | synthetic corruption | 0.990 | 790 |
| ImageNet → ImageNet-V2 | dataset reproduction | 0.996 | 219 |
| FMoW-WILDS | temporal shift, satellite imagery | 0.984 | 162 |
| YCB-Objects | pose estimation, lighting/texture | 0.975 | 39 |
| iWildCam-WILDS | camera traps, pretrained / from scratch | 0.881 / 0.536 | 66 / 63 |
The hardest evidence is invariance. On CIFAR-10 → CIFAR-10.2, varying hyperparameters, evaluating every epoch, and shrinking the training set all slide points along the line without moving the fit (R² = 0.99). The fit has slope 0.77: one point of ID accuracy buys about 0.77 points OOD, so the gap widens as models get stronger.
The counterexamples are just as clear. On Camelyon17-WILDS, cross-hospital tissue slide classification, models at 95% ID accuracy scatter from about 50% (chance level) to 95% OOD; ImageNet pretraining does not restore the correlation and strong data augmentation shrinks but does not eliminate the spread. Adding isotropic Gaussian noise to CIFAR-10 gives R² = 0.44, while noise matched to the CIFAR-10 covariance gives R² = 0.93. The pairing points at a mechanism: whether the shift changes the data covariance structure decides whether the line survives, matching the Gaussian theory.
Pretraining splits by task. Fine-tuned ImageNet models stay on the original line for CIFAR-10.2 and FMoW-WILDS, and form a higher, separate line on iWildCam-WILDS, where the weight decay value also matters. Zero-shot ImageNet prediction on CIFAR-10 (CIFAR-10 classes are a subset of ImageNet classes) leaves the trend and forms a line closer to x = y, supporting the view that part of the drop comes from bias in ID training, while the rest reflects the reproductions being genuinely harder, though humans perform similarly on both test sets.
For practitioners, the paper changes two default answers. Model selection: if the shift at hand satisfies the linear relation, picking the best model for future data reduces to picking the best model on the in-distribution test set, within the range of ERM-trained models. Reviewing robustness claims: reporting an OOD gain alone is not a win, because moving along the line, meaning better ID, buys OOD gains for free. The bar is landing above the ERM trend, and the authors recommend that robustness papers include an ID-OOD scatter plot and report both accuracies.
The deliverable here is an empirical law plus a toy theory, not a training technique. Its real contribution is turning "is OOD performance a function of ID performance?" from a philosophical question into a measurable one, with the first map of where the answer is yes.
The authors state that linearity is not universal, with Camelyon17-WILDS and parts of CIFAR-10-C as counterexamples, that it is unclear whether improving ID accuracy is the best route to OOD performance, and that the theory covers only linear classifiers in a Gaussian setup.
Two things look shaky on a close read. From-scratch models on iWildCam-WILDS have R² = 0.536, the lowest value in the table, yet the pair is still listed under "precise linear trends", so the classification bar is generous. The FAQ itself constructs model families that violate the probit-line, by switching between a real classifier and a random one with probability p, so the line constrains the model family less than it appears. And correlation is not causation: nothing here shows that ID gains cause OOD gains; both are plausibly driven by the same factors.