Assaying Out-Of-Distribution Generalization in Transfer Learning

Florian Wenzel, Andrea Dittadi, Peter Vincent Gehler, Carl-Johann Simon-Gabriel, Max Horn, Dominik Zietlow, David Kernert, Chris Russell, Thomas Brox, Bernt Schiele, Bernhard Schölkopf, Francesco Locatello

This NeurIPS 2022 paper, "Assaying Out-Of-Distribution Generalization in Transfer Learning," provides a massive empirical reality check for the machine learning community. By fine-tuning over 31,000 models across 172 dataset pairs, the authors investigate whether the "tricks of the trade" for robustness—like adversarial training or synthetic corruptions—actually help when a model encounters real-world distribution shifts.

TL;DR

The best way to ensure a model performs well out-of-distribution (OOD) is simply to make it perform better in-distribution (ID). While many researchers have proposed proxy metrics like adversarial robustness or synthetic corruption resistance as indicators of OOD success, this study finds they offer almost no additional predictive power once you account for standard accuracy.

What Problem Does This Paper Address?

Machine learning models famously break when the test data looks different from the training data (the "OOD problem"). Because OOD generalization is an "ill-posed" problem—meaning there are infinite ways a distribution could shift—different research sub-communities have developed their own "proxies" for robustness. One group might focus on adversarial attacks, another on synthetic blurs and noise (corruptions), and another on calibration.

However, these strategies are rarely tested under the same experimental conditions on real-world data. Practitioners are left wondering: If I make my model robust to Gaussian noise, will it actually perform better on a new satellite dataset? This paper seeks to unify these disparate views and provide concrete recommendations for transfer learning workflows.

Methods

The authors adopted a standard computer vision workflow: take a model pre-trained on ImageNet and fine-tune it on a downstream task. They explored several degrees of freedom:

  • Architectures: Nine different models, including CNNs (ResNet, DenseNet) and Transformers (ViT, Swin, DeiT).
  • Fine-tuning Strategies: Full fine-tuning vs. "linear probing" (tuning only the head).
  • Data Scarcity: Full datasets vs. few-shot settings (10 or 100 examples per class).
  • Augmentations: Standard vs. RandAugment and AugMix.

To analyze the results, they used Factor Analysis to see which metrics move together and Adjusted Predictiveness Scores to determine if a metric (like adversarial error) tells you anything about OOD performance that standard ID accuracy hasn't already told you.

Datasets

The study utilized 36 datasets grouped into 10 distinct tasks, creating 172 (ID, OOD) pairs. These included:

  • Natural Shifts: DomainNet (Clipart, Sketch, Real), PACS, VLCS, and Terra Incognita.
  • Medical/Satellite Shifts: Wilds benchmark (Camelyon17, FMoW).
  • Synthetic Shifts: 17 types of corruptions (ImageNet-C style) applied to the ID test sets.
  • Simulated Shifts: SVIRO (synthetic vehicle interiors).

Key Insights and Ideas

  • The "Accuracy on the Line" Hypothesis is Fragile: Previous studies suggested a linear relationship where improving ID accuracy automatically improves OOD accuracy. This paper shows that while they often move together, the relationship is highly task-dependent. In some tasks, you hit a "vertical line" where ID accuracy is perfect, but OOD performance varies wildly (underspecification).
Figure 2: Typical scatter plot patterns observed in our data (see Appendix D for all plots). Increasing line: ID and OOD accuracy show a clear functional dependency. In contrast to previous claims this is not the typical setting (only observed on a subset of datasets). Vertical line: the same ID peformance leads to different OOD behavior (underspecification setting). Horizontal line close to zero accuracy: no transfer of information from the ID to the OOD dataset. No clear trend: random associations between ID and OOD accuracy (i.e., zero correlation).
  • Proxies are Redundant: Factor analysis revealed that ID accuracy, adversarial robustness, and corruption resistance all load onto the same latent factor. In plain English: they are all measuring the same underlying "capability."
Figure 1: Factor loadings (contributions) of different metrics based on a factor analysis with 4 orthogonal fac- tors (color-coded), highlighting similarities between the metrics. The factor Blue: captures classification error, adversarial error, log-likelihood, and their corrupted vari- ants. Green: only in OOD metrics. Yellow: expected calibration error. Red: demographic disparity.
  • Calibration Doesn't Transfer: A model that is "well-calibrated" (its confidence matches its accuracy) on training data is not necessarily well-calibrated when the distribution shifts. Calibration appears to be its own independent factor that doesn't generalize well.
  • Architecture Matters: Even when ID accuracies are similar, Transformers (specifically DeiT and Swin) generally showed better OOD generalization than older architectures like standard ViT-B or ResNets.

Key Results

  • ID Accuracy is the Best Predictor: ID classification error is the strongest predictor of OOD error.
  • The Power of Held-out OOD Data: If you have access to any other OOD dataset during validation (multi-domain evaluation), use it. It is a significantly better predictor of performance on a third unseen domain than any ID metric.
Predictiveness of OOD error. The green bars show that once adjusted for ID error, most proxies (like adversarial or corruption error) provide almost no new information.
  • Augmentation is a "Free Lunch": Techniques like RandAugment and AugMix consistently improved OOD robustness, especially in few-shot scenarios, without the trade-offs often seen in adversarial training.

Limitations and Future Work

The authors acknowledge that their study focused on transfer learning from ImageNet. The results might differ for models trained from scratch or using self-supervised objectives. Furthermore, while they explored many architectures, the hyperparameter grid was necessarily constrained to keep the 31k-model sweep computationally feasible (which still took 17 GPU-years!).

Future research should focus on synthetic interventional distributions—using generative models to create specific shifts—rather than relying on hand-crafted corruptions like "blur" or "noise," which this paper proves are poor mimics for real-world distribution shifts.

Summary updated

Abstract

Since out-of-distribution generalization is a generally ill-posed problem, various proxy targets (e.g., calibration, adversarial robustness, algorithmic corruptions, invariance across shifts) were studied across different research programs resulting in different recommendations. While sharing the same aspirational goal, these approaches have never been tested under the same experimental conditions on real data. In this paper, we take a unified view of previous work, highlighting message discrepancies that we address empirically, and providing recommendations on how to measure the robustness of a model and how to improve it. To this end, we collect 172 publicly available dataset pairs for training and out-of-distribution evaluation of accuracy, calibration error, adversarial attacks, environment invariance, and synthetic corruptions. We fine-tune over 31k networks, from nine different architectures in the many- and few-shot setting. Our findings confirm that in- and out-of-distribution accuracies tend to increase jointly, but show that their relation is largely dataset-dependent, and in general more nuanced and more complex than posited by previous, smaller scale studies.
BibTeX
@inproceedings{wenzel2022assaying,
  author = {Florian Wenzel and Andrea Dittadi and Peter Vincent Gehler and Carl-Johann Simon-Gabriel and Max Horn and Dominik Zietlow and David Kernert and Chris Russell and Thomas Brox and Bernt Schiele and Bernhard Schölkopf and Francesco Locatello},
  title = {{Assaying Out-Of-Distribution Generalization in Transfer Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=57Ryl7lLD4h},
}
Figure