Skip to content
Back to the collection

Distilling the Knowledge in a Neural Network

Geoffrey Hinton, Oriol Vinyals, Jeff Dean

2015 · arXiv

Read the paper
HN score
0
Mentions
16
Readers
16
Months
15
What’s in a score?

From the abstract

A very simple way to improve the performance of almost any machine learning algorithm is to train many different models on the same data and then to average their predictions. Unfortunately, making predictions using a whole ensemble of models is cumbersome and may be too computationally expensive to allow deployment to a large number of users, especially if the individual models are large neural nets. Caruana and his collaborators have shown that it is possible to compress the knowledge in an ensemble into a single model which is much easier to deploy and we develop this approach further using a different compression technique. We achieve some surprising results on MNIST and we show that we can significantly improve the acoustic model of a heavily used commercial system by distilling the knowledge in an ensemble of models into a single model. We also introduce a new type of ensemble composed of one or more full models and many specialist models which learn to distinguish fine-grained classes that the full models confuse. Unlike a mixture of experts, these specialist models can be trained rapidly and in parallel.

Metadata: arXiv. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

16 selected excerpts · 16 total mentions

arjie
Neutral mention · rule
tl;dr it makes sense once you see there are hidden softmax in there; it's just the explicit formula written out and then applied with the common param value Bloody hell, I am so unfamiliar with ML notation: L = (1 - α) · CE(M_k(x), y) + α · T² · KL(M_k(x)/T ‖ M_{k-1}(x)/T) So CE is cross-entropy and KL is Kullback-Leibler, but then division by T is kind of silly there since it falls out of the KL formula. So considering the subject, this is probably the conversion from logits to probabilities as in Hinton's paper https://arxiv.org/pdf/1503.02531 But that means there's a hidden softmax there not specified. Very terse, if so. And then the multiplication makes sense…
Read the full comment
because he says: > Since the magnitudes of the gradients produced by the soft targets scale as 1/T2 it is important to multiply them by T2 when using both hard and soft targets. I guess to someone familiar with the field they obviously insert the softmax there and the division by T goes inside it but boy is it confusing if you're not familiar (and I am not familiar). Particularly because they're being so explicit about writing out the full loss formula just to set T to 1 in the end. That's all consistent. In writing out the formula for probabilities q_i from logits M_k(x)_i: q_i = exp(M_k(x)_i / T) / sum_j exp(M_k(x)_j / T) Hinton says > where T is a temperature that is normally set to 1. Using a higher value for T produces a softer probability distribution over classes. So the real formula is L = (1 - α) · CE(softmax(M_k(x)), y) + α · T² · KL(softmax(M_k(x)/T) ‖ softmax(M_{k-1}(x)/T)) And then they're using the usual form of setting T to 1. The reason they specify the full thing is just because that's the standard loss function, and it must be the case that people in this field frequently assume softmaxes where necessary to turn logits into probabilities. In this field this must be such a common operation that writing it out just hurts readability. I would guess one of them reading this would be like "yeah, obviously you softmax, you can't KL a vector of logits". Good question. I just sort of skipped over that when reading but what you said made me think about it.
microtonal
Neutral mention · rule
This is exactly what the DeepSeek team did, and now Anthropic is repackaging it a year later, calling it “subliminal learning” or using the teacher and student analogy to take credit for work done by Chinese researchers. What? Distillation is way older. The Hinton paper was from 2015 (maybe there is even earlier work): https://arxiv.org/abs/1503.02531 When I was still in academia, we were distilling models from BERT/RoBERTa-large to smaller models (remember when those models were considered large?) in 2019 using logits and L2 distance of hidden layers. Before that we were also doing distillation of our own transformer/lstm models on model outputs (though with a different motivation than model compression, to learn selectional preferences, etc.).
etiam
Neutral mention · rule
Distillation (as you may be aware). https://arxiv.org/abs/1503.02531 Having to do that in each instance is still really cumbersome for cheap mass deployment compared to just making a digital-style exact copy, but then again I guess a main argument for wanting these systems is that they'd be doing things unachievable in practice on digital computers. In some cases one might be able to distill to digital arithmetic after the heavy parts of the optimization are done, for replication, distribution, better access for software analysis, etc.
curious_cat_163
Neutral mention · rule
Bit of a tangent -- I am not sure about how our brains deal with ambiguity vs sharp boundaries, but we can see a neural network change its tune quite a bit by adjusting this single number (i.e. the temperature parameter of Softmax function). This trick has been used for knowledge distillation (KD) as well. Hinton et. al. wrote this quite approachable paper on the topic: https://arxiv.org/pdf/1503.02531.pdf Turns out, one _needs_ nuance when one is trying to do KD. I am not sure if nuance and ambiguity as you describe are the same thing. But, even though it does not _feel_ like it, good generalizations over the lifetime of an organism might require dealing with nuance appropriately. A subject matter expert might have more to say about this. I cannot imagine that this hasn't been researched in humans.
FlyingLawnmower
Neutral mention · rule
Check out this work from Rich Caruana & collaborators on model compression: http://www.cs.cornell.edu/~caruana/compression.kdd06.pdf which was a precursor to the model distallation work from Geoff Hinton: https://arxiv.org/abs/1503.02531
sovok_x
Neutral mention · rule
https://arxiv.org/abs/1711.09784 https://arxiv.org/abs/1708.01785 https://arxiv.org/abs/1710.00935 https://arxiv.org/abs/1702.04595 https://arxiv.org/abs/1801.01693 https://arxiv.org/abs/1503.02531 https://arxiv.org/abs/1712.03781 https://arxiv.org/abs/1710.07535 https://arxiv.org/abs/1702.02540 https://arxiv.org/abs/1603.02518 http://ieeexplore.ieee.org/document/977279/ etc It is kind of far cry from established practice but how far cry from established implementation are your fears of unintended abuse? It's not nearly at the point yet to be paranoid. Having bugs in ANN before debugging makes them no different from usual software that is already used in forensic research. And nobody in their right mind will deploy networks that impossible or prohibitively difficult to debug for any kind of critical tasks. Otherwise irrational people can abuse power even without any software or ANNs.
nl
Neutral mention · rule
Sorry, but this comment is completely uniformed. Explaining ML inference is an active area of research, and there are plenty of decent approaches which are getting good results. For example, LIME[1] can explain why a neural network doing visual classification came out with the result that it did. Distilling the Knowledge in a Neural Network[2] is another approach which leads towards simpler representations. LIME isn't perfect, but that's the nature of research (and why DARPA funds this kind of thing). this is a fool's errand "Distilling the Knowledge in a Neural Network", authors: Geoffrey Hinton, Oriol Vinyals, Jeff Dean Fools, all of them. DARPA should ask HN next time it wants to know about the current state of AI. [1] https://github.com/marcotcr/lime [2] https://arxiv.org/abs/1503.02531
tlb
Neutral mention · rule
Adding perturbations is a common technique in machine learning. For example, the evolution strategies approach [https://blog.openai.com/evolution-strategies/] makes 100s of randomly tweaked policies, evaluates them against the task, and recombines them with weights proportional to their performance. Another approach is to train several different neural networks (an ensemble) on a task, and then train a final neural network based on the average of the ensemble. [https://arxiv.org/pdf/1503.02531v1.pdf] So you can probably replicate the useful features of flawed copying between humans.
iraphael
Neutral mention · rule
Well for starters, fine-tuning can be done in a variety of different ways. You can pretrain your model with a larger, different dataset, or you can train an autoencoder that learns some useful representation of that larger dataset and use the encoder as a base for fine tuning. Another approach I've seen that was really cool is Model Distillation [0], which is basically the training of a smaller NN with the inputs and outputs of a larger NN (where the output is slightly modified to increase gradients and make training faster). [0] https://arxiv.org/pdf/1503.02531v1.pdf
kajecounterhack
Neutral mention · rule
https://arxiv.org/abs/1503.02531 Modern applications of small networks regularly reduce sizes from larger state-of-the-art networks using distillation. Distillation compacts neural networks while affecting accuracy minimally. Instead of pruning directly from the large network, just learn how it generalizes. Takes fewer nodes / overall operations (Multiplications / Additions).
gyom
Neutral mention · rule
That's already a known method to transfer "knowledge" from one model to another. I should double-check before quoting a paper, but I think that this one talks about this (http://arxiv.org/abs/1503.02531). You train many models. Then you "distill" their predictions into one model by using the multiple predictions (from many models) as targets (for the single model trained afterwards). You're right to point out that humans don't do that. I think it would be "cheating" if you train BetaGo on AlphaGo, for the purposes for doing that experiment. The goal would be to have some kind of "clean room" where people fumble around. Of course, you can also run the other experiment to see how fast you can bootstrap BetaGo from AlphaGo. That's also interesting.

Keep following the thread.

More in Machine learning

More from the same topics.