JA EN
LearnDistillation & Compression
·★ MEMBER·PAPER·8 min read

Designing Distillation Data — Deciding What to Ask the Teacher

What decides a distilled student's quality is less how smart the teacher is than what you asked the teacher to answer. Synthetic data generation, coverage design, why you should skew toward hard problems, correctness filtering, and why DeepSeek-R1's distillation worked — from first principles.

ModalitytextTasktraining

DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning


A great tutor can't help if the problem set is thin

Imagine hiring a tutor. Suppose you find an outstanding one. What ultimately moves the student's score is still which problems you had the tutor work through, and how many of those worked solutions the student saw. If your tutor has mastered calculus but the problem set you handed over contains no calculus, none of that knowledge reaches the student. And if you make the student grind through a hundred pages of arithmetic they already have cold, you have burned time and gained nothing.

Knowledge distillation works exactly the same way. As we saw in Knowledge Distillation from Scratch, distillation means pulling the student's output distribution toward the teacher's. The loss function and the temperature are the ones described there. But what actually determines how the student turns out is not the fine print of the loss — it is which inputs you performed that pulling on.

This article is about that set of inputs: the distillation data.

What is actually being distilled today

In classical distillation you could take the teacher's logits (the raw scores that go into softmax) directly, because both models sat on your own machine.

In modern LLM distillation, the teacher is often a huge model behind an API, or teacher and student use different vocabularies (different token inventories). Then the probability table itself is out of reach. All you get is the text the teacher generated.

That is why sequence-level knowledge distillation became the norm: have the teacher solve problems, treat its output text as the target label, and train the student with ordinary supervised learning. Kim and Rush demonstrated this in machine translation in 2016, and nearly all LLM distillation today has this shape.

Notice what happened. The whole problem of distillation turned into a data-building problem. The loss is the same one you use for ordinary language model training. All the design freedom moved into: which inputs you collect, how many times and at what temperature the teacher answers, and which answers you keep. The rest of this article is about that.

The mechanism: the student is only constrained on the problems you drew

One equation is worth pinning down. Distillation loss can be written roughly like this.

L(θ)=Exq[KL(pT(x)    pS(x;θ))]\mathcal{L}(\theta) = \mathbb{E}_{x \sim q}\Big[\, \mathrm{KL}\big(p_T(\cdot \mid x) \;\|\; p_S(\cdot \mid x; \theta)\big) \Big]
(1)

Symbol by symbol: xx is an input (a prompt), qq is the distribution you draw inputs from when building the distillation set, pTp_T is the teacher's output probability, pSp_S the student's, θ\theta the student's parameters, and KL\mathrm{KL} measures the gap between two probability distributions (KL divergence).

In plain words, the equation says: "make the teacher and student answer alike, but only on the problems qq picked." Flip that around and it says the equation demands nothing at all of the student on inputs qq never drew. Whatever the student says there is an accident that happened outside of training.

That is the starting point for data design. The teacher's intelligence sets the quality of pTp_T, but qq is ours to choose — and a student's weaknesses tend to be shaped exactly like the holes in qq.

FIG 1The temperature you sample the teacher at. Turn it down and the teacher returns nearly the same answer every time (your data collapses into duplicates); turn it up and you reach the tail for variety, but errors come along. Distillation data generation lives on this dial.

"More is better" is not the rule. With softmax and cross-entropy, the gradient of the loss with respect to the student's logits takes a strikingly simple form.

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv:2501.12948Paper page·PDF
  2. Sequence-Level Knowledge Distillation. arXiv:1606.07947Paper page·PDF
  3. The False Promise of Imitating Proprietary LLMs. arXiv:2305.15717Paper page·PDF
  4. Self-Instruct: Aligning Language Models with Self-Generated Instructions. arXiv:2212.10560Paper page·PDF
  5. STaR: Bootstrapping Reasoning With Reasoning. arXiv:2203.14465Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment