What Knowledge Gets Distilled in Knowledge Distillation?

Utkarsh Ojha, Yuheng Li, Anirudh Sundara Rajan, Yingyu Liang, Yong Jae Lee

TL;DR Knowledge distillation (KD) doesn't just boost a student model's accuracy; it transfers the teacher's "personality," including its specific failure modes, where it focuses its attention, and its biases. By aligning decision boundaries, KD allows students to inherit implicit properties like adversarial vulnerability and data invariance—a double-edged sword that enables "free" domain adaptation but also propagates harmful social biases.

What Problem Does This Paper Address?

Since its inception, Knowledge Distillation has been a "black box" success story. We know that forcing a small student network to mimic a large teacher network improves the student's performance, but we haven't fundamentally understood what is being transferred.

The authors argue there is a glaring gap in our understanding of "dark knowledge." Beyond simple class labels, does the student inherit the teacher’s internal logic? For instance, if a teacher is fooled by a specific optical illusion (adversarial attack), will the student be too? If the teacher focuses on a bird's wings to identify it, will the student stop looking at the background? This paper systematically investigates these implicit properties to understand the qualitative nature of the distillation process.

Methods

The researchers evaluated three representative families of distillation to understand how different techniques affect the transfer of knowledge:

Overview of Distillation Methods
  1. KL (Logit-based): The student mimics the teacher’s final probability distributions (soft labels).
  2. Hint (Feature-based): The student mimics intermediate layer representations, aligning internal feature maps.
  3. CRD (Contrastive-based): The student learns to keep representations of the same image close to the teacher’s while pushing representations of different images away.

To "peek under the hood," the authors used Grad-CAM to visualize spatial attention, Iterative FGSM to craft teacher-specific adversarial attacks, and geometric analysis to show how distillation effectively reconstructs the teacher's decision boundaries in the student's high-dimensional feature space.

Datasets

The study utilized a diverse array of benchmarks to test various properties:

  • ImageNet: The primary dataset for general classification and localization.
  • Unseen Domains: To test generalization, they used variants like Sketch, Stylized, Edge, Silhouette, and Cue Conflict.
  • MNIST Variants: MNIST-orig, MNIST-Color, and MNIST-M (digits over natural images) to test domain adaptation.
  • FairFace: A dataset containing images of human faces from 7 different races, used to study the transfer of racial bias.

Key Insights and Ideas

  • The Mirror Effect: Distillation is more than a performance boost; it’s a behavioral clone. Students inherit the teacher's spatial attention. If a teacher looks at the "face" of an object rather than the "texture," the student shifts its focus accordingly.
Grad-CAM Spatial Attention
  • Inherited Vulnerability: This is a surprising finding: by simply mimicking soft probabilities (KL), the student inherits the teacher's specific adversarial weaknesses. If you craft an image to fool the teacher, that same image is significantly more likely to fool the distilled student than an independently trained one.
  • Invariance is Contagious: If a teacher is trained to be invariant to color (via heavy augmentation), the student becomes color-invariant too—even if the student is never shown color-augmented images during its own training.
  • The Decision Boundary Lens: The authors posit that distillation works by forcing the student's decision boundary to align with the teacher's. Mimicking the teacher's "confidence" for an image is essentially mimicking that image's distance from the decision boundary.

Key Results

  • Localization: In ResNet50 $\rightarrow$ ResNet18 distillation, the student's attention maps became significantly more similar to the teacher's (scoring ~67% similarity) compared to an independent baseline (~50%).
  • Adversarial Transfer: For a ResNet50 teacher, the "fooling rate" on an independent student was 44.2%. For a distilled student, this jumped to over 50%, showing the student inherited the teacher's specific "blind spots."
  • Free Domain Adaptation: A teacher trained on multiple MNIST domains could transfer that "domain-invariant" knowledge to a student trained only on grayscale images. The distilled student's accuracy on colored backgrounds jumped from 63.6% to 89.4%.
  • The "Bad" Knowledge: Using the FairFace dataset, the authors showed that a "fair" student (trained on a balanced dataset) became "unfair" after distilling from a biased teacher, inheriting the teacher's lower accuracy for specific racial groups.

Limitations and Future Work

The authors acknowledge several constraints:

  • Architectural Gaps: Distilling knowledge from a Vision Transformer (ViT) to a CNN is much less effective at transferring these implicit properties than CNN-to-CNN distillation, likely due to fundamental differences in how these architectures process data.
  • Task Variety: The study focused almost exclusively on image classification. It remains to be seen if these findings hold for more complex tasks like object detection or semantic segmentation.
  • Control: A major future challenge is "selective distillation." How can we design algorithms that transfer a teacher's accuracy and domain robustness without also transferring its adversarial vulnerabilities or social biases?

Summary updated

BibTeX
@inproceedings{ojha2023what,
  author = {Utkarsh Ojha and Yuheng Li and Anirudh Sundara Rajan and Yingyu Liang and Yong Jae Lee},
  title = {{What Knowledge Gets Distilled in Knowledge Distillation?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Poj71ASubN},
}
Figure