DeepSeek-style reasoning distillation: what travels from teacher to student, and what gets cut from the loss?
In a DeepSeek-style reasoning distillation recipe, describe what the teacher actually produces, what shape the student's training examples take, which tokens are inside the loss versus masked out, and why the distillation collapses if the chain-of-thought is dropped from the target.
Teacher emits trace plus answer. Each example is a (problem, trace, answer) triple; SFT loss covers trace and answer with the prompt masked. Drop the trace and you teach answer-copying, not reasoning.
Imagine learning math from a tutor in two different styles. In style one, the tutor solves problems on a whiteboard step by step, and you copy the whole working including every line of arithmetic. In style two, the tutor only writes the final answer at the bottom and erases the rest. After a week of style one, you can solve new problems because you internalised the procedure. After a week of style two, you can recite the answers to the problems you saw, but a new problem stumps you because you never saw how the tutor got there. DeepSeek-style distillation works because the student copies the whole whiteboard, including the messy middle. Skip the middle and the student learns to mimic the bottom line of a fixed list of problems.
Detailed answer & concept explanation~9 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: teacher emits trace plus answer + triple as data shape + completion-only masking with trace in loss + correctness filtering + why trace in loss carries reasoning + comparison to answer-only SFT.
Real products, models, and research that use this idea.
- DeepSeek's R1 distillation release publicly demonstrated this recipe by distilling reasoning behavior from R1 into smaller dense models, with the full chain-of-thought kept inside the supervised target.
- Open-source replications such as OpenThoughts and DeepSeek V4 Reasoning distill curated trace plus answer datasets from strong teachers like Claude Opus 4.7 or GPT-5.5 into 7B to 70B students.
- Hugging Face's TRL SFTTrainer with completion-only masking is the standard implementation surface; the trace plus answer is wrapped in the assistant turn so the masking is automatic.
- Microsoft's Orca and Phi families pioneered the trace-distillation pattern earlier, showing measurable reasoning lift from including step by step traces in the supervised target.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does trace distillation compare to logit distillation on the same teacher?
QWhy does correctness filtering matter even when the teacher is strong?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the trace as part of the prompt rather than part of the response. The trace must sit inside the loss; the student is being graded on reproducing it, not conditioning on it.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.