Deep Ensembles for Low-Data Transfer Learning

Basil Mustafa, Carlos Riquelme, Joan Puigcerver, André Susano Pinto, Daniel Keysers, Neil Houlsby

Abstract

In the low-data regime, it is difficult to train good supervised models from scratch. Instead practitioners turn to pre-trained models, leveraging transfer learning. Ensembling is an empirically and theoretically appealing way to construct powerful predictive models, but the predominant approach of training multiple deep networks with different random initialisations collides with the need for transfer via pre-trained weights. In this work, we study different ways of creating ensembles from pre-trained models. We show that the nature of pre-training itself is a performant source of diversity, and propose a practical algorithm that efficiently identifies a subset of pre-trained models for any downstream dataset. The approach is simple: Use nearest-neighbour accuracy to rank pre-trained models, fine-tune the best ones with a small hyperparameter sweep, and greedily construct an ensemble to minimise validation cross-entropy. When evaluated together with strong baselines on 19 different downstream tasks (the Visual Task Adaptation Benchmark), this achieves state-of-the-art performance at a much lower inference budget, even when selecting from over 2,000 pre-trained models. We also assess our ensembles on ImageNet variants and show improved robustness to distribution shift.

Introduction

Standard deep ensembling relies on random weight initialization to generate the diversity necessary for performance gains. However, in low-data scenarios (e.g., 1,000 training examples), training from scratch is infeasible, necessitating the use of pre-trained weights. This creates a conflict: if multiple models are fine-tuned from the same pre-trained starting point, they often lack the diversity needed for an effective ensemble, typically converging to similar local minima in the loss landscape.

This paper proposes leveraging upstream diversity—diversity generated during the pre-training phase through different architectures or data subsets—to build superior ensembles for transfer learning.

Methodology: Leveraging Upstream Diversity

The core idea is to shift the source of ensemble diversity from the downstream fine-tuning phase to the upstream pre-training phase. The authors create a massive pool of over 2,000 candidate models by pre-training various architectures (from ResNet-18 to ResNet-101) on different subsets of large-scale datasets like JFT-300M, creating "expert" models alongside standard "generalists."

The proposed pipeline for constructing ensembles from diverse pre-trained models.

To manage this large pool efficiently for a new downstream task, a three-step algorithm is employed:

  1. Model Selection via kNN: Instead of expensive fine-tuning for all candidates, the authors use leave-one-out k-Nearest Neighbors (kNN) accuracy on the pre-trained feature representations as a cheap proxy to rank and select the top $K$ models (typically 15).
  2. Fine-tuning: These $K$ models are fine-tuned on the downstream task with a small hyperparameter sweep (e.g., 4 learning rate schedules).
  3. Greedy Ensembling: The final ensemble is constructed by iteratively adding models from the fine-tuned pool that most reduce validation cross-entropy.

Experimental Setup

The approach was evaluated on the Visual Task Adaptation Benchmark (VTAB-1k), which includes 19 diverse tasks (Natural, Specialized, and Structured) restricted to only 1,000 training examples each. Upstream models were pre-trained on JFT-300M and ImageNet-21k. Robustness was further tested on several ImageNet distribution-shift variants, such as ImageNet-C, ImageNet-R, and ObjectNet.

Key Results and Discussion

The proposed "ExpertEnsemble" approach achieves state-of-the-art results while maintaining high efficiency.

Performance and Efficiency

The JFT R101 Experts ensemble achieved an average accuracy of 77.6% on VTAB-1k, surpassing the previous single-model state-of-the-art (BiT-L R152x4) at 76.2%. Crucially, this performance is achieved with significantly lower computational cost.

Performance vs. compute (FLOPs) on VTAB-1k. ExpertEnsembles outperform single-model SOTA at significantly lower inference costs.

As shown in the figure above, ensembles of smaller models (like ResNet-50s) can outperform massive single models while using less than a sixth of the inference FLOPs. The independent nature of ensemble components also allows for easy parallelization across hardware.

Robustness and Generalization

Beyond raw accuracy, upstream diversity significantly enhances robustness. On ImageNet distribution shift benchmarks, ExpertEnsembles outperformed "HyperEnsembles" (which rely on downstream hyperparameter diversity) by an average of +2.2 absolute accuracy points. The study also highlights that "Expert" models are particularly effective when the upstream and downstream domains align (e.g., natural images), whereas "Generalist" models are more robust for structured or synthetic tasks.

Conclusion and Future Work

This work demonstrates that pre-training is a powerful and efficient source of diversity for ensembles in transfer learning. By using a simple kNN-based selection mechanism, practitioners can leverage massive model zoos to achieve SOTA performance with reduced compute. Future research directions include extending this framework to self-supervised pre-training and exploring parameter-efficient ensembling techniques to reduce the memory footprint of storing multiple independent models.

Summary updated

BibTeX
@misc{mustafa2020deep,
  author = {Basil Mustafa and Carlos Riquelme and Joan Puigcerver and André Susano Pinto and Daniel Keysers and Neil Houlsby},
  title = {{Deep Ensembles for Low-Data Transfer Learning}},
  year = {2020},
  eprint = {2010.06866},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.06866},
}
Figure