Optimal transfer protocol by incremental layer defrosting

Federica Gerace, Diego Doimo, Stefano Sarao Mannelli, Luca Saglietti, Alessandro LaioarXiv 2023 · DOI

Abstract

Transfer learning is a cornerstone of modern deep learning, yet the selection of "transfer depth"—the specific point at which pre-trained layers are frozen—remains largely heuristic. This paper introduces layer-wise defrosting, a systematic protocol to identify the optimal number of layers to freeze. By incrementally unfreezing and re-initializing layers from the output back to the input, the authors demonstrate that the ideal transfer depth is a dynamic target influenced by dataset size and task similarity. Optimal defrosting can yield performance gains equivalent to a 10-fold increase in training data compared to standard freezing practices.

Introduction

The standard paradigm in transfer learning involves taking a model pre-trained on a source task (e.g., ImageNet) and adapting it to a target task by freezing early feature-extraction layers and training only the final layers. However, this approach faces a fundamental trade-off: freezing too many layers makes the model too rigid for the new task, while freezing too few can lead to overfitting on small target datasets. This paper addresses the lack of a principled method for finding the "sweet spot" of transfer depth.

Methods: Layer-Wise Defrosting

The authors propose a protocol called layer-wise defrosting to map the performance landscape of a model across different transfer depths. Instead of selecting a depth arbitrarily, the protocol systematically evaluates performance by incrementally unfreezing and re-initializing layers, starting from the output and moving toward the input.

Schematic of the layer-wise defrosting protocol, showing how accuracy profiles are constructed by systematically unfreezing layers.

Key technical components include:

  • Defrosting Profiles: Curves plotting target task accuracy against the number of frozen layers.
  • Information Imbalance (II): A non-parametric metric measuring topological similarity between internal representations. II is used to predict optimal transfer depth by identifying where source and target representations diverge.
  • Compliant Learning: A phenomenon where early layers are regularized to remain close to pre-trained weights without sacrificing performance.

Experimental Setup

The study utilizes both real-world and synthetic datasets to control for task similarity:

  • Real-world: CIFAR-10, ImageNet, and a Breast Cancer histopathology dataset.
  • Synthetic Clones: To isolate the effects of distribution shift, the authors created a hierarchy of CIFAR-10 approximations: IsoGM (matching means), GM (matching means and covariances), and L256 (high-fidelity autoencoder reconstruction).

Key Insights

The Moving Target of Optimal Depth

A critical finding is that the optimal transfer depth is not a static property of the model or task pair. As the target dataset size increases, the optimal "cut" point shifts toward the input, meaning more layers should be unfrozen and retrained to capture task-specific nuances.

Data Efficiency Gains

Identifying the optimal defrosting point significantly improves data efficiency. In medical imaging experiments, optimal defrosting with 5,000 samples matched the performance of a standard "vanilla" frozen model using 50,000 samples—a 10x improvement in data utility.

Topological Similarity

The authors show that weight-based distances are poor predictors of transferability due to neural network degeneracy. Instead, the Information Imbalance metric, which focuses on the topology of representations, successfully predicts the "break point" where representations diverge between tasks, typically at down-sampling layers.

Results

The effectiveness of the defrosting protocol is evident across various source-target pairs. In the GM → CIFAR-10 and ImageNet → Breast Cancer tasks, the defrosting profiles reveal clear optimal depths that vary with the amount of available training data.

Defrosting profiles for GM to CIFAR-10 (top) and ImageNet to Breast Cancer (bottom) across different target dataset sizes. Darker lines indicate larger datasets.

As shown in the results, retraining a specific subset of layers (e.g., the last 15-20 layers in GM → CIFAR-10) consistently outperforms retraining only the final layer or the entire network, especially in data-constrained regimes.

Conclusion

Layer-wise defrosting provides a principled framework for optimizing transfer learning. By moving beyond simple heuristics, practitioners can achieve significant performance and data-efficiency gains. Future work will aim to develop theoretical models to predict optimal depth without exhaustive defrosting cycles and explore the impact of varying labeling rules on transferability.

Summary updated

BibTeX
@misc{gerace2023optimal,
  author = {Federica Gerace and Diego Doimo and Stefano Sarao Mannelli and Luca Saglietti and Alessandro Laio},
  title = {{Optimal transfer protocol by incremental layer defrosting}},
  year = {2023},
  eprint = {2303.01429},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.01429},
}
Figure