Faithful Knowledge Distillation

Tom A. Lamb, Rudy Bunel, Krishnamurthy Dj Dvijotham, M. Pawan Kumar, Philip H. S. Torr, Francisco EirasarXiv 2023

Abstract

Knowledge distillation (KD) has received much attention due to its success in compressing networks to allow for their deployment in resource-constrained systems. While the problem of adversarial robustness has been studied before in the KD setting, previous works overlook what we term the relative calibration of the student network with respect to its teacher in terms of soft confidences. In particular, we focus on two crucial questions with regard to a teacher-student pair: (i) do the teacher and student disagree at points close to correctly classified dataset examples, and (ii) is the distilled student as confident as the teacher around dataset examples? These are critical questions when considering the deployment of a smaller student network trained from a robust teacher within a safety-critical setting. To address these questions, we introduce a faithful imitation framework to discuss the relative calibration of confidences and provide empirical and certified methods to evaluate the relative calibration of a student w.r.t. its teacher. Further, to verifiably align the relative calibration incentives of the student to those of its teacher, we introduce faithful distillation. Our experiments on the MNIST, Fashion-MNIST and CIFAR-10 datasets demonstrate the need for such an analysis and the advantages of the increased verifiability of faithful distillation over alternative adversarial distillation methods.

Introduction

Knowledge Distillation (KD) is the primary method for compressing large, high-performing "teacher" models into lightweight "student" models suitable for edge hardware. While researchers have successfully distilled accuracy and even adversarial robustness, they often ignore relative calibration—the degree to which a student mimics its teacher's confidence levels, especially under adversarial pressure.

In safety-critical systems like autonomous driving, we don't just care about the final classification; we care about the model's confidence. Standard KD often fails in two ways: adversarial disagreement, where a tiny perturbation causes the models to predict different classes, and poor relative calibration, where the student's confidence wildly diverges from the teacher's near decision boundaries. If a student model is meant to replace a trusted teacher, it should fail or succeed with the same level of certainty as its predecessor.

Methodology

We propose Faithful Distillation (FD), a framework that includes a new training objective and a verification system.

1. Faithful Distillation (FD) Loss

Standard robust distillation typically perturbs only the student during training. FD changes this by perturbing both the teacher and the student. By minimizing the KL-divergence between their outputs under the same adversarial noise, the student is forced to imitate the teacher's behavior across the entire neighborhood of a data point.

2. The Faithfulness Framework

To measure imitation quality, we introduce two metrics:

  • EMPLB (Empirical Lower Bound): Uses PGD attacks to find the maximum observed difference in confidence between the models.
  • FAITHUB (Faithfulness Upper Bound): A certified metric using Mixed-Integer Linear Programming (MILP) and linear relaxations to calculate the theoretical maximum possible confidence difference within an $\ell_\infty$-ball. This provides a formal safety guarantee.

Experimental Evaluation

We evaluated FD on MNIST, Fashion-MNIST, and CIFAR-10. We used fully connected networks for MNIST/F-MNIST and CNNs for CIFAR-10, with students being roughly 37% to 52% smaller than their teachers.

Results and Discussion

A key insight of this work is that robustness does not equal faithfulness. A student can be hard to fool but still be a poor imitator if its confidence scores diverge significantly from the teacher's.

Comparison of confidence heatmaps between Standard Distillation and Faithful Distillation.

As illustrated in Figure 1, standard KD often results in "spiky" or erratic confidence transitions near decision boundaries. In contrast, FD-trained students exhibit much smoother transitions, closely mimicking the teacher's behavior even when perturbed. For example, at point $x_1$, the standard student ($f_{SD}$) predicts a different class than the teacher, whereas the faithful student ($f_{FD}$) maintains agreement.

Key Performance Metrics

FD-trained students consistently achieved superior alignment across all benchmarks. On CIFAR-10, FD not only improved faithfulness but also produced the most robust students, outperforming specialized methods like Adversarially Robust Distillation (ARD) and RSLAD.

Empirical and certified faithfulness metrics (EMPLB/FAITHUB) for various distillation methods on CIFAR-10.

The quantitative results in Figure 5 demonstrate that FD achieves the lowest FAITHUB scores, providing formal guarantees of its superior imitation capabilities. While empirical attacks (EMPLB) can sometimes underestimate the gap, the certified FAITHUB metric highlights the necessity of FD for safety-critical deployment.

Conclusion

Faithful Knowledge Distillation provides a verifiable way to ensure student models truly inherit the characteristics of their teachers. While computing certified bounds like FAITHUB is currently computationally intensive for very large architectures, this work establishes a critical foundation for relative calibration in KD. Future research will focus on scaling these verification techniques to larger models and exploring broader output metrics beyond the $\ell_\infty$-norm.

Summary updated

Abstract

Knowledge distillation (KD) has received much attention due to its success in compressing networks to allow for their deployment in resource-constrained systems. While the problem of adversarial robustness has been studied before in the KD setting, previous works overlook what we term the relative calibration of the student network with respect to its teacher in terms of soft confidences. In particular, we focus on two crucial questions with regard to a teacher-student pair: (i) do the teacher and student disagree at points close to correctly classified dataset examples, and (ii) is the distilled student as confident as the teacher around dataset examples? These are critical questions when considering the deployment of a smaller student network trained from a robust teacher within a safety-critical setting. To address these questions, we introduce a faithful imitation framework to discuss the relative calibration of confidences and provide empirical and certified methods to evaluate the relative calibration of a student w.r.t. its teacher. Further, to verifiably align the relative calibration incentives of the student to those of its teacher, we introduce faithful distillation. Our experiments on the MNIST, Fashion-MNIST and CIFAR-10 datasets demonstrate the need for such an analysis and the advantages of the increased verifiability of faithful distillation over alternative adversarial distillation methods.
BibTeX
@misc{lamb2023faithful,
  author = {Tom A. Lamb and Rudy Bunel and Krishnamurthy Dj Dvijotham and M. Pawan Kumar and Philip H. S. Torr and Francisco Eiras},
  title = {{Faithful Knowledge Distillation}},
  year = {2023},
  eprint = {2306.04431},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.04431},
}
Figure