Improving Knowledge Distillation in Transfer Learning with Layer-wise Learning Rates

Shirley Kokane, Mostofa Rafid Uddin, Min XuarXiv 2024

TL;DR

This paper introduces a novel layer-wise learning rate optimization scheme for knowledge distillation in transfer learning. By dynamically adjusting learning rates for individual layers based on their specific contribution to the knowledge transfer, the method significantly improves student model performance, especially on more complex tasks.

What Problem Does This Paper Address?

Deep neural networks are powerful but computationally expensive and data-hungry. Transfer learning, particularly knowledge distillation, aims to train smaller, more efficient "student" models by leveraging knowledge from larger "teacher" models. However, existing knowledge distillation methods often apply a uniform loss back-propagation across all layers, which can be suboptimal, especially as the complexity of the learning task increases. This can lead to student models that don't fully capture the teacher's capabilities, resulting in lower accuracy and stability. The paper addresses this by proposing a more nuanced approach that accounts for the varying importance of different layers in the knowledge transfer process.

Methods

The core contribution is a layer-wise learning rate optimization strategy. Instead of a global learning rate, the authors propose to adjust the learning rate for specific "crucial" layers within the student network. These crucial layers are identified as those where dimensional changes occur in feature channels between the teacher and student models.

The method works by:

  1. Identifying Crucial Layers: These are layers where the student and teacher models have matching dimensionalities.
  2. Calculating Layer-wise Maps: For these crucial layers, the paper utilizes three types of maps:
  3. Attention Maps: Based on output activations.
  4. Jacobian Maps: Based on first-order derivatives of network parameters with respect to the output.
  5. Hessian Maps: Based on second-order derivatives of network parameters with respect to the output.
  6. Computing Layer-wise Loss: The divergence between the student and teacher maps for each crucial layer is calculated. The paper specifically uses Jensen-Shannon Divergence (JSD) for this, citing its symmetric and well-bounded properties.
  7. Optimizing Layer-wise Learning Rates: A learning rate optimizer function g is defined, which takes the layer-wise loss as input to dynamically update the learning rate (α_j) for each crucial layer j. This update is performed at intervals (e.g., every 25 epochs). A momentum term (η_j) is also introduced to stabilize learning rate updates.

This layer-wise approach is integrated into existing attention-based, Jacobian-based, and Hessian-based knowledge distillation frameworks.

Datasets

The paper evaluates its method on the following datasets:

  • CIFAR-10: A 10-class image classification dataset.
  • CIFAR-100: A 100-class image classification dataset.
  • CoCo (Microsoft COCO): A multi-class object detection and segmentation dataset with over 80 categories.

Key Insights and Ideas

  • Layer Importance Varies: Not all layers contribute equally to knowledge transfer. Some layers are more critical for capturing specific features or transformations from the teacher model.
  • Dynamic Learning Rates are Key: A static learning rate across all layers can hinder performance, especially when task complexity increases. Tailoring learning rates to individual layer needs allows for more efficient and effective knowledge assimilation.
  • Second-Order Derivatives Offer Advantages: While first-order derivatives (Jacobian) are useful, the paper suggests that second-order derivatives (Hessian) can offer further advantages, particularly in understanding network convergence and potentially improving performance.
  • Task Complexity Amplifies Benefits: The layer-wise learning rate approach shows a more significant performance boost as the learning task becomes harder (e.g., moving from CIFAR-10 to CIFAR-100 and then to CoCo). This highlights its value in challenging transfer learning scenarios.

Key Results

  • Consistent Improvement: The proposed layer-wise learning rate scheme consistently improved student model accuracy across all three knowledge distillation methods (Attention, Jacobian, Hessian) and all three datasets.
  • CIFAR-10: Minimal improvement was observed due to the task's relative ease.
  • CIFAR-100: More visible and stable accuracy improvements were seen, with Jacobian map-based distillation achieving the closest accuracy to the teacher (73.84%).
  • CoCo: The most significant and stable improvements were observed. For example, the attention-based model accuracy increased by 3%, Jacobian by 3.14%, and Hessian by 3.26% with the layer-wise approach compared to a constant learning rate. The closest accuracy to the teacher (73.14%) was achieved with Jacobian map-based distillation.
  • Stability: The layer-wise approach led to more stable learning curves, particularly on the more complex CoCo dataset.

Limitations and Future Work

  • Identification of Crucial Layers: The paper identifies crucial layers based on dimensional changes. While effective, further research could explore more sophisticated methods for identifying and weighting the importance of different layers.
  • Jacobian vs. Attention for Harder Tasks: The paper notes that Jacobian might perform better than attention map-based distillation for harder learning tasks, but suggests that "more investigation is required in this direction to draw such a conclusion."
  • Generalization of Layer-wise Optimization: While the paper demonstrates the effectiveness of its scheme, exploring its application to a wider range of network architectures and transfer learning tasks would be beneficial.
  • Computational Overhead: While not explicitly detailed as a limitation, calculating Jacobian and Hessian maps can introduce computational overhead. Future work could focus on efficient approximations or strategies to mitigate this.

Summary updated

BibTeX
@misc{kokane2024improving,
  author = {Shirley Kokane and Mostofa Rafid Uddin and Min Xu},
  title = {{Improving Knowledge Distillation in Transfer Learning with Layer-wise Learning Rates}},
  year = {2024},
  eprint = {2407.04871},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.04871},
}
Figure