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

Hiroki Naganuma, Ryuichiro Hataya

TL;DR

This paper empirically investigates how selecting pre-trained models impacts their performance on out-of-distribution (OOD) generalization and calibration tasks. They found that choosing larger models and models pre-trained on larger datasets significantly boosts OOD accuracy and improves calibration, often more than algorithmic improvements alone.

What Problem Does This Paper Address?

In computer vision, fine-tuning pre-trained models is a common approach for tasks where the data distribution might differ from the training data (out-of-distribution or OOD generalization). While much research focuses on developing better fine-tuning algorithms, this paper argues that the choice of the pre-trained model itself is a critical, yet often overlooked, factor. They aim to systematically understand how different aspects of pre-trained models—like their size, the data they were trained on, and their architecture—influence their ability to generalize to unseen data and how reliably they express their confidence (calibration).

Methods

The authors conducted a large-scale empirical study. They evaluated 100 pre-trained models across various architectures, sizes, and pre-training datasets. These models were then fine-tuned on four distribution shift datasets. The key metrics used to evaluate performance were:

  • Out-of-Distribution (OOD) Accuracy: How well the model performs on data from a different distribution than its training data.
  • Expected Calibration Error (ECE): A measure of how well a model's predicted probabilities (its confidence) align with its actual accuracy. Lower ECE means better calibration.

They also introduced Adaptive Calibration Error (ACE) as a more robust alternative to ECE, though they found similar trends. The study involved extensive computational resources, totaling over 120,000 GPU hours.

Datasets

The study utilized the following datasets:

  • Pre-training Datasets: ImageNet-1k, ImageNet-12k, ImageNet-21k, ImageNet-22k, and JFT-300M.
  • Downstream OOD Datasets: PACS, OfficeHome, DomainNet, and VLCS (from the DomainBed benchmark), and Camelyon17 (from the WILDS benchmark).

Key Insights and Ideas

  • Pre-trained Model Selection is King: The choice of pre-trained model can lead to substantial improvements in OOD accuracy, often surpassing gains from algorithmic advancements alone.
  • Bigger is Better (Generally): Larger pre-trained models (more parameters) and models pre-trained on larger datasets consistently lead to better OOD generalization and improved calibration.
  • Modern Architectures Shine: Newer architectures like Vision Transformers (ViT) and ConvNeXt tend to achieve higher OOD accuracy than traditional CNNs like ResNet and EfficientNet, especially when comparing models of similar size.
  • Scaling Laws Hold for Calibration Too: The observed "scaling laws" (performance improvements with size/data) for OOD generalization also apply to calibration, suggesting a deeper connection between model capacity and reliable uncertainty estimation.
  • Generic Training is Key: Models trained with generic methodologies tend to be more transferable to OOD tasks, whereas techniques specifically optimized for in-distribution performance (like on ImageNet-1k) can lead to overfitting and poorer OOD generalization.

Key Results

  • The best pre-trained model selection boosted OOD accuracy by up to 22.7% compared to improvements from learning algorithms alone (which were up to 2%).
  • Larger models and larger pre-training datasets consistently improved both OOD accuracy and calibration across various architectures and datasets.
  • The study found that increasing model size leads to a nearly linear decrease in OOD error on a log-scale of parameters, a novel finding that parallels scaling laws for OOD error.
  • While some studies found modern deep networks to be worse calibrated than classical ones in IID settings, this paper shows that in OOD settings, larger models tend to improve calibration.

Limitations and Future Work

  • Overfitting to ImageNet-1k: The authors observed that some models, particularly EfficientNets, might overfit to the ImageNet-1k pre-training dataset, leading to suboptimal OOD generalization. This suggests that generalization on pre-training datasets doesn't always directly translate to fine-tuned OOD performance.
  • Computational Cost: The extensive experiments required over 120,000 GPU hours, highlighting the computational demands of such studies.
  • Future Work: The authors suggest that future research should focus on developing computationally efficient methods for OOD generalization, building upon the solid baselines established by optimal pre-trained model selection. They also emphasize the need for continued research into the interplay between model selection, generalization, and calibration.

Summary updated

Abstract

In the realm of out-of-distribution generalization tasks, finetuning has risen as a key strategy. While the most focus has been on optimizing learning algorithms, our research highlights the influence of pre-trained model selection in finetuning on out-of-distribution performance and inference uncertainty. Balancing model size constraints of a single GPU, we examined the impact of varying pre-trained datasets and model parameters on performance metrics like accuracy and expected calibration error. Our findings underscore the significant influence of pre-trained model selection, showing marked performance improvements over algorithm choice. Larger models outperformed others, though the balance between memorization and true generalization merits further investigation. Ultimately, our research emphasizes the importance of pre-trained model selection for enhancing out-of-distribution generalization.
BibTeX
@article{naganuma2025empirical,
  author = {Hiroki Naganuma and Ryuichiro Hataya},
  title = {{An Empirical Investigation of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure