Introduction
In deep learning, larger models typically yield better performance, but their size makes them slower and more memory-intensive. To deploy models on mobile devices or in real-time systems, we need small, efficient networks.
A common solution is Knowledge Distillation (or Mimic Learning), where a small "student" network is trained to copy a large "teacher" network. However, standard distillation techniques—such as matching the final output probabilities or "logits"—often fail to provide significant gains when applied to modern architectures like Residual Networks (ResNets) using Batch Normalization. The internal feature space of these large models can be high-dimensional and "messy," making it difficult for a low-capacity student to find a mapping that matches the teacher's behavior.
To address this, this paper introduces Class-Distance Loss, a novel training objective that reorganizes a teacher network's feature space into dense, well-separated clusters. By making the teacher’s internal representations more structured, a smaller student network can more easily mimic those features, achieving performance close to the larger model with significantly fewer parameters.
Methodology: Structuring and Mimicking
The authors propose a two-step strategy to make knowledge transfer more effective:
1. Structuring the Teacher (Class-Distance Loss)
Instead of training the teacher with just standard Cross-Entropy loss, the authors add a "Class-Distance Loss" ($L_T$). This loss serves two primary functions:
- Intra-class contraction: It pushes feature vectors of the same class closer to their mean vector ($C_m$), creating dense clusters.
- Inter-class separation: It ensures that clusters for different classes stay at least a certain distance (threshold $\phi$) apart to prevent the feature space from collapsing.
2. Mimicking the Features (Matching Vectors)
Once the teacher is trained and its feature space is organized, the student is trained to minimize the $L_2$ distance between its own feature vectors and those of the teacher. Crucially, the student and teacher share the same final fully connected layer weights. This shared layer forces the student to learn how to project its data directly into the teacher's optimized feature clusters.
Key Insights
- The Teacher's "Teachability" Matters: Most distillation research focuses on how the student learns. This paper argues that how the teacher is trained is equally important. A teacher with a cleaner, more clustered internal representation is a fundamentally better instructor.
- Feature Matching over Logit Matching: While many methods try to match the final soft-max outputs, matching the intermediate feature vectors provides a richer signal for the student, provided those features are well-structured.
- Thresholding is Key: In the Class-Distance Loss, using a threshold ($\phi$) for inter-class distance is vital. It prevents the network from trying to push classes infinitely far apart, which would make the optimization problem impossible to solve.
Experimental Results
The researchers evaluated their method primarily on the CIFAR-10 dataset (60,000 32x32 color images across 10 classes). They used a ResNet-110 (1.7M parameters) as the teacher and tested ResNet-32 (0.46M) and ResNet-56 (0.85M) as students.
- ResNet-32 Performance:
- Baseline (trained from scratch): 7.66% error.
- Standard Transfer (from baseline teacher): 7.40% error.
- Proposed Method (TF-cdloss): 7.02% error.
- ResNet-56 Performance:
- Baseline: 6.93% error.
- Proposed Method (TF-cdloss): 6.54% error.
The results demonstrate that the student trained with Class-Distance Loss significantly outperformed both the baseline and the student trained via standard transfer methods. This approach successfully narrowed the performance gap to the 110-layer teacher, which had a 6.38% - 6.47% error rate.
Limitations and Future Work
While highly effective on CIFAR-10, preliminary experiments on CIFAR-100 showed less pronounced results. The authors suggest the strategy works best when the number of classes is small and the teacher is highly confident. Additionally, the threshold $\phi$ and the weighting parameter $\lambda$ currently require manual tuning. Future work will focus on automating this hyperparameter tuning and scaling the approach to larger, more complex datasets like ImageNet.
Summary updated