Source-linked AI summary
NormKD: Normalized Logits for Knowledge Distillation
Zhihao Chi, Tu Zheng, Hengjia Li, Zheng Yang, Boxi Wu, Binbin Lin, Deng Cai
TL;DR
Fixed-temperature logit distillation cannot equally soften samples with varied logit distributions, limiting knowledge transfer. NormKD assigns temperatures from each sample’s logit distribution and normalizes outputs with barely extra cost. It improves vanilla and other logit-based methods on CIFAR-100 and ImageNet, while the approach assumes approximately normal logit distributions.
Problem
A single fixed temperature cannot adequately soften samples whose logit distributions vary, potentially transferring each sample’s knowledge inadequately.
Source: §1 · p. 2, §3.3 · p. 4Method
NormKD assigns each sample a temperature based on its logit distribution, using standard variance and normalization with a scaling parameter Tnorm.
Source: §3.3 · pp. 4–5Results
NormKD improves vanilla KD and, combined with DKD, improves performance by around 0.3% and 0.7% respectively while exceeding ReviewKD on both ImageNet models.
Source: §4.2 · p. 6, §5 · p. 8Takeaways & Limitations
Sample-specific temperature selection demonstrates further potential for logit-based KD and can complement other logit-based methods with barely extra computation or storage cost.
Source: §1 · p. 2, §5 · p. 8NormKD assumes logit outputs follow a normal distribution, which may be inappropriate for real model outputs.
Source: §6 · pp. 8–9
Abstract
from arXiv · showhide
Logit based knowledge distillation gets less attention in recent years since feature based methods perform better in most cases. Nevertheless, we find it still has untapped potential when we re-investigate the temperature, which is a crucial hyper-parameter to soften the logit outputs. For most of the previous works, it was set as a fixed value for the entire distillation procedure. However, as the logits from different samples are distributed quite variously, it is not feasible to soften all of them to an equal degree by just a single temperature, which may make the previous work transfer the knowledge of each sample inadequately. In this paper, we restudy the hyper-parameter temperature and figure out its incapability to distill the knowledge from each sample sufficiently when it is a single value. To address this issue, we propose Normalized Knowledge Distillation (NormKD), with the purpose of customizing the temperature for each sample according to the characteristic of the sample's logit distribution. Compared to the vanilla KD, NormKD barely has extra computation or storage cost but performs significantly better on CIRAR-100 and ImageNet for image classification. Furthermore, NormKD can be easily applied to the other logit based methods and achieve better performance which can be closer to or even better than the feature based method.
1. Introduction
Logit-based knowledge distillation relies on temperature to expose dark knowledge, but one fixed value cannot soften varied sample logits equally. NormKD addresses this by selecting sample-specific temperatures with little added cost.
1. Introduction
- Knowledge distillation transfers knowledge from heavyweight teacher models to lighter students, while temperature softens logits to expose dark knowledge.Source: §1 · p. 1
- A single temperature inadequately softens different samples because their logit distributions vary, producing under-softened or over-softened labels.Confident samples may lack dark knowledge when the temperature is too small, while less confident samples lose useful variety when it is too large.Source: Figure 1 · p. 1, §1 · p. 2
- Multiple temperatures improve vanilla KD performance, supporting the conclusion that one temperature cannot adequately distill knowledge from varied samples.Source: §1 · p. 2
- NormKD customizes each sample’s temperature from its logit distribution and normalizes teacher and student outputs into similar distributions.The method uses a temperature related to the sample’s standard variance to make dark-knowledge transfer more equal.Source: §1 · p. 2
- NormKD is a simple logit-based method with almost no extra computation or storage cost and can complement other logit-based methods.Source: §1 · p. 2
2. Related Work
Knowledge distillation methods transfer knowledge through logits, intermediate features, or sample relationships. Related work increasingly favors feature-based methods for performance, while logit-based methods retain potential without transferring location information.
2. Related Work
- Knowledge distillation trains a lighter student under a cumbersome pretrained teacher, commonly aligning final predictions with KL-Divergence and softened logits.Source: §2 · p. 2
- KD methods are categorized as logit-based, feature-based, or relation-based according to whether they match logits, intermediate features, or inter-sample relationships.Source: §2 · p. 2
- Feature-based methods often achieve state-of-the-art performance but commonly require extra computation and storage for intermediate-layer alignment or structures.Source: §2 · p. 2
- Prior logit-based work reweights samples, reuses teacher classifiers, or decouples KL-Divergence, with DKD reaching performance comparable to feature-based methods.Source: §2 · p. 3
- Logit-based methods still have potential despite lacking the location information transferred by feature-based methods.Source: §2 · p. 3
- NormKD advances logit-based KD by customizing temperature for each sample according to its logit distribution.Source: §2 · p. 3
3. Method
The method revisits temperature-based logit distillation, showing why one fixed temperature inadequately softens varied samples and introducing per-sample normalization through logit variance.
3.1. Vanilla Knowledge Distillation
- Vanilla KD aligns teacher and student predictions using KL divergence, with temperature T softening logits while cross-entropy trains against the true labels.The total loss combines cross entropy and temperature-scaled KL divergence; T is fixed for a student–teacher pair.Source: §3.1 · p. 3
3.3. Normalized Knowledge Distillation
- NormKD adds a normalization operation before the softmax layers and uses sample-specific student and teacher temperatures derived from their respective logit variances.Its pseudo-code computes both standard deviations, rescales them with T_norm, and applies the resulting temperatures in distillation.Source: Figure 2 · p. 3, §3.3 · p. 5
3.2. Distill With Multiple Temperature
- Multiple-temperature KD averages predictions produced with several temperatures before computing the KL-divergence loss.The compensation weight T_mul is selected as the maximum temperature in the chosen set.Source: §3.2 · pp. 3–4
- With an appropriate temperature set, multiple-temperature KD improves CIFAR-100 performance, but accuracy declines when too many temperatures are used.The best result with 14 temperatures surpasses some effective KD methods, whereas single temperatures 1, 2, 4, and 8 show no obvious progress.Source: §3.2 · p. 4, Table 1 · p. 4
- Choosing multiple temperatures manually is tedious because the useful temperatures, their number, and the averaging compensation must be tuned for each model.This makes the approach difficult to apply generally despite its experimental gains.Source: §3.2 · p. 4
3. Method
- A fixed temperature softens samples unequally because their logits have different distributions, leaving some outputs over-softened and others under-softened.Multiple temperatures improve performance, supporting the conclusion that one temperature cannot adequately distill knowledge from all samples.Source: §3.3 · p. 4
3.3. Normalized Knowledge Distillation
- NormKD treats each sample’s logits as approximately normally distributed and uses their standard variance to rescale the temperature.The mean has no effect on the normalized softmax, so the method only needs to calculate and divide by the standard variance, then apply T_norm.Source: §3.3 · pp. 4–5
- NormKD customizes each sample’s temperature from its logit distribution, normalizing teacher and student outputs before softmax to equalize softening.It scales temperature by the sample’s standard variance and adds only the computation needed to calculate that variance.Source: §3.3 · pp. 4–5
4. Experiments
NormKD is evaluated on CIFAR-100 and ImageNet across teacher–student architectures, showing consistent gains over vanilla KD and strong compatibility with logit-based methods. Ablations and visualizations examine temperature selection, efficiency, and normalized-logit behavior.
4.1. Datasets and baselines.
- CIFAR-100 and ImageNet experiments use standard classification benchmarks with varied teacher–student architectures and established KD baselines.Source: §4 · p. 6, §4.1 · p. 6
4.2. Main Results
- NormKD improves vanilla KD across CIFAR-100 architectures and outperforms DKD and ReviewKD on several model pairs.Source: §4.2 · p. 6
- DKD+NormKD improves DKD by more than 1.0% on ResNet32×4/ResNet8×4 and approaches or exceeds ReviewKD depending on architecture.Source: §4.2 · p. 6
- On ImageNet, DKD+NormKD improves DKD by around 0.3% and 0.7% and exceeds ReviewKD on both evaluated model pairs.Source: §4.2 · p. 6
4.4. Ablation
- Tnorm=2.0 is effective in most CIFAR-100 cases, while Tnorm=1.0 is best for the evaluated ResNet-50/MobileNet-V1 ImageNet pair.Source: §4.4 · pp. 6–7, Table 6 · p. 7, Table 7 · p. 7
- Using Vmax or Vmax−Vmin as temperatures improves vanilla KD but performs worse than NormKD.Source: §4.4 · p. 7, Table 8 · p. 7
- NormKD has training time close to vanilla KD and introduces no extra parameters, adding only a normalization operation before softmax.Source: §4.4 · pp. 7–8, Table 9 · p. 8
4.5. Visualization
- t-SNE shows more separated representations with NormKD applied to vanilla KD or DKD, while normalized-logit correlations become more similar despite larger raw-logit differences.Source: §4.5 · p. 8
5. Conclusion
The conclusion identifies fixed-temperature distillation as insufficient and presents NormKD as a low-cost, sample-adaptive alternative. It reports that NormKD complements logit-based methods and can improve them beyond feature-based methods in more cases.
- NormKD assigns each sample a temperature based on its logit distribution, using the sample’s standard variance to transfer knowledge more equally.Source: §5 · p. 8
- NormKD barely adds cost, complements vanilla KD, and combines easily with other logit-based methods.Source: §5 · p. 8
- When combined with DKD, NormKD can improve logit-based distillation beyond feature-based methods in more cases.Source: §5 · p. 8
- The conclusion links NormKD’s gains to the untapped potential of logit-based knowledge distillation.Source: §5 · p. 8
6. Limitation and Future Work
NormKD assumes logit outputs follow a normal distribution for normalization, but real distributions may violate this assumption. Future work could seek a more accurate description of logit distributions to transfer knowledge more equally across samples.
- NormKD assumes that logit outputs follow a normal distribution during its normalization operation.Source: §6 · p. 8
- Real logit distributions may be insufficiently ideal for this assumption, making the normalization approach inappropriate in some cases.Source: §6 · p. 9
- Future work should investigate methods that describe logit distributions more correctly and transfer knowledge from each sample more equally.Source: §6 · p. 9
Related papers
This paper cites
- Very Deep Convolutional Networks for Large-Scale Image Recognition2014
- PyTorch: An Imperative Style, High-Performance Deep Learning Library2019
- Squeeze-and-Excitation Networks2017
- MobileNetV2: Inverted Residuals and Linear Bottlenecks2018
- FitNets: Hints for Thin Deep Nets2014
- Do Deep Nets Really Need to be Deep?2013