The mechanism
The student writes a reply. For every word in it, two numbers exist: how likely the student was to write that word, and how likely the teacher would have been. Their difference (the log of one minus the log of the other) is the score for that word. The field calls this on-policy distillation: on-policy because the words are the student’s own, not copied from the teacher; distillation because the student is pulled toward the teacher’s judgment. Who the teacher is decides the method.- A stronger frozen model that already does the job. That is OPD. It needs a server that reports how likely it found each word, and it needs the same tokenizer as the student, or the words do not line up.
- The same model, shown the answer. The student sees the question. The teacher is the student’s own weights with the answer pasted into the prompt. That is OPSD, on-policy self-distillation. No second model, but it only works if seeing the answer changes what the model writes, which small models barely manage.
Run it
First, the score by hand, on a five-letter reply. Made-up probabilities; the arithmetic is the whole idea.privileged="answer" names the field of each task the teacher alone
sees. A chat API cannot be the teacher because it never reports how
likely it found the student’s words; a server you run does.
Last, the file the trainer reads. The library trains nothing itself; it
writes the config for prime-rl, which runs on your GPUs, and prints which
of your knobs the trainer will read and which it will ignore.
What it looked like on a real run
We trained one small model three ways on the same task (reverse a sentence letter by letter), from the same start, for the same twenty steps, and scored each on 128 sentences it never trained on. The recipe and the guide carry the intervals and the configs.
The frozen teacher reached the reward’s number with no reward. The
self-teacher moved a fifth as far, and the log shows why: showing this
0.6B model the answer barely changed what it wrote, so its per-word
scores stayed near zero for the whole run. Lesson 4’s rule applies here
too: three scores of the untrained model spread from 0.07 to 0.11, so a
change under 0.12 would have been noise.
Where it comes from
- Agarwal, R. et al. On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes. ICLR 2024. arXiv:2306.13649. The method, and why the student’s own words beat copied ones.
- Yang, A. et al. Qwen3 Technical Report. arXiv:2505.09388, 2025. The same score as RL at a tenth of the GPU hours.
- Shenfeld, I. et al. Self-Distillation Enables Continual Learning. arXiv:2601.19897, 2026. The same model, shown a demonstration, as the teacher.
- Zhao, S. et al. Self-Distilled Reasoner: On-Policy Self-Distillation for Large Language Models. arXiv:2601.18734, 2026. Beats GRPO where every attempt fails.
- Kaur, S. et al. Rethinking On-Policy Self-Distillation for Thinking Models. arXiv:2607.05184, 2026. Why it costs points on models that think out loud.