Cold Starts, Rejection Sampling, and Distillation › Distillation: hard targets, soft targets

Michael BrenndoerferNovember 29, 20265 min read
Language AI HandbookAll chapters
Part 40 of 67Reasoning Post-Training and Verifiable Rewards
Chapter 302Cold Starts, Rejection Sampling, and Distillation › Distillation: hard targets, soft targets
Reading section 6 of 12 · Distillation: hard targets, soft targets · 5 minSection 6 of 12 · 5 min

Section 6 of 12 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Distillation fits a student to targets supplied by a teacher. DeepSeek-R1 used the same roughly 800,000 training examples for the large model's intermediate supervised stage and the smaller Qwen and Llama models. The student checkpoints ranged from 1.5B to 70B parameters and included Llama-3.3-70B-Instruct. The report describes supervised fine-tuning for those students without an RL stage. DeepSeek-R1 report, §2.4

The sequence-level and logit-level variants are worth separating carefully.

Hard-target sequence distillation. Let DT\mathcal D_T be a fixed dataset of prompt and teacher-response pairs (x,τ∗)(x,\tau^*). The response can come from stochastic sampling, deterministic decoding, or a filtered teacher proposal. The student objective over this fixed dataset is

Lhard(ϕ)=−E(x,τ∗)∼DT[log⁡pϕ(τ∗∣x)].\mathcal{L}_{\text{hard}}(\phi)=-\mathbb E_{(x,\tau^*)\sim\mathcal D_T}\left[\log p_\phi(\tau^*\mid x)\right].

The hard target supplies one token at each visited prefix. If averaging over newly sampled teacher responses instead of a fixed dataset, the population objective also averages over τ∗∼pT(⋅∣x)\tau^*\sim p_T(\cdot\mid x) for each prompt. With fixed deterministic decoding the response is a function of the prompt.

Sequence-level knowledge distillation

Kim and Rush compared word-level and sequence-level distillation for machine translation. A hard sequence target can be chosen from the teacher’s output and then used in ordinary supervised training. Student free-running prefixes can still differ from those seen during training. Kim and Rush, §§3–4

Soft-target distillation. On the same fixed prompt and response pairs, the teacher gives a next-token distribution at each visited prefix. The student uses these distributional targets:

Lsoft(ϕ)=−E(x,τ∗)∼DT[∑t∑v∈VqT(v∣τ<t∗,x)log⁡pϕ(v∣τ<t∗,x)].\mathcal{L}_{\text{soft}}(\phi)=-\mathbb E_{(x,\tau^*)\sim\mathcal D_T}\left[\sum_t \sum_{v\in\mathcal V} q_T(v\mid\tau_{<t}^*,x)\log p_\phi(v\mid\tau_{<t}^*,x)\right].

Here qTq_T is the teacher next-token distribution and pϕp_\phi is the student distribution on the same token categories. Both are evaluated on shared training prefixes τ<t∗\tau^*_{<t}. Temperature can change how much probability mass each distribution allocates to alternatives. The displayed equation is cross-entropy at the chosen temperature; specifying any temperature or auxiliary hard-label terms is a separate design choice. Hinton, Vinyals, and Dean, §2

Hard-target distillation is a special case of soft-target distillation in which qTq_T is a Dirac mass on the teacher's sampled token. Both are valid; they trade off against different concerns.

  • Hard targets are straightforward to generate with a text-only teacher and can be retokenized. A chosen response gives the student a precise target for each visited context.
  • A single hard target does not tell the student how the teacher scored alternative tokens. Quality depends on the teacher output and dataset selection, and calibration is a separate empirical question.
  • Soft targets provide information about alternatives at the training prefix. Exact token-level comparisons require compatible categories or an explicit mapping. Better agreement with the teacher need not improve task accuracy or calibration.

Kim and Rush report results for a machine-translation setup. Their work distinguishes matching teacher token distributions from fitting a sequence selected using the teacher. It does not establish that one method dominates for long reasoning traces. Kim and Rush, §§4–5 and Table 1

Hard targets give the selected token at each visited prefix. Soft targets also give the probabilities of the alternatives at those same prefixes. Neither loss follows branches absent from the training-prefix set. At a fixed prefix, averaging one-hot targets sampled from the same teacher distribution gives that distributional cross-entropy in expectation. The practical difference depends on teacher concentration and prefix coverage.

In that example, the reasoning rows were filtered outputs of the earlier reasoning-RL checkpoint. The non-reasoning rows came from the DeepSeek-V3 pipeline. The report calls student training on this mixture distillation. The role of a teacher in building a corpus can involve proposing or judging rows at different stages.

A student may perform differently across trace lengths or problem types. The following figure makes a hypothetical length pattern explicit. It models a chosen scenario and gives no estimate for a language model.

Longer outputs consume more decoding steps. To compare models across length groups, record how prompts are grouped and whether length is a task property or an outcome of the model’s own generation.

The following illustrative calculation makes the shape of that length dependence explicit. The curves use logistic parameters for a teacher with a longer effective horizon and a student with a shorter one; they are a mechanism sketch, not a fitted model of any specific system.

PythonIn [6]
CollapseExpand
import numpy as np

trace_lengths = np.arange(20, 421, 10)
teacher_curve = 0.90 - 0.45 / (1.0 + np.exp(-(trace_lengths - 320.0) / 45.0))
student_curve = 0.82 - 0.75 / (1.0 + np.exp(-(trace_lengths - 160.0) / 35.0))
VisualizationOut [7]
CollapseExpand
Illustrative accuracy versus trace length for teacher and student models.
Illustrative accuracy versus required trace length for a teacher with a long effective horizon (sigmoid midpoint near 320 tokens) and a student with a shorter one (midpoint near 160 tokens). In the plotted range the student remains below the teacher. The gap is about 0.09 at 20 tokens and peaks near 0.70 at 250 tokens in this illustration.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy