LLM & Transformer Fundamentals·Question 54 of 109Advanced

What is distillation, and how is it used in the LLM ecosystem?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Distillation trains a small student model to imitate a large teacher, transferring capability into a cheaper deployment footprint. The classic form (Hinton et al., 2015) matches the teacher's soft targets: minimise KL divergence between student and teacher output distributions, per token. The full distribution is far richer than the one-hot label - the teacher's relative probabilities over plausible alternatives ("dark knowledge") encode similarity structure a hard label discards - so the student learns more per example than from ground truth alone.

Full worked answer

Distillation trains a small student model to imitate a large teacher, transferring capability into a cheaper deployment footprint. The classic form (Hinton et al., 2015) matches the teacher's soft targets: minimise KL divergence between student and teacher output distributions, per token. The full distribution is far richer than the one-hot label - the teacher's relative probabilities over plausible alternatives ("dark knowledge") encode similarity structure a hard label discards - so the student learns more per example than from ground truth alone.

In the LLM world, two regimes:

  • Logit/white-box distillation: requires teacher logits, so teacher weights must be accessible (your own model, or open weights). Token-level KL on shared vocabulary; richest signal, most infrastructure.
  • Sequence-level / black-box distillation: generate outputs from the teacher and SFT the student on them - no logits needed, works through an API-shaped boundary. This is by far the dominant mode today: frontier labs distill their flagship internal models into the -mini/-flash/-haiku serving tiers, and the open ecosystem trains small models on synthetic data from large ones. DeepSeek-R1's release made the pattern vivid: R1-generated reasoning traces fine-tuned into Qwen and Llama models produced small models with strong reasoning - reasoning distillation (student imitates the teacher's chain of thought, not just final answers) turned out to transfer capability remarkably well, and much more cheaply than running RL on the small model directly.

Why it beats training small models from scratch: the teacher acts as a data engine and curriculum - its outputs are cleaner, more consistent, and better-formatted than raw web text, so the student reaches quality per parameter that its own scale couldn't extract from raw data. Combined with overtraining (question 44), it's how modern small models got so good.

Going further: follow-up territory

Limits and caveats: the student inherits the teacher's errors, biases, and style ceiling - you generally can't distill past the teacher; coverage gaps in generated data become student blind spots; quality/diversity filtering of teacher outputs is most of the actual engineering; and most commercial API terms prohibit distilling their outputs into competing models - the legal/ToS dimension is a real consideration, and a reason labs restrict logprob exposure.

What a good answer covers

  • Distillation trains a small student model to imitate a large teacher, transferring capability into a…
  • The classic form (Hinton et al., 2015) matches the teacher's soft targets
  • The full distribution is far richer than the one-hot label - the teacher's relative probabilities over…
  • Sequence-level / black-box distillation
  • Why it beats training small models from scratch

Key terms: student · teacher · soft targets · Logit/white-box distillation · Sequence-level / black-box distillation · reasoning distillation

Interviewer follow-ups to expect

  1. Why do soft targets carry more information than hard labels - can you formalise it?

  2. When does on-policy distillation (student generates, teacher corrects/scores) beat plain imitation of teacher outputs?

  3. How would you build a distillation data pipeline with quality filtering?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep