What Knowledge Gets Distilled in Knowledge Distillation?

Utkarsh Ojha, Yuheng Li, Yong Jae Lee · OpenReview

Abstract

Knowledge distillation aims to transfer useful information from a teacher network to a student network, with the primary goal of improving the student's performance for the task at hand. Over the years, there has a been a deluge of novel techniques and use cases of knowledge distillation. Yet, despite the various improvements, there seems to be a glaring gap in the community's fundamental understanding of the process. Specifically, what is the knowledge that gets distilled in knowledge distillation? In other words, in what ways does the student become similar to the teacher? Does it start to localize objects in the same way? Does it get fooled by the same adversarial samples? Does its data invariance properties become similar? Our work presents a comprehensive study to try to answer these questions and more. Our results, using image classification as a case study and three state-of-the-art knowledge distillation techniques, show that knowledge distillation methods can indeed indirectly distill other kinds of properties beyond improving task performance. And while we believe that understanding the distillation process is important in itself, we also demonstrate that our results can pave the path for important practical applications as well.

Introduction

Knowledge distillation (KD) is the standard technique for "compressing" a large, cumbersome teacher model into a smaller, efficient student model. While the field has produced thousands of papers on how to improve the efficiency of this transfer, we still have a poor fundamental understanding of what is actually being transferred.

Beyond simple label accuracy, does the student "see" the world the same way the teacher does? If a teacher is biased or vulnerable to specific hacks, does the student inherit those flaws? This research moves beyond accuracy metrics to explore the qualitative and structural similarities that emerge between teachers and students during the distillation process.

Methods

The study evaluates three representative families of distillation:

  1. Output-based (KL): The student mimics the teacher’s final soft-label probability distributions.
  2. Feature-based (Hint): The student mimics the activations of the teacher’s intermediate layers.
  3. Contrastive-based (CRD): The student learns to preserve the structural relationships (similarity/dissimilarity) between data samples as perceived by the teacher.
Overview of the three distillation methods: KL, Hint, and CRD.

To probe these models, the authors use Grad-CAM to visualize localization patterns, Iterative FGSM to craft adversarial attacks, and a geometric lens to visualize how decision boundaries shift during training.

Key Insights: The "Algorithmic DNA"

  • Inherited "Gaze": Distilled students start to focus on the same spatial regions of an image as their teachers. If a teacher identifies a cat by its ears, the student likely will too.
  • Adversarial Contagion: If you craft an adversarial image specifically to fool a teacher, that same image is significantly more likely to fool a distilled student than an independently trained one. The student inherits the teacher's specific blind spots.
  • Invariance via Proxy: If a teacher is trained to be invariant to color or cropping, the student inherits this invariance even if the student is never trained with those data augmentations. The teacher's output "soft labels" contain enough structural information to teach the student these properties indirectly.
  • The Bias Trap: KD can propagate harmful social biases. If a teacher is more accurate for one race than another, a student distilled from it—even if trained on a fair dataset—will likely inherit that performance disparity.
  • Geometric Alignment: By mimicking the teacher's outputs (which represent relative distances to the decision boundary), the student is effectively forced to reconstruct the teacher’s specific decision boundary in high-dimensional space.

Key Results

The study utilizes a diverse array of benchmarks including ImageNet, MNIST variants, FairFace, and CIFAR-100 to validate these insights.

Performance comparison of independent (Ind) training vs. KL, Hint, and CRD distillation across different architectures.
  • Localization Similarity: Distilled students showed a significant increase in CAM similarity to the teacher compared to independent baselines (often exceeding 50% higher similarity).
  • Fooling Rates: For a ResNet50 $\rightarrow$ ResNet18 distillation, the ability of teacher-specific adversarial images to fool the student jumped from 44.2% (independent) to roughly 50-52% (distilled).
  • Domain Adaptation: On the unseen MNIST-M domain, students distilled from a multi-domain teacher achieved ~60-67% accuracy, whereas independent students trained only on original MNIST hovered around 56%.

Limitations and Future Work

  • Architecture Mismatch: Distilling knowledge from a Transformer (ViT) to a CNN is significantly more difficult. The inherent "inductive biases" of the different architectures often clash, preventing the student from fully inheriting the teacher's properties.
  • Task Scope: The study is primarily focused on image classification. Future work should investigate if these findings hold for more complex tasks like object detection or semantic segmentation.
  • Selective Distillation: A major future direction is figuring out how to distill "good" knowledge (like accuracy and invariance) while filtering out "bad" knowledge (like adversarial vulnerability and social bias). The paper suggests that we need more "surgical" distillation algorithms.

Summary updated

BibTeX
@inproceedings{ojha2023what,
  author = {Utkarsh Ojha and Yuheng Li 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