On the Connection between Pre-training Data Diversity and Fine-tuning Robustness

Vivek Ramanujan, Thao Nguyen, Sewoong Oh, Ali Farhadi, Ludwig Schmidt

Introduction

In modern computer vision, the standard paradigm involves pre-training a model on a massive, general-purpose dataset like ImageNet before fine-tuning it on a specific target task. While this approach consistently improves accuracy, its impact on robustness—the ability of a model to maintain performance when encountering Out-of-Distribution (OOD) data—is less understood.

This research investigates the specific properties of pre-training data that drive robustness. By systematically isolating variables such as data quantity, semantic relevance, and class diversity, the authors identify which "knobs" in the pre-training process actually improve a model's ability to handle real-world distribution shifts.

Methodology: The Effective Robustness Framework

To quantify robustness, the researchers utilize the effective robustness framework. This method involves plotting a model's In-Distribution (ID) performance against its OOD performance. In this visualization, models that fall on a higher linear trend (closer to the $y=x$ line) demonstrate superior robustness. By holding model architectures (e.g., ResNets, DenseNets) and fine-tuning procedures constant while varying the pre-training data, the authors can pinpoint exactly how different data characteristics shift these trend lines.

Datasets and Ablations

The study employs a wide array of datasets to test various hypotheses:

  • Pre-training Sources: ImageNet-1k (natural images), iNaturalist 2017 (specialized domain), FractalDB-1k (synthetic mathematical fractals), and images generated via Stable Diffusion (synthetic naturalistic images).
  • Downstream Tasks: iWildCam-WILDS (wildlife camera traps with lighting and location shifts) and DomainNet (cross-domain validation).

Key Findings

1. Quantity is the Primary Driver

The single most important factor for effective robustness is the total volume of pre-training data. The researchers found that even a minimal pre-training set—as small as 25,000 images—provides a significant robustness boost compared to training from scratch. As the number of images increases, the robustness trend line consistently shifts upward. Interestingly, using just 5% of ImageNet (roughly 5 images per class) still results in robustness comparable to training from scratch on the much larger iWildCam dataset.

2. The Secondary Role of Semantics

One of the more surprising insights is that the semantic relationship between the pre-training data and the target task is relatively unimportant. In a controlled experiment, the authors pre-trained a model on 600 categories of inanimate objects (e.g., tools, vehicles) and tested it on an animal classification task. The resulting robustness was nearly identical to a model pre-trained on actual animal categories. This suggests that pre-training helps the model learn general visual invariances and low-level features rather than specific object semantics.

3. Diversity vs. Density

The researchers explored the trade-off between the number of classes and the number of images per class. Given a fixed budget of 60,000 images, they compared a "wide" dataset (600 classes with 100 images each) against a "deep" dataset (100 classes with 600 images each). The results showed that the specific distribution of images across classes is a "wash"—the resulting effective robustness remained identical as long as the total image count was constant.

4. The Rise of Synthetic Data

While abstract synthetic data like FractalDB provides some benefit, natural-looking synthetic data generated by Stable Diffusion significantly bridges the gap to real-world data. At smaller scales, synthetic natural images are highly effective, though they still slightly underperform ImageNet at very large scales. This suggests that the "naturalness" of the image distribution is more critical than the presence of real-world objects.

Discussion and Limitations

The study's findings are most pronounced on datasets like iWildCam-WILDS, where distribution shifts are driven by environmental factors. However, the authors note that these benefits are not universal. On other benchmarks, such as fMoW-WILDS (satellite imagery), the gap between pre-trained models and those trained from scratch is much smaller. This suggests that the utility of pre-training is dependent on the specific nature of the distribution shift in the downstream task.

Furthermore, while the study clarifies the roles of quantity and diversity in class-based datasets, the rise of "open-vocabulary" models like CLIP—trained on uncurated image-text pairs—presents new challenges. While CLIP follows the same robustness trends as ImageNet-pre-trained models, defining "diversity" in such uncurated contexts remains an open question for future research.

Conclusion

For practitioners looking to build robust models, the takeaway is clear: prioritize the total volume and "naturalness" of pre-training data over fine-grained semantic alignment or specific class balances. Robustness appears to be a byproduct of exposure to a vast array of natural visual patterns, regardless of whether those patterns represent the specific objects the model will eventually be asked to classify.

Summary updated

BibTeX
@inproceedings{ramanujan2023connection,
  author = {Vivek Ramanujan and Thao Nguyen and Sewoong Oh and Ali Farhadi and Ludwig Schmidt},
  title = {{On the Connection between Pre-training Data Diversity and Fine-tuning Robustness}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=2SScUiWUbn},
}
Figure