AI State of the Art
SOTA/Alignement : instruction, RLHF, DPO et apprentissage par renforcement/32 min
Section 120

On-Policy Distillation: Learning From Your Own Mistakes

Listen as a podcast →

Two ways to revise for an exam

Picture two students preparing for the same competitive exam.

The first spends every evening reading perfect essays written by the top of the class. He learns a great deal: the style, the ordering of arguments, the turns of phrase that land. But he never writes anything himself. On exam day he makes a mistake in the third paragraph, a mistake the top student never made, and which he has therefore never seen corrected. From that point on he is in unfamiliar territory, and everything that follows drifts.

The second student writes his own essays. A marker hands them back annotated word by word: "you lose the thread here", "this step is right", "wrong formula there". He never sees a perfect essay, but he learns exactly where he is weak.

The first student is classical distillation, teacher, student, soft targets, temperature. The second is on-policy distillation. This lesson sits precisely between classical distillation and RLVR (Reinforcement Learning with Verifiable Rewards); both pages are assumed read, and we will not repeat them.

The flaw in classical distillation that on-policy distillation fixes

In one sentence: classical distillation trains the student on text the teacher wrote, so the student is never corrected in the situations it actually gets itself into; on-policy distillation makes the student write and asks the teacher to annotate its paper, word by word.

The minimum vocabulary: "policy", "on" and "off"

One word to pin down immediately, because everything else hangs on it.

In reinforcement learning, a model's policy is simply its way of behaving: given the beginning of a text, which words it tends to produce next. The model is its policy.

  • Training is on-policy when the texts the model learns from are texts it produced itself.
  • It is off-policy when those texts come from somewhere else: a human, a dataset, or another model.

(The same pair of notions returns from another angle in Training LLM agents with RL, where the gap comes not from another model but from a stale version of the same one.)

Classical distillation is off-policy: the teacher generates answers, we write them to a file, and the student is trained to reproduce them. That is exactly the student rereading perfect essays.

Where exactly is the problem?

The student spends its entire training in situations the teacher encounters. In production it will find itself in situations that it encounters, and those are not the same, precisely because it is the weaker model. This is distribution mismatch: we train it in one world and deploy it in another.

Why the mismatch is expensive: compounding error

A language model produces text one token at a time, and each token becomes the input to the next. That is what makes distribution mismatch far more damaging here than elsewhere.

Suppose the student slips after twenty words. It is now in a state (a wonky partial text) that the teacher would never have produced, and which therefore appeared in none of its training data. The student has no idea what to do next. It improvises, errs further, drifts further still. This is compounding error: a small initial slip turns into an entirely wrong answer.

The longer the expected answer (a mathematical proof, a program, a ten-step agent session) the more violent the effect.

Not a new idea

The problem and its fix were formalised long before LLMs (large language models), in imitation learning (learning a behaviour by copying an expert), notably for self-driving: a car trained only on a perfect driver's trajectories does not know how to recover once it drifts off the racing line. The classical answer, the DAgger algorithm, is to let the student drive and ask the expert what it would have done in the states the student got itself into.

Ross, Gordon & Bagnell (2010), A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning (DAgger)

The mechanism, step by step

On-policy distillation applies that idea to language models. The loop has four beats:

  1. Draw a question from a pool of prompts (maths problems, coding tasks, instructions...). Note that no reference answer is needed, neither a human solution nor a teacher output.
  2. The student answers, in full, with its own style and its own mistakes. This is called a rollout: one attempt carried through to the end, with no intervention.
  3. The teacher reads that answer back. Crucially, it does not rewrite it. We simply feed it the student's text and ask, at every position, what probability distribution it would have produced over the next token.
  4. The student is corrected position by position: wherever its distribution departs from the teacher's, it is pulled closer.

Formally, we minimise a per-token Kullback-Leibler divergence, summed over the whole answer the student produced:

L(θ)=∑tKL(πθ(⋅∣st) ∥ πteacher(⋅∣st))\mathcal{L}(\theta) = \sum_{t} \mathrm{KL}\big(\pi_\theta(\cdot \mid s_t)\ \|\ \pi_{\text{teacher}}(\cdot \mid s_t)\big)

Symbol by symbol:

  • L(θ)\mathcal{L}(\theta) is the loss: the number training tries to push down. θ\theta (theta) stands for the student's parameters, i.e. its weights, the only things that move.
  • ∑t\sum_t means "add this up over every position tt in the text", so each token produced contributes its own penalty.
  • sts_t is the partial text at position tt, generated by the student.
  • πθ(⋅∣st)\pi_\theta(\cdot \mid s_t) is the probability distribution the student puts over the next token given that partial text; πteacher(⋅∣st)\pi_{\text{teacher}}(\cdot \mid s_t) is the teacher's over the same partial text. The Greek letter pi conventionally denotes a policy.
  • KL\mathrm{KL} is short for Kullback-Leibler, after the two authors of the measure: it is zero when two distributions are identical and grows as they diverge.

In one sentence: at every token of the student's own paper, we measure how far the student departs from what the teacher would have said at that exact spot, and add it all up. The decisive point is in the conditioning: sts_t comes from the student, not from the teacher.

