Professional Machine Learning Engineer free question 7 / 10 · Domain 4: Serving and scaling models
You build a lightweight model for inference by knowledge distillation, fitting a small student to a large teacher. In the Keras knowledge distillation example, what is the purpose of applying a softmax temperature to the teacher's logits?
- To weaken the teacher's wrong predictions and reduce disagreement with the ground-truth labels
- To smooth the probability distribution and bring out the relationships between classes that the teacher has learned
- To match the scale of the student's logits to the teacher's and align the orders of magnitude of the loss
- To sharpen the probability distribution and strengthen the class the teacher is most sure of
Show the answer and explanation
Answer: B
Why this is correct
The Keras example describes knowledge distillation as a model compression procedure in which a small student is trained to match a large pretrained teacher, minimizing a loss that fits both the softened teacher logits and the ground-truth labels. The logits are softened with a softmax temperature, which smooths the probability distribution and brings out the relationships between classes that the teacher has learned.
Why the other options are wrong
"To sharpen the probability distribution and strengthen the class the teacher is most sure of" … The example says the temperature softens the logits and smooths the probability distribution. That is the opposite of sharpening it.
"To match the scale of the student's logits to the teacher's and align the orders of magnitude of the loss" … The purpose the example gives for the temperature is to smooth the probability distribution and bring out the class relationships the teacher learned. It does not describe matching the scale of the student's and teacher's logits.
"To weaken the teacher's wrong predictions and reduce disagreement with the ground-truth labels" … The ground-truth labels enter the loss as the other thing to fit alongside the softened teacher logits. Weakening the teacher's mistakes is not given as the purpose of the temperature.
Key point
In distillation, the teacher's softened output and the ground-truth labels are the two training signals for the student. The temperature changes the shape of the teacher's output distribution, and the value you use is chosen together with how the loss is built.