Dual-Head Knowledge Distillation: Enhancing Logits Utilization with an Auxiliary Head

Penghui Yang, Chen-Chen Zong, Sheng-Jun Huang, Lei Feng, Bo An · DOI

TL;DR

Combining probability-level and logit-level losses in knowledge distillation paradoxically degrades student performance due to gradient conflicts localized within the classification head. This paper introduces Dual-Head Knowledge Distillation (DHKD), a novel framework that splits the student's classifier into two distinct heads to leverage rich logit information without disrupting the main classifier's structural convergence. DHKD consistently outperforms existing logit-based distillation methods across standard image classification and segmentation benchmarks with negligible computational overhead.

What Problem Does This Paper Address?

Knowledge Distillation (KD) aims to compress a large, cumbersome "teacher" model into a compact, efficient "student" model by transferring learned knowledge. Traditional logit-based KD focuses on aligning the student's softmax probability outputs with the teacher's. However, the softmax function is a many-to-one mapping that squashes information; completely different logit vectors can produce identical probability distributions, erasing subtle nuances the teacher captured.

To capture this lost information, it seems intuitive to add a logit-level loss function (like a binary Kullback-Leibler divergence, or BinaryKL) alongside the standard Cross-Entropy (CE) loss. Surprisingly, doing this causes a severe performance drop—often making the student perform worse than if it were trained on either loss alone. The authors set out to explain this mathematical incompatibility and design a solution that captures the best of both worlds.

Figure 1: The reason for introducing the BinaryKL loss and the incompatibility of the CE loss and the BinaryKL loss. Figure 1(a) shows that two different vectors may become the same through the softmax function, which means some information would be lost during the transformation process carried out by the softmax function. Figure 1(b) shows four settings we evaluate: (1) only cross-entropy (CE) loss; (2) only the BinaryKL loss; (3) CE + BinaryKL; (4) Our proposed Dual-Head Knowledge Distillation (DHKD). The red cross over the third setting means that the student model trained under this setting will collapse. The performance sorting of four settings is (4) > (1) > (2) ≫(3), as shown in Figure 2.

Methods

The authors leverage Neural Collapse (NC) theory to diagnose the failure mode of the joint loss function. Neural Collapse dictates that during the final stages of training, the features of a well-optimized network collapse into their class means, and the weights of the linear classifier head arrange themselves into a geometric structure called a simplex Equiangular Tight Frame (ETF).

By decomposing the gradients of both the CE loss and the BinaryKL loss, the authors discover an intriguing asymmetry:

  1. In the backbone: Both losses work harmoniously, providing complementary gradients that help the network learn richer feature representations.
  2. In the classifier head: The gradients of the BinaryKL loss directly contradict the CE loss, actively preventing the classifier weights from forming the ideal simplex ETF structure.

To resolve this localized conflict, the authors propose Dual-Head Knowledge Distillation (DHKD):

Overview of the Dual-Head Knowledge Distillation (DHKD) architecture.
  • Decoupled Heads: DHKD splits the final layer into two parallel classification heads. The main head ($g^S$) is trained exclusively with CE loss to preserve its convergence toward a simplex ETF. An adaptive auxiliary head ($g'$) is introduced to handle the logit-level distillation loss. For cross-architecture distillation (e.g., ResNet to MobileNet), this auxiliary head is implemented as a non-linear MLP to provide extra flexibility.
  • BinaryKL-Norm: The authors introduce a normalized variant of the logit loss that measures the distance between zero and the difference between teacher and student logits. This eliminates the need for exhaustive temperature hyperparameter ($\tau$) tuning.
  • Gradient Alignment: To ensure training stability on complex datasets, DHKD projects the auxiliary head's gradients orthogonally to the main head's gradients whenever their angle exceeds 90 degrees, preventing destructive interference.

Datasets

The method was validated across three major computer vision benchmarks:

  • CIFAR-100: Evaluated using both identical and differing teacher-student architectural styles (e.g., ResNet, VGG, ShuffleNet, MobileNet).
  • ImageNet: A large-scale image classification dataset used to test scalability.
  • Cityscapes: Used to evaluate the framework's performance on semantic segmentation tasks using a DeepLabV3 architecture.

Key Insights and Ideas

  • The Classifier is the Battlefield: The core insight is that multi-loss incompatibility isn't a global network issue; it is highly localized to the final linear classifier layer. The backbone network handles multiple objectives gracefully, but the classifier requires strict geometric convergence.
  • Geometric Diagnostics: Using Neural Collapse as a lens to analyze gradient dynamics provides an elegant, geometric explanation for optimization failures that standard empirical tracking might miss.
  • Architectural Separation Over Regularization: Instead of relying on complex gradient clipping or heavy loss-balancing hyperparameter tuning (which the authors show fail to solve the problem), simply duplicating the cheap final layer bypasses the mathematical conflict entirely.

Key Results

DHKD consistently establishes new state-of-the-art results for logit-based distillation:

  • CIFAR-100: When distilling from a ResNet32x4 to a ResNet8x4, DHKD achieves 76.54% top-1 accuracy, outperforming vanilla KD (73.33%) and SOTA logit methods like DKD (76.32%). When combined with feature-based methods like ReviewKD, it reaches an impressive 78.29%.
  • ImageNet: Distilling from ResNet-34 to ResNet-18 yields a top-1 accuracy of 72.15%, outperforming vanilla KD (70.66%) and DKD (71.70%).
  • Efficiency: DHKD maintains excellent training efficiency. On ImageNet, it requires only 616 ms per batch, which is virtually identical to competing logit-based methods (614 ms) and significantly faster than feature-based alternatives.

Limitations and Future Work

  • Loss Specificity: The dual-head solution is explicitly designed to fix conflicts arising from logit-matching losses like BinaryKL. It is not universally required for all logit losses; for instance, Mean Squared Error (MSE) loss does not exhibit this specific geometric conflict with CE loss.
  • Task Scope: The theoretical foundation (Neural Collapse) and empirical validation are heavily focused on classification-centric tasks (including semantic segmentation). Its applicability to regression-heavy tasks like object detection remains unexplored.
  • Future Directions: The authors suggest extending DHKD to cross-modality and cross-style architectures, such as distilling knowledge from Vision Transformers (ViTs) into compact CNN backbones.

Summary updated

BibTeX
@inproceedings{yang2024dual,
  author = {Penghui Yang and Chen-Chen Zong and Sheng-Jun Huang and Lei Feng and Bo An},
  title = {{Dual-Head Knowledge Distillation: Enhancing Logits Utilization with an Auxiliary Head}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
}
Figure