Rethinking Two Consensuses of the Transferability in Deep Learning

Yixiong Chen, Jingxian Li, Chris Ding, Li LiuarXiv 2022

Abstract

Deep transfer learning (DTL) has formed a long-term quest toward enabling deep neural networks (DNNs) to reuse historical experiences as efficiently as humans. This ability is named knowledge transferability. A commonly used paradigm for DTL is firstly learning general knowledge (pre-training) and then reusing (fine-tuning) them for a specific target task. There are two consensuses of transferability of pre-trained DNNs: (1) a larger domain gap between pre-training and downstream data brings lower transferability; (2) the transferability gradually decreases from lower layers (near input) to higher layers (near output). However, these consensuses were basically drawn from the experiments based on natural images, which limits their scope of application. This work aims to study and complement them from a broader perspective by proposing a method to measure the transferability of pre-trained DNN parameters. Our experiments on twelve diverse image classification datasets get similar conclusions to the previous consensuses. More importantly, two new findings are presented, i.e., (1) in addition to the domain gap, a larger data amount and huge dataset diversity of downstream target task also prohibit the transferability; (2) although the lower layers learn basic image features, they are usually not the most transferable layers due to their domain sensitivity.

Introduction

In the standard Deep Transfer Learning (DTL) paradigm, models are typically pre-trained on large-scale datasets like ImageNet before being fine-tuned for specific downstream tasks. This approach traditionally relies on two widely accepted "consensuses": first, that transferability is primarily determined by the "domain gap" between source and target data; and second, that early layers capture general features while later layers capture task-specific ones.

However, these rules were largely established through experiments on natural images, potentially oversimplifying the dynamics of knowledge transfer. This paper challenges these assumptions by introducing a quantitative metric for transferability and evaluating it across a diverse set of twelve downstream datasets, ranging from medical imaging to non-photorealistic domains like DomainNet.

Quantifying Transferability

To move beyond semi-quantitative observations, the authors propose a metric, $T_B$, based on optimization distance. Transferability is defined as the ratio of the distance a model travels from a random initialization ($\theta_r$) to a solution ($\theta_{SB}$), compared to the distance it travels from a pre-trained starting point ($\theta_A$) to a solution ($\theta_{FB}$).

$$T_B(\theta_A) = \frac{D(\theta_r, \theta_{SB})}{D(\theta_A, \theta_{FB})}$$

A value of $T_B > 1$ indicates that pre-training effectively shortens the optimization path. To ensure robustness across different network architectures, this metric is averaged across layers to account for varying parameter scales.

Geometric interpretation of the transferability metric $T_B$ as optimization distance (a) and its layer-wise application (b).

Dataset Characteristics: Gap vs. Width

The study introduces two key metrics to characterize downstream datasets:

  1. Domain Gap ($G$): Measured using Maximum Mean Discrepancy (MMD) to determine the distributional distance from the pre-training source (ImageNet).
  2. Domain Width ($W$): A measure of the internal diversity within the target dataset itself.
The landscape of downstream datasets plotted by Domain Gap and Domain Width, highlighting the diversity of the experimental setup.

Key Findings

1. Diversity and Volume as Transfer Barriers

While domain gap is a factor, the authors find that Domain Width and Data Amount ($N$) are often more significant hurdles to transferability. A regression analysis yielded the following relationship: $$\log(T) \approx -0.02G - 0.14W - 0.80\log(N) + 2.86$$ The higher coefficients for $W$ and $\log(N)$ suggest that internal dataset complexity and sheer volume can "dilute" the benefits of pre-trained priors. In cases with high data volume, the model must move further from its initialization to accommodate specific nuances, relying less on the pre-trained "historical experience."

2. The Inverted U-Shape of Layer Transferability

Contrary to the belief that early layers are the most "general," the authors observed an inverted U-shaped curve for layer-wise transferability. The very first layer often exhibits lower transferability than subsequent early layers. This is attributed to the first layer's high sensitivity to basic visual patterns like resolution and local textures; when these differ significantly from the pre-training domain (e.g., moving from ImageNet's 224x224 to CIFAR's 32x32), the first layer requires substantial re-learning, making it less transferable than the middle-to-early layers.

Conclusion

This research provides a more nuanced understanding of transferability in deep learning. By identifying dataset diversity and volume as critical factors and uncovering the domain sensitivity of the initial layers, the authors offer a foundation for more sophisticated fine-tuning strategies. These findings suggest that practitioners should consider layer-specific sensitivities and dataset complexity when deciding which layers to freeze or how to schedule learning rates during transfer.

Summary updated

BibTeX
@misc{chen2022rethinking,
  author = {Yixiong Chen and Jingxian Li and Chris Ding and Li Liu},
  title = {{Rethinking Two Consensuses of the Transferability in Deep Learning}},
  year = {2022},
  eprint = {2212.00399},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.00399},
}
Figure