NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

From Knowledge Distillation to Self-Knowledge Distillation: A Unified Approach with Normalized Loss and Customized Soft Labels

Zhendong Yang, Ailing Zeng, Zhe Li, Tianke Zhang, Chun Yuan, Yu Li

TL;DR

This paper unifies knowledge distillation (KD) and self-KD under a single framework by addressing a fundamental mathematical mismatch in how non-target class probabilities are aligned. By introducing Normalized KD (NKD) to equalize logit sums and Universal Self-Knowledge Distillation (USKD) to efficiently generate soft labels from intermediate features, the authors achieve state-of-the-art performance across both CNNs and Vision Transformers (ViTs) with virtually zero computational overhead.

What Problem Does This Paper Address?

Knowledge Distillation (KD) is a popular technique for transferring "dark knowledge" from a large, cumbersome "teacher" model to a compact, efficient "student" model by forcing the student to match the teacher's predicted probabilities (soft labels). However, the authors identify a subtle flaw in standard KD loss: it attempts to align the non-target logit distributions even though the sum of the teacher's non-target logits and the student's non-target logits are rarely equal and constantly shift during training. This mathematical mismatch prevents perfect distribution alignment.

When a teacher model isn't available, self-knowledge distillation (self-KD) can be used to generate soft labels without an external model. Unfortunately, existing self-KD methods either require heavy auxiliary architectures and complex data augmentations (which drastically increase training time) or rely on spatial, pixel-level features unique to CNNs—rendering them incompatible with patch-based Vision Transformers (ViTs). This paper aims to fix the loss formulation in standard KD and create an architecture-agnostic, highly efficient self-KD method.

Methods

The authors introduce a unified approach consisting of two main components:

  1. Normalized Knowledge Distillation (NKD): The generic KD loss is decomposed into a target loss and a non-target loss. To fix the alignment issue, NKD normalizes the non-target logits of both the teacher and the student, forcing their sums to be equalized before computing the cross-entropy loss.
  2. Universal Self-Knowledge Distillation (USKD): For teacher-free training, the authors generate customized soft labels on the fly:
  3. Soft Target Labels: The student's own target prediction is squared to amplify sample differences and smoothed across the training batch to stabilize training.
  4. Soft Non-Target Labels: A single linear layer is attached to an intermediate feature map (e.g., Stage 2 in CNNs or a middle layer classification token in ViTs). Under weak supervision, this layer generates a "weak logit" that is combined with the final logit to rank the non-target classes. Soft labels are then assigned to this ranking using Zipf's Law.
Figure 1. Illustration of the proposed NKD and USKD for distilla- tion loss calculations. NKD normalizes the non-target logits, using the soft labels more effectively, and achieves better performance. Meanwhile, USKD sets customized soft labels for both target and non-target classes, and can be applied to both CNNs and ViTs.

Unlike previous self-KD methods that require heavy auxiliary blocks, USKD only introduces a single linear layer for weak supervision, making it exceptionally lightweight.

Figure 2. Comparison of different self-KD methods with (a) extra blocks and parameters [14], (b) contrastive method [37], (c) image mixture [38], (d) Zipf’s label smoothing [17], and (e) label smoothing [22, 34]. (f) Self-KD with our customized soft labels including both target and non-target class for distillation. Note some methods can only be applied to CNN, while ours works for both CNN and ViT.

Datasets

The authors evaluated their approaches on standard image classification and object detection benchmarks:

  • CIFAR-100: 50k training images and 10k validation images across 100 classes.
  • ImageNet (ImageNet-1k): 1.2 million training images and 50k validation images across 1000 classes.
  • COCO (val2017): Used to evaluate downstream performance on object detection using Faster R-CNN and Mask R-CNN backbones.

No new datasets or benchmarks were introduced in this paper.

Key Insights and Ideas

  • The Non-Target Sum Mismatch: In standard KD, because the sum of non-target probabilities equals $1 - P(\text{target})$, any gap between the teacher's and student's confidence in the correct class inherently distorts the non-target distribution alignment. Normalization isolates and resolves this mathematical bottleneck.
  • Intermediate Features as Rank Generators: You don't need a complex auxiliary network to discover semantic similarities between classes. A simple linear layer attached to mid-level features provides enough weak supervision to generate highly reliable class rankings.
  • True Universality: By extracting class rankings from pooled or tokenized intermediate features rather than raw spatial feature maps, self-KD becomes entirely architecture-agnostic, benefiting ViTs, Swin Transformers, and CNNs alike.

Key Results

  • With a Teacher (NKD): On ImageNet, NKD boosted a ResNet18 student to 71.96% Top-1 accuracy using a ResNet-34 teacher (a 2.06% gain over the baseline), outperforming standard KD and Decoupled KD (DKD).
  • Without a Teacher (USKD): On ImageNet, USKD achieved state-of-the-art self-KD results, improving MobileNet by 1.17% and ResNet-18 by 0.89%.
  • Vision Transformer Gains: USKD successfully improved DeiT-Tiny by 0.55% and Swin-Tiny by 0.31% on ImageNet.
  • Negligible Overhead: Training MobileNet-V2 with USKD took 10.18 minutes per epoch compared to 10.17 minutes for the baseline—adding virtually zero computational or time overhead.

Limitations and Future Work

While highly efficient, USKD introduces a few hyperparameters ($\alpha$, $\beta$, and $\mu$) to balance the target, non-target, and weak supervision losses. The authors note that performance can be sensitive if the non-target loss weight ($\beta$) is set too high, or if the weak supervision factor ($\mu$) is set too low (which causes the weak logits to become uniform and degrades ranking quality). The authors suggest that exploring automated hyperparameter tuning or extending this normalization concept to dense pixel-level regression tasks (like depth estimation) are promising future directions.

Summary updated

BibTeX
@misc{yang2023from,
  author = {Zhendong Yang and Ailing Zeng and Zhe Li and Tianke Zhang and Chun Yuan and Yu Li},
  title = {{From Knowledge Distillation to Self-Knowledge Distillation: A Unified Approach with Normalized Loss and Customized Soft Labels}},
  year = {2023},
  eprint = {2303.13005},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.13005},
}
Figure