Skip to content

Source code for NeurIPS 2023 paper "To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning"

Notifications You must be signed in to change notification settings

isadrtdinov/ens-for-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

This repo is the official source code of NeurIPS-2023 paper:

To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning
By Ildus Sadrtdinov*, Dmitrii Pozdeev*, Dmitry Vetrov, Ekaterina Lobacheva

arXiv / OpenReview / Poster & video

Abstract

Transfer learning and ensembling are two popular techniques for improving the performance and robustness of neural networks. Due to the high cost of pre-training, ensembles of models fine-tuned from a single pre-trained checkpoint are often used in practice. Such models end up in the same basin of the loss landscape, which we call the pre-train basin, and thus have limited diversity. In this work, we show that ensembles trained from a single pre-trained checkpoint may be improved by better exploring the pre-train basin, however, leaving the basin results in losing the benefits of transfer learning and in degradation of the ensemble quality. Based on the analysis of existing exploration methods, we propose a more effective modification of the Snapshot Ensembles (SSE) for transfer learning setup, StarSSE, which results in stronger ensembles and uniform model soups.

Code

Environment

The project requirements are listed in requirements.txt file. To create a pip/conda environment:

# using pip
pip install -r requirements.txt

# using Conda
conda create --name ens_for_transfer --file requirements.txt

Note:

  • As during fine-tuning the images are resized to 224x224 and given batch_size=256, training requires a GPU with at least 32 Gb memory, e.g., NVIDIA V100/A100.
  • Logging is done with the wandb library, so make sure to log in before launching the experiments.

Configuration and training parameters

To see the configuration files and parameters for different training setups, refer to the configs/ directory.

Pre-trained checkpoints

  • BYOL ResNet-50 ImageNet pre-trained checkpoints are available here
  • Supervised ResNet-50 ImageNet checkpoints pre-trained by Asukha et al, 2020
  • Supervised Swin-Tiny ImageNet pre-trained checkpoints are available here

Experiments

Scripts for launching experiments are located in the scripts/ directory. For example, to launch experiments for BYOL ResNet-50 setup, run the following commands:

  • For training baselines (Local DE and Global DE)
python scripts/byol/byol_baseline.py
  • For training SSE with different cycle hyperparameters
python scripts/byol/byol_sse.py
  • For training StarSSE with different cycle hyperparameters
python scripts/byol/byol_starsse.py

Citation

If you found this code useful, please cite our paper:

@inproceedings{sadrtdinov2023to,
    title={To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning},
    author={Ildus Sadrtdinov and Dmitrii Pozdeev and Dmitry P. Vetrov and Ekaterina Lobacheva},
    booktitle={Thirty-seventh Conference on Neural Information Processing Systems (NeurIPS)},
    year={2023},
}

About

Source code for NeurIPS 2023 paper "To Stay or Not to Stay in the Pre-train Basin: Insights on Ensembling in Transfer Learning"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages