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 · OpenReview

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.

Introduction

Machine learning models often fail catastrophically when test data differs from training data—a phenomenon known as distribution shift. To address this, researchers have proposed various proxies for robustness, including calibration, adversarial training, and synthetic corruptions. However, these sub-fields often operate in silos, particularly within the context of transfer learning. This study provides a massive-scale "reality check" for out-of-distribution (OOD) generalization, evaluating how architecture choices, augmentations, and fine-tuning strategies affect robustness across 172 dataset pairs.

Methodology

The authors conducted an extensive empirical study fine-tuning over 31,000 networks across nine architectures, including ResNets, Vision Transformers (ViT), and MLP-Mixers. Performance was evaluated using six key metrics: classification error, negative log-likelihood (NLL), demographic disparity, expected calibration error (ECE), and adversarial robustness.

The study utilized 36 publicly available datasets grouped into 10 tasks, resulting in 172 in-distribution (ID) and OOD pairs. These included natural shifts (e.g., DomainNet, PACS), specialized benchmarks (e.g., WILDS), and synthetic shifts (ImageNet-C corruptions). Statistical factor analysis was employed to identify latent factors explaining model performance across these diverse conditions.

Challenging the "Accuracy on the Line" Hypothesis

A central finding of this work is the nuance in the relationship between ID and OOD performance. While previous literature suggested a simple linear relationship, this study reveals that the trend is highly dataset-dependent.

Diverse relationships between ID and OOD accuracy across different datasets, showing linear trends, underspecification (vertical), and lack of transfer (no clear trend).

In many cases, the researchers observed "underspecification," where models with identical ID accuracy exhibit wildly different OOD performance. Furthermore, robustness to synthetic corruptions or adversarial attacks was found to be a distinct factor from natural OOD performance, suggesting that synthetic proxies are not always reliable indicators of real-world domain shift resilience.

Key Results and Recommendations

The empirical analysis yields several critical insights for practitioners:

  1. ID Accuracy is King: Despite the complexities, ID classification error remains the strongest single predictor of OOD error. Improving a model's base performance is typically the most effective first step toward robustness.
  2. The Fragility of Calibration: Models that appear well-calibrated on ID data often lose this property entirely under OOD shifts.
  3. Architecture and Augmentation: Vision Transformers (e.g., DeiT, Swin) generally generalize better than ResNets. Additionally, augmentations like RandAugment and AugMix consistently improve performance without significant trade-offs.
Correlations between various ID and OOD metrics. ID error shows the strongest correlation with OOD error, while synthetic metrics show lower correlation with natural shifts.

The study also recommends "multi-domain validation": evaluating a model on a different OOD dataset than the target is a better predictor of robustness than any synthetic proxy.

Limitations and Future Outlook

While comprehensive, this study focused on downstream fine-tuning with fixed pre-training. Future work should explore how different pre-training objectives (e.g., self-supervised learning) influence these dynamics. Additionally, as the findings are vision-centric, extending this analysis to natural language processing and other modalities is necessary. Understanding the specific causes of underspecification—whether due to hyperparameters or random seeds—remains an open challenge for the field.

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