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