To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning

Ildus Sadrtdinov, Dmitrii Pozdeev, Dmitry Vetrov, Ekaterina Lobacheva

In the world of deep learning, two tricks are almost guaranteed to boost performance: transfer learning (starting with a pre-trained model) and ensembling (averaging multiple models). However, combining them efficiently is surprisingly tricky. A new paper from researchers at HSE University and TUM, presented at NeurIPS 2023, dives into the "loss landscape" to explain why and offers a clever new way to build better ensembles without breaking the bank.

TL;DR

The authors identify the "pre-train basin"—a region of the loss landscape where models fine-tuned from the same checkpoint reside—and show that leaving this basin destroys transfer learning benefits. They introduce StarSSE, a parallel ensembling method that maximizes diversity within this basin to create stronger ensembles and "model soups" more efficiently than standard techniques.

What Problem Does This Paper Address?

Training multiple independent neural networks from scratch to form a "Global Deep Ensemble" is the gold standard for accuracy and robustness, but it's prohibitively expensive because you have to pre-train every single member.

In practice, engineers often fine-tune multiple models from a single pre-trained checkpoint (a "Local Deep Ensemble"). The problem? These models aren't very diverse. They all tend to fall into the same "basin" of the loss landscape—the pre-train basin. While you can try to force them out of this basin to increase diversity using techniques like Snapshot Ensembles (SSE), the authors found a catch-22: if you push the models far enough to leave the basin, they lose the "knowledge" gained during pre-training, and their individual quality plummets.

Methods

The researchers analyzed Snapshot Ensembles (SSE), which uses a cyclical learning rate to "jump" to different minima during a single training run. They discovered that in a transfer learning setup, standard SSE is flawed because it is sequential: each new model starts where the last one left off, drifting further and further away from the high-quality pre-trained starting point.

To fix this, they proposed StarSSE:

  1. Base Fine-tuning: Fine-tune one model from the pre-trained checkpoint normally.
  2. Parallel Exploration: Instead of a sequence, they start multiple independent "rays" of exploration directly from that first fine-tuned model.
  3. Cyclical Schedules: Each ray uses a short, high-learning-rate burst to find a diverse neighbor, but because they all start from the same high-quality base, they don't suffer from the progressive degradation seen in sequential SSE.

This "star" structure ensures all models stay within the beneficial pre-train basin while being as diverse as possible. They also show these models are excellent candidates for Model Soups—where you average the weights of the models instead of just their predictions.

Datasets

The authors conducted an extensive evaluation across:

  • Standard Vision Tasks: CIFAR-10, CIFAR-100, and SUN-397 using ResNet-50.
  • Pre-training Variations: Both supervised (ImageNet) and self-supervised (BYOL) initializations.
  • Large-scale Models: CLIP ViT-B/32 on ImageNet.
  • Out-of-Distribution (OOD): CIFAR-100C (corrupted images) to test robustness.
  • Non-natural Images: Medical images (ChestX) and Clipart.

Key Insights and Ideas

  • The Linear Connectivity Discovery: The authors confirm that models fine-tuned from the same checkpoint are "linearly connected." You can draw a straight line between their weights in high-dimensional space without hitting a "wall" of high loss. This defines the boundaries of the pre-train basin.
  • The Diversity Trap: In standard training, more diversity is usually better. In transfer learning, too much diversity (leaving the basin) is toxic. It leads to overfitting on the small target dataset and forgetting the general features learned during pre-training.
  • StarSSE Stability: Because StarSSE is parallel, it is much more stable than sequential SSE. As you add more models to the ensemble, the accuracy continues to improve or stays high, whereas sequential SSE often starts to degrade after a few cycles.
Figure 1: Results of SSEs (top row) and StarSEEs (bottom row) of different sizes on CIFAR-100 for different types of pre-training and varying values of cycle hyperparameters (maximum learning rate and number of epochs). Local and Global DEs are shown for comparison with gray dotted lines.

Key Results

  • Outperforming Baselines: StarSSE consistently beat standard Local Deep Ensembles and standard SSE across almost all tests. For example, on CIFAR-100 (supervised), StarSSE achieved 86.30% accuracy compared to 85.65% for a standard local ensemble.
  • Closing the Gap: While it doesn't fully reach the performance of a "Global" ensemble (which uses 5 different pre-trained checkpoints), StarSSE significantly narrows the gap for a fraction of the computational cost.
  • Superior Soups: StarSSE models are particularly good for weight-averaging. A "uniform soup" of StarSSE models often matches or beats the performance of the full ensemble, providing a "free" boost at inference time.
  • CLIP Success: In large-scale experiments with CLIP on ImageNet, StarSSE outperformed the baseline by a significant margin, proving the method scales to modern, massive models.

Limitations and Future Work

  • Hyperparameter Sensitivity: The optimal "jump" distance (learning rate and cycle length) varies by task. While the authors provide a grid search, a more automated way to find these would be beneficial.
  • Domain Specifics: On very specialized datasets like medical images (ChestX), the benefits were less pronounced, suggesting that the "pre-train basin" might behave differently when the target task is extremely far from the source task.
  • The Global Gap: There is still a "diversity gap" between models from one checkpoint vs. many. Future work could explore how to simulate the diversity of multiple pre-trainings without actually doing them.

Summary updated

BibTeX
@inproceedings{sadrtdinov2023stay,
  author = {Ildus Sadrtdinov and Dmitrii Pozdeev and Dmitry Vetrov and Ekaterina Lobacheva},
  title = {{To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=NNooZoQpP4},
}

Loading related content...

Figure