An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration

Hiroki Naganuma, Ryuichiro Hataya, Kotaro Yoshida, Ioannis Mitliagkas

TL;DR

Choosing the right pre-trained model—specifically larger architectures trained on more data—is a significantly more powerful lever for out-of-distribution (OOD) performance than developing complex new learning algorithms. This extensive study of 100 models reveals that scaling up not only boosts OOD accuracy but also improves confidence calibration, effectively mitigating the overconfidence issues often seen in smaller models.

What Problem Does This Paper Address?

Machine learning models often fail when the data they encounter in the real world differs from their training data—a challenge known as Out-of-Distribution (OOD) generalization. To date, the research community has largely focused on developing sophisticated learning algorithms (like Invariant Risk Minimization) to bridge this gap.

However, the authors of this paper argue that we’ve overlooked a simpler, more effective variable: pre-trained model selection. They set out to systematically investigate how a model's size, its pre-training dataset, and its training strategy impact its ability to generalize and remain well-calibrated (i.e., its confidence matches its actual accuracy) when faced with distribution shifts.

Methods

The researchers conducted a massive empirical study involving over 120,000 GPU hours. They evaluated 100 different pre-trained models from the popular timm library, covering a wide range of architectures including ResNets, ConvNeXts, Vision Transformers (ViTs), and MLP-Mixers.

Key methodological choices included:

  • Three Scaling Axes: They varied model parameter size (from 3M to 600M), pre-training dataset size (ImageNet-1k to JFT-300M), and training strategies (e.g., different data augmentations like AugReg).
  • Fine-tuning Protocol: Models were fine-tuned using standard Empirical Risk Minimization (ERM) rather than specialized OOD algorithms to isolate the impact of the model choice itself.
  • Calibration Metrics: Beyond just accuracy, they measured Expected Calibration Error (ECE) and Adaptive Calibration Error (ACE) to see if larger models become dangerously overconfident or more reliable OOD.

Datasets

The study utilized five primary benchmarks for OOD evaluation, summarized in the table below:

Table 2: Datasets from the DomainBed (Gulrajani & Lopez-Paz, 2021) and WILDS (Koh et al., 2021) Banckmark used in our experiments. Domains with bold faces are used as out-of-distribution test domains, and others are used for (in-domain) training and validation.

These include PACS, OfficeHome, DomainNet, and VLCS from the DomainBed benchmark, plus Camelyon17 (medical imaging) from the WILDS benchmark.

Key Insights and Ideas

  • Scaling Laws for OOD: The authors discovered that OOD error and calibration error (ECE) decrease almost linearly on a log-scale as model parameters and pre-training data increase. This suggests that the "scaling laws" observed for in-distribution performance also hold true for robustness.
  • Model Selection > Algorithm Tweaking: The performance gains from simply picking a better, larger pre-trained model often dwarf the gains from years of algorithmic research. For example, switching from a ResNet-50 to a larger ViT provided a much bigger boost than any specialized OOD algorithm tested on the same ResNet-50.
  • The Calibration Reversal: Previous studies in standard (IID) settings suggested that modern deep networks are poorly calibrated compared to older, shallower ones. This paper finds the opposite for OOD: larger models and more data actually improve calibration, helping models "know what they don't know."
  • Overfitting to Pre-training: Some models, like EfficientNets, showed a tendency to overfit to their specific pre-training data (ImageNet-1k), leading to poorer transferability to OOD tasks compared to more "generic" designs like RegNets or ViTs.

Key Results

The most striking result is the comparison between algorithmic improvements and model selection improvements. As shown in the table below, the "Best Model" (a larger ViT) consistently outperformed the "Best Algorithm" (applied to a standard ResNet-50) by massive margins—up to 22.7 percentage points on the OfficeHome dataset.

Table 1: Comparison of OOD test accuracy of ResNet- 50 trained with ERM (Vapnik, 1991), ResNet-50 with the best algorithms (Best Alg.) reported in Gulrajani & Lopez-Paz (2021), and a larger model (ViT-base pre- trained on ImageNet-21k for VLCS and ViT-large pre- trained on ImageNet-21k for other tasks) trained with ERM. ∆indicates the improvement from results with the best algorithms to results with the best models. Baseline results are adopted from Gulrajani & Lopez- Paz (2021).

Furthermore, Figure 1 illustrates the "best of both worlds" trend: as models move toward the bottom-right (higher accuracy, lower calibration error), they tend to be larger (indicated by larger marker sizes).

Figure 1: This paper investigates the out-of-distribution (OOD) generalization and confidence calibration of a total of 100 ImageNet pre-trained models on five datasets from DomainBed (Gulrajani & Lopez-Paz, 2021) and WILDS (Koh et al., 2021). These panels show the relationship between expected calibration error (ECE) rates (lower is better) and OOD test accuracy (higher is better). Marker sizes are proportional to the number of model parameters, and marker shapes correspond to pre-training configurations. We can observe a general trend that larger models achieve the best of both worlds (bottom-right corner), except for VGGs and MLP-Mixers. The full legend can be found in fig. D.6.

Limitations and Future Work

  • Data Leakage Concerns: The authors noted that models like CLIP might have seen data during pre-training that overlaps with OOD test domains (e.g., the "sketch" domain in DomainNet), which could inflate their perceived robustness.
  • Computational Cost: While larger models perform better, they are significantly more expensive to fine-tune and deploy. The authors suggest that future work should focus on developing computationally efficient methods that can achieve similar OOD benefits.
  • Architecture Specifics: While the study is broad, it primarily focuses on the ImageNet family of pre-training. Exploring these trends in purely self-supervised or multi-modal settings remains an open area.

Summary updated

Abstract

In the field of computer vision, fine-tuning pre-trained models has become a prevalent strategy for out-of-distribution (OOD) generalization tasks. Different from most prior work that has focused on advancing learning algorithms, we systematically examined how pre-trained model size, pre-training dataset size, and training strategies impact generalization and confidence calibration on downstream tasks. We evaluated 100 models across diverse pre-trained model sizes, five pre-training datasets, and five data augmentations through extensive experiments on four distribution shift datasets totaling over 120,000 GPU hours. Our results demonstrate the significant impact of pre-trained model selection, with optimal choices substantially improving OOD accuracy over algorithm improvement alone. Additionally, we find that larger models and bigger pre-training datasets not only enhance OOD performance but also improve calibration, helping to mitigate overconfidence, contrary to some prior studies that found modern deep networks to calibrate worse than classical shallow models. Our work underscores the overlooked importance of pre-trained model selection for out-of-distribution generalization and calibration.
BibTeX
@article{naganuma2025empirical,
  author = {Hiroki Naganuma and Ryuichiro Hataya and Kotaro Yoshida and Ioannis Mitliagkas},
  title = {{An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure