Abstract
Knowledge Distillation (KD) is a critical technique for compressing large neural networks into efficient student models. However, traditional KD suffers from an optimization incoherence between feature-based and logits-based distillation. This paper introduces UniKD (Unified Distillation), a framework that bridges this gap by converting intermediate features into probability distributions. By applying a unified Kullback-Leibler (KL) divergence constraint across all network stages, UniKD achieves state-of-the-art performance across image classification and object detection benchmarks.
Introduction
Knowledge Distillation typically operates in two distinct domains: logits-based distillation, which matches final output probability distributions using KL divergence, and feature-based distillation, which forces intermediate activations to match using Mean Squared Error (MSE).
As shown in Figure 1, this split creates a fundamental incoherence. Logits-based methods provide high-level distribution constraints, while feature-based methods impose rigid, pixel-level constraints. Combining these often leads to conflicting gradients, making it difficult for the student model to converge optimally. UniKD addresses this by treating features as distributions rather than static pixel values, allowing for a mathematically consistent optimization objective throughout the entire network.
Methodology
UniKD harmonizes the distillation process through two primary architectural innovations: Adaptive Features Fusion (AFF) and Feature Distribution Prediction (FDP).
Adaptive Features Fusion (AFF)
Rather than distilling every intermediate layer individually—which is computationally expensive and introduces noise—AFF aggregates features from multiple network stages. It utilizes an expander, upsampling, and a gating mechanism to fuse shallow local features with deep semantic information into a single, comprehensive representation.
Feature Distribution Prediction (FDP)
The FDP module is the core of the framework. To avoid the pitfalls of rigid pixel-matching, UniKD models features as a multivariate Gaussian distribution. FDP predicts the mean ($\mu$) and variance ($\sigma^2$) for these features. By simplifying the covariance matrix to a diagonal matrix, the method remains computationally efficient and numerically stable.
Unified Loss Function
With intermediate features represented as distributions, the authors employ KL divergence for both the intermediate layers and the final logits. This creates a "harmonized" signal for the student network, preventing the gradient instability common in hybrid MSE/KL approaches.
Experimental Results
The researchers evaluated UniKD across three major benchmarks: CIFAR-100, ImageNet, and MS-COCO.
- CIFAR-100: In a ResNet32x4 (Teacher) to ResNet8x4 (Student) setup, UniKD achieved 78.18% Top-1 accuracy, significantly surpassing previous state-of-the-art (SOTA) methods like NKD (77.01%).
- ImageNet: For a ResNet34 to ResNet18 pair, UniKD reached 72.83% Top-1 accuracy, a 0.93% improvement over previous SOTA.
- Object Detection: On the MS-COCO dataset using Faster R-CNN, the method improved Average Precision (AP) from a baseline of 33.26 to 37.24.
Notably, in several experiments, the distilled student model actually outperformed the original teacher model, suggesting that the unified distillation process acts as a powerful regularizer.
Conclusion
UniKD demonstrates that the "dark knowledge" of a teacher model is best captured through underlying data distributions rather than exact pixel values. By unifying the optimization objective under a single KL-divergence framework, UniKD resolves long-standing gradient conflicts in KD. While highly effective for classification, future work will focus on refining distribution modeling to better preserve the fine-grained spatial precision required for dense computer vision tasks like object detection.
Summary updated