Distilling the Undistillable: Learning from a Nasty Teacher

Surgan Jandial, Yash Khasbage, Arghya Pal, Vineeth N. Balasubramanian, Balaji Krishnamurthy

Abstract

Knowledge Distillation (KD) has emerged as a powerful technique for model compression, but it simultaneously introduces a significant security risk: the inadvertent leaking of proprietary information to adversarial "student" models. To mitigate this, the "Nasty Teacher" (NT) defense was proposed to create models that maintain high internal accuracy while providing "confusing" logits to any distilling agent. This paper investigates the robustness of such defenses. We demonstrate that the confidentiality offered by Nasty Teachers is fragile and can be bypassed using two novel strategies: High-Temperature Composition (HTC) and Sequence of Contrastive Models (SCM). Our methods recover up to 68.63% of the performance lost to the defense on standard benchmarks. Furthermore, we propose an improved defense mechanism based on these findings.

Introduction

Knowledge Distillation is the process of transferring knowledge from a large, complex "teacher" model to a smaller, efficient "student" model. While beneficial for deploying models on edge devices, it allows adversaries to "steal" the intellectual property of a model by simply observing its output probabilities and training a clone.

The "Nasty Teacher" (NT) defense was designed to thwart such attacks. By injecting specific noise into the output logits, a Nasty Teacher aims to mislead any student model attempting to learn from it, causing the student's performance to collapse while the teacher remains accurate for its intended task. However, our research shows that this "undistillable" nature is largely superficial.

Methodology: Breaking the Defense

We propose two distinct approaches to extract information from a Nasty Teacher by seeing through the intentional "confusion."

1. High-Temperature Composition (HTC)

The Nasty Teacher defense works by artificially inflating the scores of specific incorrect classes to create "confusing" peaks in the probability distribution. HTC counters this by applying an extremely high temperature ($\tau > 50$) to the softmax function.

In standard KD, temperature is used to soften the distribution. At the extreme temperatures used in HTC, the distribution becomes nearly flat, effectively washing away the artificial peaks created by the defense. By combining this smoothed distribution with the "one-hot" vector of the ground-truth label, we can reconstruct a clean training signal that allows the student to learn effectively despite the teacher's attempts at sabotage.

2. Sequence of Contrastive Models (SCM)

SCM operates on the principle of triangulation. While a single Nasty Teacher can hide the truth behind noise, the underlying logic of the task remains embedded in the model. We train a sequence of models where each subsequent model is forced to be "different" from its predecessor using KL-Divergence as a penalty.

By ensembling the outputs of this sequence, the intentional "nasty" noise—which varies between the models—tends to cancel out. Meanwhile, the core relationships between classes, which are necessary for solving the task, remain consistent across the sequence. This allows the student to recover a distribution that closely mirrors an undefended teacher.

Experimental Evaluation

We evaluated HTC and SCM across several standard datasets, including CIFAR-10, CIFAR-100, and TinyImageNet (TIN), using various architectures such as ResNet, MobileNetV2, and ShuffleNetV2.

The results were striking. On CIFAR-100, our methods increased the student's learning accuracy by up to 68.63% compared to standard distillation from a Nasty Teacher. Our attacks consistently outperformed previous state-of-the-art methods like the "Skeptical Student." Notably, the attacks remained robust even in data-limited or label-free settings, suggesting that the Nasty Teacher defense provides a false sense of security even against resource-constrained attackers.

Towards a More Robust Defense

Our analysis of HTC and SCM revealed that the original Nasty Teacher defense fails because its "confusion" is too localized—it relies on too few incorrect peaks. Leveraging this insight, we developed an Improved Defense.

Our proposed defense creates a teacher with a more diverse and dense set of confusing peaks in the logit space. This increased complexity makes it significantly harder for HTC to flatten the distribution or for SCM to find a consistent underlying signal. In our tests, this improved defense reduced the effectiveness of stealing attempts by up to 10% compared to the original NT, even when the attacker employed our advanced HTC and SCM strategies.

Conclusion

This work demonstrates that current "nasty" defenses against model stealing are not as impenetrable as they seem. Through HTC and SCM, we show that the "confusing" information provided by a Nasty Teacher can be filtered or averaged out to reveal the underlying knowledge. While we have proposed an improved defense, the battle between model protection and model stealing continues. Future research must address "white-box" scenarios where adversaries might have deeper access to model parameters, ensuring that intellectual property remains secure in an increasingly open AI ecosystem.

Summary updated

Abstract

The inadvertent stealing of private/sensitive information using Knowledge Distillation (KD) has been getting significant attention recently and has guided subsequent defense efforts considering its critical nature. Recent work Nasty Teacher proposed to develop teachers which can not be distilled or imitated by models attacking it. However, the promise of confidentiality offered by a nasty teacher is not well studied, and as a further step to strengthen against such loopholes, we attempt to bypass its defense and steal (or extract) information in its presence successfully. Specifically, we analyze Nasty Teacher from two different directions and subsequently leverage them carefully to develop simple yet efficient methodologies, named as HTC and SCM, which increase the learning from Nasty Teacher by upto 68.63% on standard datasets. Additionally, we also explore an improvised defense method based on our insights of stealing. Our detailed set of experiments and ablations on diverse models/settings demonstrate the efficacy of our approach.
BibTeX
@inproceedings{jandial2022distilling,
  author = {Surgan Jandial and Yash Khasbage and Arghya Pal and Vineeth N. Balasubramanian and Balaji Krishnamurthy},
  title = {{Distilling the Undistillable: Learning from a Nasty Teacher}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=VVnUs9VOPu},
}
Figure