Why this KL and not the other one

The usual choice is the reverse KL (the one written above, with the student as first argument) rather than the forward KL. In plain terms: instead of pushing the student to cover every possibility the teacher entertains (which a small model cannot do, and which leaves it blurry) we push it to commit to one mode the teacher endorses. The student comes out sharp rather than hedging.

Agarwal et al. (2023), On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes (GKD) Gu et al. (2023), MiniLLM: On-Policy Distillation of Large Language Models

What is learned, what stays frozen, what is recomputed

This is the distinction to hold on to, and the one most often blurred.

ItemRoleStatus
The student's weightswhat gets improvedlearned, they change at every step
The teacher's weightssupply the correctionfrozen, never updated; the teacher does not improve
The teacher's distributions over the student's textthe correction itselfrecomputed at every step: they cannot be prepared in advance, since they depend on what the student just wrote

That last row is the entire cost difference from classical distillation. Off-policy, the teacher's outputs are written to a file once and reused indefinitely. On-policy, the student writes fresh text at every step, so the teacher must read it afresh at every step. Nothing can be cached.

The hybrid: the density of SFT, the relevance of RL

This is where the technique gets interesting. Compare three ways of training a model after pre-training.

MethodThe text comes from...Signal receivedInformation per answer
Supervised fine-tuning (SFT)the teacher / a humanthe correct continuation at each tokendense, one correction per token
RL / RLVRthe student itselfa single final grade (right / wrong)sparse, one bit per answer
On-policy distillationthe student itselfthe teacher's distribution at each tokendense, one correction per token

Each classical method makes a sacrifice:

  • SFT gives a very rich signal (every token is corrected) but on the wrong text. That is the first student.
  • RL trains on the right text (the student's own output) but the signal is absurdly thin. A 3,000-word answer receives a single verdict: "wrong". The model learns that it failed, but not where. Finding the culprit among 3,000 tokens takes trying, failing, and repeating a great many times. That is what makes RL so expensive.

On-policy distillation takes the better half of each: you learn on your own output (like RL) with a correction at every token (like SFT). The teacher plays the marker who annotates the essay line by line instead of writing a single grade at the bottom.

The chess picture

RL is playing games with no coach: you know only whether you won or lost, never which move decided it. Classical distillation is watching a grandmaster play: superb moves, but in positions a beginner will never reach. On-policy distillation is having your own games analysed by an engine that labels every move, from "blunder" to "brilliant".

The economics: why everyone adopted it

The argument that shifted practice is an accounting one. A denser signal means fewer attempts, hence less compute.

The Qwen3 technical report gives the clearest published comparison so far. Starting from the same checkpoint (an 8B model already distilled off-policy), the team compares two continuations: standard RL, or on-policy distillation.

Continuation (Qwen3-8B)AIME'24AIME'25GPQA-DiamondGPU hours
Starting point (off-policy distillation)55.042.855.6–
+ Reinforcement learning67.655.561.317,920
+ On-policy distillation74.465.563.31,800

Better scores, for roughly one tenth of the GPU hours. This is not "most of the gain for less money": in this particular experiment it is more gain for ten times less.

Qwen Team (2025), Qwen3 Technical Report, Strong-to-Weak Distillation, Table 21
How to read that number

The factor of ten is an order of magnitude measured in one configuration (an 8-billion-parameter model, maths and code tasks, a much stronger Qwen3 teacher). There is no reason it should transfer unchanged elsewhere. Remember what the result means (an order-of-magnitude saving when a good teacher is available) not the number itself.

A secondary source, treated as such

A blog post from Thinking Machines Lab, On-Policy Distillation (Kevin Lu and colleagues, 27 October 2025), reproduces this kind of result on Qwen3-8B and reports even larger gaps: on the order of 7 to 10 times fewer gradient steps, which they translate into a 50-100x compute saving. It is a company blog post, not peer-reviewed, describing a single experiment: valuable as an illustration, not as a reference measurement.

When it does not work

None of this is free. Four limits are worth knowing.

1. You need a teacher, and running it costs money

At every training step the teacher (usually much larger than the student) must read the entire generated text back. If you do not already have a stronger model, the method has nothing to work with.

2. The teacher is the ceiling

The student learns to resemble the teacher on its own trajectories. It will not discover a strategy the teacher does not know. RL, by contrast, explores: it can find solutions nobody showed it. That is the price of the cost saving, and the reason both methods coexist.

3. You need access to the teacher's probabilities

Unlike black-box classical distillation, which makes do with the teacher's generated text, the on-policy version needs the teacher's distributions over the student's output. That requires open weights, or at minimum an API (application programming interface, the socket through which one program calls another) exposing log-probabilities (the logarithm of the probability assigned to each token, see numerical stability) plus a compatible token vocabulary between the two models. This is not a legal footnote: a provider that publishes neither its weights nor its probabilities rules the method out.

4. Distillation does not always beat direct training

This is the most useful result to retain, and it holds for distillation in general. Work from Apple established a distillation scaling law: a formula predicting student performance from a compute budget and its allocation between teacher and student. Its conclusion is nuanced:

  • If the teacher already exists, or if many students will be distilled from it, distillation beats supervised learning, but only up to a certain compute level, one that scales predictably with student size. Beyond that, direct training wins again.
  • If only one student is to be distilled and the teacher must also be trained, supervised learning is generally preferable.
Busbridge et al. (2025), Distillation Scaling Laws (Apple)

Put differently: distillation is a shortcut, and like every shortcut it has a domain of validity. Distilling "forever" does not catch up with a long enough direct training run.

An important caveat

That scaling law was established on distilled pre-training, not on on-policy distillation during post-training. It gives the right intuition (the shortcut has a limit) but you cannot read a numerical threshold off it for the case discussed here. To my knowledge the equivalent has not yet been published for on-policy distillation.

Actual usage in 2026

The technique has left the lab. Several open-model families describe, in their own technical reports, an on-policy distillation stage in post-training. Here is only what can be verified against a primary source:

ModelWhat the technical report says
Qwen3 (2025)A two-phase "strong-to-weak" procedure: off-policy distillation, then on-policy distillation where the student generates and aligns its logits (the raw scores a model assigns to each candidate token, before they are turned into probabilities) with those of a Qwen3-32B or Qwen3-235B-A22B teacher
MiMo-V2-Flash (2026)A paradigm named MOPD (Multi-Teacher On-Policy Distillation): domain-specialised teachers, themselves trained by RL, supply dense, token-level reward
GLM-5 (2026)"Cross-stage" on-policy distillation at the end of the pipeline, to recover capabilities degraded by the successive RL phases
DeepSeek-V4 (2026)The mixed RL stage is, per the report, entirely replaced by multi-teacher on-policy distillation, merging domain experts into a single unified model, more than ten teachers for one student
MiMo-V2-Flash Technical Report (2026) GLM-5: from Vibe Coding to Agentic Engineering (2026) DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence (2026)

A common pattern emerges from these four reports: train one expert per domain (maths, code, agentic tasks, instruction following), typically by RL, then merge them into a single model by on-policy distillation, the student writes, and several teachers annotate every token. On-policy distillation serves as much as a model-merging tool as a compression tool.

On the word "consensus"

You will regularly read that on-policy distillation is "the 2026 consensus". That phrasing comes from blog posts, not from a study. What can be asserted is more modest: several leading teams independently described this stage in their technical reports across 2025-2026, which is a clear trend. It says nothing about closed labs, which do not publish their recipes, nor about what will still be dominant practice a year from now.

A community post published on the Hugging Face blog on 8 July 2026 (Sergio Paniego, Distillation in 2026 (so far)) surveys these uses and is a good entry point, but it is a blog round-up, not a reviewed publication, and some of the attributions it makes are not borne out by the corresponding technical reports. Always check the source.

Why it matters

Three reasons to keep this technique in mind.

It changes the economics of post-training. RL was the mandatory, expensive step that turned a capable model into a reliable one. If a large share of that gain is obtainable for a tenth of the compute, access to good specialised models widens well beyond the handful of players who can fund an RL campaign.

It reframes compression. Classical distillation aimed at producing a small, fast model. On-policy distillation is also used to merge skills (several experts into one model) and to restore capabilities damaged by later training, a use the off-policy version could not support.

It illustrates a general lesson. The progress did not come from a better signal, but from applying it in the right place: on the student's actual mistakes rather than on the teacher's successes. That is the same underlying move as RLVR, train where the model fails, not where it already succeeds.

Key takeaways

  1. The problem: classical distillation trains the student on the teacher's text. The student therefore never sees its own failure states corrected, and since it generates token by token, one early slip drags the rest down (compounding error).
  2. The fix: the student generates, and the teacher reads its output back, supplying at every token the distribution it would have produced. We minimise a per-token reverse KL along the student's own trajectories.
  3. The hybrid: the density of supervised fine-tuning (one correction per token, not a single final verdict) plus the relevance of reinforcement learning (you train on your own output). Exactly one object learns, the student; the teacher is frozen, but it must re-read at every step, and that is where its cost sits.
  4. The payoff: the Qwen3 technical report measures better scores for roughly ten times fewer GPU hours than RL from an identical checkpoint (1,800 against 17,920). An order of magnitude measured once, not a universal constant.
  5. The limits: you need a stronger teacher whose probabilities you can read; the student will not surpass its teacher; and distillation scaling laws show that distilling only beats direct training up to a certain compute budget.
  6. In 2026: Qwen3, MiMo-V2-Flash, GLM-5 and DeepSeek-V4 all describe an on-policy distillation stage in post-training, often to merge domain experts. A clear, documented trend, not an established consensus.
Check your understanding0 / 4

1. Which flaw of classic distillation does the on-policy version fix?

2. During the on-policy distillation loop, what exactly does the teacher do?

3. According to the Qwen3 report, why does on-policy distillation reach better scores than RL for roughly one tenth of the GPU hours?

4. If on-policy distillation is so much cheaper, why has RL not disappeared from post-training recipes?