On-policy distillation: a map
Read first: REINFORCE and the Policy-Gradient Theorem (Williams 1992; Sutton et al. 1999) · Distilling the Knowledge in a Neural Network
TL;DR. On-policy distillation (OPD) trains a student on text it samples itself, using teacher feedback at every prefix the student visited. The most common implementation scores each token with the teacher’s log-probability and minimises the reverse KL from student to teacher; other methods use forward KL, JSD or selective token masks. With the reverse-KL choice, OPD is RL with a dense per-token reward. The family differs mainly in who the teacher is (a bigger model, several RL specialists, the model itself with extra context, or a black-box API) and how each token is graded (one sampled-token log-ratio, top-k logits, or the full vocabulary).
Why it matters now. OPD moved from a 2023 research idea to the last stage of frontier post-training in 2025–2026. Qwen3 uses it to make its small models. Xiaomi’s MiMo-V2-Flash names its multi-teacher version MOPD and calls it a new post-training paradigm. DeepSeek-V4 says it entirely replaced the mixed-RL stage of V3.2 with multi-teacher OPD. For search and deep-research agents, OPD is how a specialised search teacher’s behaviour is merged into one deployable model without running RL on every skill again. The same exposure-bias logic also shows up in retrieval itself: see on-policy chain retrieval.
Key idea
Section titled “Key idea”What makes it OPD. Four choices are separate: whose samples the training visits (the student’s, for OPD), which divergence is used, which tokens are scored, and who the teacher is. The common white-box recipe fixes the second choice to reverse KL. Write for the student and for the teacher. Sample . Let the teacher prefill in one forward pass, which gives at every position. Minimise the per-token reverse KL on the student’s own prefixes:
The RL view. Grade only the sampled token and you get a per-token advantage
whose expectation over is exactly at that prefix.
A two-token example. Suppose the student gives the token it sampled probability 0.3. If the teacher gives that token 0.6, then , and the update raises the token’s probability. If the teacher gives it 0.1, then , and the update lowers it. The sign measures relative probability (does the teacher like this token more or less than the student does?), not whether the token is factually correct.
Fixed prefix versus whole sequence. At a fixed prefix, the sampled log-ratio gives an unbiased gradient of the negative reverse KL. With the rollout prefixes treated as fixed data, a policy-gradient update with discount 0 averages these local gradients; that is the Thinking Machines recipe. The full sequence-KL gradient additionally credits each token for its effect on which future prefixes get visited. MiniLLM keeps that future-return term (a cumulative return, discount 1) and adds variance-reduction tricks. MOPD drops into GRPO/PPO code as if it were a reward, with a stop-gradient (written : the teacher-minus-student value is treated as a constant number, so no gradient flows through the student’s own log-probability inside it) and clipping. Three properties follow:
- Dense. RLVR gives one scalar per answer. OPD gives one per token, so credit assignment is direct.
- Non-stationary, with a known optimum. The reward depends on the current student; exact KL is minimised when the student matches the teacher, unlike an unconstrained learned reward. That does not guarantee safe optimisation with sampled, clipped or length-normalised surrogates: MiniLLM observes short or repetitive outputs and adds stabilising remedies.
- Teacher-targeted, not reward-targeted. Pure distillation aims at the teacher distribution rather than directly optimising task reward. This limits the available supervision, so OPD mostly transfers skill rather than discovering it, but it does not impose a strict ceiling on benchmark accuracy: GKD’s self-distilled students, some MiniLLM students and MOPD’s AIME26 result all outscore their teachers.
Why reverse KL. Reverse KL is mode-seeking: the student pays a lot for putting mass where the teacher puts almost none, and little for ignoring some teacher modes. A small student cannot cover everything a big teacher can do, so it concentrates on what it can do well. MiniLLM argues forward KL makes the student overestimate the teacher’s low-probability (“void”) regions. GKD shows the best divergence depends on task and sampling temperature, and some self-distillation methods (OPSD, SDFT) find forward KL works best in their setting.
Why on-policy reduces exposure bias. SFT and classic knowledge distillation train on teacher or dataset prefixes. At inference the student conditions on its own prefixes, which drift after its first mistake, and it never saw those states in training. OPD samples the prefixes from the student, so the teacher’s grades arrive exactly on the states the student will visit, including states after its own errors. This reduces the train–test mismatch; it does not guarantee that the student learns to recover from every bad prefix. This is the DAgger argument from imitation learning, which GKD makes explicitly.
The family at a glance
Section titled “The family at a glance”| Method (year) | Teacher | Whose samples | Per-token signal | Distinctive idea | Page |
|---|---|---|---|---|---|
| GKD (2023, ICLR 2024) | Bigger model | Mix: fraction λ of student samples | Full distribution: forward KL, reverse KL or JSD(β) | Data source and divergence are knobs; can add an RL reward | GKD |
| MiniLLM (2023, ICLR 2024) | Bigger model | Student, mixed with teacher (α = 0.2) | Sequence-level reverse KL via policy gradient | Single-step decomposition, length normalisation, teacher-mixed sampling | MiniLLM |
| Thinking Machines OPD (2025, blog) | Bigger model or earlier checkpoint | Student | Sampled-token log-ratio, discount 0 | One teacher forward pass inside a normal RL loop; continual-learning use | OPD blog |
| Qwen3 strong-to-weak (2025) | Qwen3-32B or 235B-A22B | Off-policy phase, then student | Logit KL | Production recipe for the small Qwen3 models; compared head-to-head with RL | Qwen3 |
| MOPD (Xiaomi, 2026) | Several RL specialists from one SFT checkpoint | Student; each prompt routed to its domain teacher | Sampled-token reverse KL (or top-k, k = 64), optional outcome reward | Merge specialists in policy space; teachers run as prefill services | MOPD |
| DeepSeek-V4 / V4.1-Flash (2026) | More than 10 (V4) and more than 40 (V4.1-Flash) specialists | Student | Full-vocabulary reverse KL, weighted per teacher | Replaces mixed RL; teacher weights and logits offloaded | DeepSeek-V4, V4.1-Flash |
| Open-MOPD (2026) | Three specialists on a 3B base | Student | As MOPD | Fixes token-budget imbalance across domains | MOPD § Open-MOPD |
| OPSD (2026) | The model itself, shown the reference solution | Student | Full-vocabulary clipped divergence (forward KL best) | No bigger teacher; fixed initial policy as teacher | OPSD |
| SDFT (2026) | The model itself, shown a demonstration | Student | Divergence to the in-context teacher (forward KL in practice) | Learning new skills from demos with less forgetting | SDFT |
| SD-Search (2026) | The model itself, given a hindsight summary of a group of rollouts | Student | Token-level JSD at search-query positions, on top of GRPO | Self-distillation aimed at search queries | arXiv 2605.18299 |
Related methods outside the white-box recipe. Two methods often listed beside OPD differ in a way that matters:
- π-Distill (2026) — privileged-information teacher rollouts. Its main method trains on traces generated by the PI-conditioned teacher, with teacher and student jointly updated in one parameter-shared model; the authors note it “can be viewed as off-policy learning”. Its separate OPSD alternative uses student rollouts. See π-Distill.
- GAD (2025) — related black-box distillation. Student-generated responses receive a sequence-level scalar reward from a learned discriminator trained to tell them apart from the API teacher’s (GPT-5-Chat in the paper); no teacher-token log-probabilities are required, so it works with text-only teachers and any tokenizer. See arXiv 2511.10643.
Naming. “MOPD” is Xiaomi’s name, introduced in the MiMo-V2-Flash report and expanded in a standalone paper. DeepSeek-V4 describes the same multi-teacher idea without that name. Note also that “OPSD” means two different things on this site: Zhao et al.’s self-distillation and a π-Distill variant.
Further reading. A broad survey (Song & Zheng, arXiv 2604.00626) covers teacher supervision, self-distillation, OPD + RL, multi-teacher OPD, agentic OPD and open problems such as cross-tokenizer distillation. Its multi-teacher section lists further MOPD variants (TrustMOPD, Δ-MOPD, CaMOPD, D³-MOPD) that this site does not cover.
Key results (anchor numbers)
Section titled “Key results (anchor numbers)”- MiniLLM (Table 1): a GPT-2 120M student distilled from GPT-2 1.5B scores 44.7 GPT-4 feedback on DollyEval, versus 38.6 SFT, 40.3 KD and 41.2 SeqKD. A LLaMA-7B student from LLaMA-13B reaches 76.4, versus 73.0 SFT (teacher 79.0).
- Qwen3 (Table 21, 8B student, same starting checkpoint): AIME’24 55.0 → 67.6 with RL (17,920 GPU hours) and → 74.4 with OPD (1,800 GPU hours). OPD also raises pass@64 (90.0 → 93.3); RL leaves it at 90.0.
- Thinking Machines: from a 60% SFT checkpoint, about 150 OPD steps reach 70% on AIME’24, an estimated 9–30× less compute than extrapolated SFT. Distilling an RL-trained policy takes 7–10× fewer gradient steps than RL.
- MOPD paper (Qwen3-30B-A3B, three domains): MOPD recovers 0.937 of the teacher–SFT gap on average, versus 0.882 for mixed-domain RL and 0.775 for cascaded RL, with every domain between 0.91 and 0.95.
- Open-MOPD: on SmolLM3-3B, a standard multi-teacher OPD baseline recovers 35.6% of the improvement from mixed-domain SFT to the routed RL experts (RouteRL); Open-MOPD’s combined token-share balancing, gap-aware allocation and student reward refresh raise recovery to 83.4%.
All of these are author-reported; most report no uncertainty estimates, and the Qwen3, MiMo and DeepSeek numbers come from vendor reports.
When to use OPD, RLVR or SFT
Section titled “When to use OPD, RLVR or SFT”| Situation | Use | Why |
|---|---|---|
| Cold start: the student’s samples are poor or the format is new | SFT or off-policy KD first | OPD grades are only informative if the student already lands near the teacher’s support |
| A stronger teacher with the same tokenizer exists | OPD | Dense signal on the student’s own states; Qwen3 reports about one-tenth of RL’s GPU hours for a better result |
| You need to exceed every available model, or no teacher exists | RLVR (GRPO and relatives) | OPD targets the teacher’s distribution; an outcome reward optimises the task directly |
| Several specialists must become one model | MOPD / multi-teacher OPD | Avoids the see-saw of mixed RL and the forgetting of cascaded RL; check each domain’s effective gradient weight |
| No bigger teacher, but you have solutions, demos or hindsight | Self-distillation (OPSD, SDFT, SD-Search) | The model conditioned on extra context is the teacher |
| The teacher is an API returning text only | SFT on its outputs, or GAD | Logit OPD needs log-probabilities on the student’s tokens |
| Continual learning or personalisation after domain mid-training | OPD from the model’s pre-update version | Thinking Machines uses this to restore instruction following lost during mid-training |
These modes compose. The production recipes all chain them: SFT → RL (to make teachers) → OPD (to merge them), sometimes with an outcome reward added to the OPD advantage.
Limitations & open questions
Section titled “Limitations & open questions”- Teacher-bound supervision and cost accounting. OPD mostly transfers skill; the teacher’s own RL is the expensive part and is rarely counted in “OPD is cheaper” claims.
- Compatibility. Logit OPD needs a shared vocabulary. Even then, the MOPD paper finds that a stronger external teacher can hurt: same-origin teachers mattered more than raw strength.
- Variance versus I/O. Sampled-token grades are cheap but noisy; full-vocabulary grades are exact but require moving teacher logits at scale (DeepSeek-V4 rebuilds them from cached last-layer hidden states).
- Domain imbalance. With long math or code trajectories and short instruction-following answers, a prompt-balanced mix under a global token-mean loss starves the short domain of gradient weight. Inspect the loss reduction first: a global token mean weights responses by length, while a sequence mean does not, so token-share balancing on top of sequence normalisation can over-correct.
- Regressions hide in averages. After MOPD, MiMo-V2-Flash matches or beats its best teacher on most benchmarks, but ends 6.3 points below the teacher on BrowseComp and drops 3.9 points on Arena-Hard creative writing.
- Cross-tokenizer and black-box teachers remain open; GAD is one answer, and the survey lists others.
Suggested reading order
Section titled “Suggested reading order”This is the technical path. For an intuition-first route, read this map, then On-Policy Distillation (Thinking Machines), then MOPD, and come back to GKD and MiniLLM for the derivations.
- GKD for the on-policy argument and the divergence choice.
- MiniLLM for the policy-gradient form of reverse KL and its pitfalls.
- On-Policy Distillation (Thinking Machines) for the simple modern recipe.
- Qwen3 §4.5 and Table 21 for a production comparison with RL.
- MOPD for multi-teacher merging, then the DeepSeek-V4 post-training section for the full-vocabulary variant.
- OPSD and SDFT for self-distillation.
Connections
Section titled “Connections”- Foundations: Knowledge distillation (off-policy, forward KL) and REINFORCE / policy gradient (the update OPD reuses).
- RL side: GRPO is the usual training loop that OPD advantages are dropped into.
- Tech reports: Qwen3, MiMo-V2-Flash, DeepSeek-V4, DeepSeek-V4.1-Flash and GLM-4.5 (which merges experts by self-distillation).
- Teaching-focused RL in this group: RLT trains the teacher itself; LUFFY mixes off-policy teacher traces into RL; Pedagogical RL.
- Retrieval: On-policy chain retrieval applies the same exposure-bias argument to multi-hop dense retrievers.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
At one prefix the student's next-token distribution over three tokens is p_S = (A 0.5, B 0.3, C 0.2) and the teacher's is p_T = (A 0.7, B 0.2, C 0.1). Compute the sampled-token OPD advantage A_t = log p_T − log p_S for each token the student could sample, its expectation under p_S, the reverse KL(p_S‖p_T) and the forward KL(p_T‖p_S). Then explain what the spread of the three advantages implies for choosing between the sampled-token, top-k and full-vocabulary forms of the loss.
What a strong answer covers
- Advantages: A ≈ +0.34 (log 1.4), B ≈ −0.41 (log 0.667), C ≈ −0.69 (log 0.5). Sampling A pushes A up; sampling B or C pushes those tokens down.
- Expectation under p_S: 0.5·0.34 + 0.3·(−0.41) + 0.2·(−0.69) ≈ −0.092, which is exactly −KL(p_S‖p_T). The reverse KL is ≈ 0.092 and the forward KL(p_T‖p_S) ≈ 0.085; the two differ because KL is asymmetric.
- The per-sample advantage has variance ≈ 0.19 around a mean of only −0.09, so one sampled token per position is a noisy estimate of the per-position KL. Every individual sign can disagree with the average.
- The full-vocabulary form sums over all three tokens at this prefix and removes that sampling noise, at the cost of the teacher shipping a whole distribution per position. Top-k keeps most of the mass with a small payload; MOPD's k = 64 form adds terms so that the retained-token generalised KL is minimised at the teacher's probabilities, but the omitted vocabulary tail is still omitted. DeepSeek-V4 cites the variance of the sampled-token form as its reason for full-vocabulary distillation.
- Mechanism
Place SFT on teacher outputs, off-policy logit KD, RLVR and on-policy distillation in a 2 × 2 grid of "whose states does training visit?" × "how dense is the signal?". Use the grid to explain why OPD reduces exposure bias and why it needs far fewer samples than RLVR, and say what OPD gives up relative to each neighbour.
What a strong answer covers
- SFT and off-policy KD train on teacher (or dataset) prefixes with a dense per-token target. At inference the student conditions on its own prefixes, which drift after its first mistake; it never saw those states in training (exposure bias, the DAgger argument).
- RLVR trains on the student's own prefixes but gets one scalar per answer, so credit assignment over thousands of tokens is weak and many rollouts are needed.
- OPD trains on the student's own prefixes and gets a grade for every token from the teacher, including on prefixes that already contain a student error. This is the on-policy, dense cell.
- Versus SFT/KD it costs student sampling and a teacher forward pass per step, and it needs a shared tokenizer for logit access. Versus RLVR it targets the teacher's distribution rather than task reward: its supervision comes only from the teacher, so it is a poor tool for discovering behaviour the teacher would not produce (although students can still outscore teachers on particular benchmarks).
- Critique
Qwen3's Table 21 starts from the same off-policy-distilled 8B checkpoint and reports that on-policy distillation reaches 74.4 on AIME'24 with 1,800 GPU hours, while RL reaches 67.6 with 17,920 GPU hours. List the threats to reading this as "OPD is 10× cheaper than RL", and design the experiment that would settle it.
What a strong answer covers
- The teacher (Qwen3-32B or Qwen3-235B-A22B) was itself trained with large-scale reasoning RL. Its cost is amortised and excluded; OPD is cheap because someone already paid for RL on a bigger model.
- OPD's supervision comes from the teacher, so the comparison says nothing about a setting with no stronger teacher, or about the frontier model that has to be trained first.
- The table is vendor-reported from one starting checkpoint with no uncertainty estimates, and training used math and code queries only (six benchmarks are reported). GPU-hour accounting (teacher prefill hardware, rollout engine) is not broken down.
- Settling experiment: fix total compute including teacher training, compare OPD against RL from a matched student across several student sizes and seeds, and include a domain where the teacher is weak. If OPD's advantage disappears there, the gain is transfer from the teacher, not a better optimiser.
- Connect
MiniLLM optimises sequence-level reverse KL with a policy-gradient return R_t = Σ over t' ≥ t of log p(y_t')/q_θ(y_t'), a cumulative return with discount 1. The Thinking Machines recipe uses the per-token log-ratio with discount 0. What does each estimator optimise, what does discount 0 throw away, and which extra machinery does each need?
What a strong answer covers
- Sequence-level reverse KL equals the sum over positions of the per-position KL, taken under the student's own state distribution. Its gradient has two parts: change the next-token distribution at a visited state, and change which future states get visited.
- Discount 0 keeps only the first part. Each token is graded only by its own log-ratio and ignores how it changes later grades. That is lower variance and simple, but myopic.
- MiniLLM keeps the future term (the "Long" part of its gradient using R_(t+1)). Because that return is noisy and favours short outputs, it adds the single-step decomposition (exact per-step expectation over the vocabulary), length normalisation, and teacher-mixed sampling against reward hacking.
- Both are RL with a dense, non-stationary reward that depends on the current student. Exact KL has a known optimum (the student matching the teacher), unlike an unconstrained learned reward, but that does not make sampled, clipped or length-normalised surrogates safe to optimise: MiniLLM observes degenerate short or repetitive outputs without its remedies.
- Design
You lead post-training for a 9B deep-research search agent. You have three RL-trained specialists from the same SFT checkpoint (a 30B search agent, a math reasoner and an instruction follower), plus GPT-class API access for writing quality. Search trajectories average 6,000 tokens and instruction-following responses 400. Design the pipeline (SFT, OPD, MOPD, RLVR or GAD, in which order and for which skill), the per-token signal you would use, and how you would detect regressions.
What a strong answer covers
- Start with SFT or off-policy distillation for support: OPD needs a student whose own samples are reasonable, so the teacher's grades are informative.
- Merge the same-origin specialists with MOPD: route each prompt by domain to its teacher, use the per-token reverse-KL advantage, and optionally add a small outcome reward as MiMo-V2-Flash does. The search teacher is larger, so check the tokenizer is shared.
- Check the loss reduction first (global token mean, sequence mean or prompt mean). Under a global token mean, an equal prompt mix gives instruction following only a few per cent of the gradient weight, the failure Open-MOPD diagnoses, so re-weight per domain toward the intended share. Under a per-sequence mean, long responses do not automatically dominate, and inverse-length re-weighting on top would over-correct.
- The API model returns text only, so logit OPD is impossible. Use GAD-style discriminator rewards or SFT on its outputs for writing style. Keep RLVR for anything where you want an outcome reward to push beyond every teacher.
- Track each domain against its own teacher, not a pooled average. After MOPD, MiMo-V2-Flash's BrowseComp ended 6.3 points below its best teacher while most benchmarks matched or beat theirs, so watch search accuracy, number of tool calls and answer length on held-out deep-research tasks.
- Research idea
MOPD's authors found that swapping their same-origin math teacher for a stronger external model (Qwen3-235B-A22B) made math worse, with initial per-token KL about 0.19 versus 0.04. Propose a research programme on teacher–student compatibility in OPD: what to measure, what hypotheses to test, and what method could make stronger but less compatible teachers usable.
What a strong answer covers
- Measure initial per-token KL, the fraction of student-sampled tokens the teacher puts low probability on, entropy over training, and the sign balance of advantages. MOPD reports a predominantly negative signal and entropy falling from about 0.30 to 0.21 with the external teacher.
- Hypothesis 1: most of the gap is style or format (different reasoning templates) rather than knowledge. Test by first SFT-ing the student on a few teacher samples, then re-measuring KL and OPD gains.
- Hypothesis 2: reverse KL's mode-seeking makes it punitive when the student's modes lie in teacher low-density regions. Test forward KL, JSD or clipped divergences (as in OPSD) at matched compute.
- Candidate methods: a curriculum from a same-origin teacher to the external one, mixing teacher and student sampling (MiniLLM's α), advantage clipping, or a bridge teacher fine-tuned toward the student's style.
- Report per-domain results, several seeds, and absolute scores (not only normalised ones) so a regression on one benchmark is visible.