Introduction
Multi-Teacher On-Policy Distillation separates two difficult engineering jobs in post-training: developing strong domain specialists and integrating their capabilities into a single general-purpose model. Rather than copying static teacher completions, the student practices on its own generated trajectories while the relevant domain specialist supplies dense next-token supervision along those visited states. That setup raises immediate questions about probability distributions, state-visitation shift, gradient estimators, teacher compatibility, and serving compute.
This 26-chapter technical book works through those questions from first principles, combining full derivations, benchmark tables, worked numerical traces, implementation pseudocode, an evidence audit, a complete notation reference, and worked exercises. Each chapter is self-contained enough to read on its own while building a continuous mathematical and systems narrative from token probabilities to frontier-scale deployment.
Two papers, two meanings of MOPD
Two distinct papers share the acronym MOPD: Wenhan Ma and coauthors' Multi-Teacher On-Policy Distillation (arXiv:2606.30406v1) and Weichen Yu and coauthors' Multi-Rollout On-Policy Distillation (arXiv:2605.12652v2). Throughout this book, we refer to them as MT-MOPD and MR-MOPD.
Both methods start from on-policy distillation—sampling rollouts from the student and evaluating a teacher's next-token distributions along the resulting prefixes—but they modify orthogonal parts of the supervision pipeline. MT-MOPD changes which teacher supplies the target by routing each prompt to its domain specialist. MR-MOPD changes what the teacher sees by placing verified passing and failing peer rollouts on the same prompt into the teacher's context as privileged information. This book centers on MT-MOPD while giving MR-MOPD a complete parallel treatment, covering its objective, peer-selection combinatorics, empirical results, and manuscript inconsistencies.
Intended audience and prerequisites
This book is written for engineers and researchers who want to analyze, audit, or implement on-policy distillation pipelines. Familiarity with standard deep learning helps, though the opening chapters build up tokenizers, autoregressive policies, supervised fine-tuning (SFT), reinforcement learning with verifiable rewards, Group Relative Policy Optimization (GRPO), KL divergences, and teacher forcing from the ground up.
Several recurring analytical distinctions run through the book:
- The policy-gradient update used in sampled-token distillation differentiates the student's action distribution at a fixed prefix, which drops the harder trajectory-level path derivative through future visited states.
- The corrected top- objective restores the exact optimum on the selected vocabulary coordinates by folding unselected tail mass into a remainder bucket, without recovering information about relative preferences inside that tail.
- MT-MOPD's headline normalized score measures how much of the specialist-over-SFT headroom the integrated student captures, rather than raw accuracy gain.
- MR-MOPD's manuscript contains a discrepant GPQA Chemistry baseline between tables, edge cases where prompt-level ranking metrics become undefined on all-pass or all-fail rollout groups, and unspecified fallback rules when peer pools are empty or exceed context limits. We document these points with exact source locators in the evidence and audit chapters.
All numerical examples use natural logarithms (divergences in nats) and decimal storage units (KB/MB/GB) unless binary units (MiB) are explicitly noted.
Contents
| Chapter | Focus |
|---|---|
| 1. Two Papers, One Acronym, Two Problems | The scope of this book, the capability-integration problem, and the distinction between Multi-Teacher and Multi-Rollout MOPD. |
| 2. Language Models as Probability Distributions and Policies | Tokens, logits, trajectories, teacher forcing, environment observations, and the notation used throughout the book. |
| 3. Post-Training, Rewards, and Specialist Development | Why SFT and reinforcement learning have different jobs, how GRPO uses rollout groups, and why multi-domain training can interfere. |
| 4. Why the Student Must Practice Its Own Paths | Exposure bias, visited-state distributions, on-policy supervision, and the limits of matching training to inference. |
| 5. What KL and Jensen–Shannon Actually Teach | Forward KL, reverse KL, entropy, support, mode coverage, and why a divergence does not certify correctness. |
| 6. The Multi-Teacher Pipeline from Beginning to End | Shared SFT, independent domain RL, frozen teacher services, prompt routing, and the unified student. |
| 7. The Reverse-KL Objective and Its Gradient | A derivation of local reverse-KL gradients and a careful separation from full trajectory-distribution differentiation. |
| 8. Implementing the Sampled-Token Update | Advantage signs, clipping, behavior-policy probabilities, masks, and practical sampled-token pseudocode. |
| 9. Why Top-k Distillation Needs a Correction | Deriving the corrected sparse loss, its gradients, its numerical behavior, and what it leaves unobserved. |
| 10. Routing, Teacher Disagreement, and Shared Capacity | Why prompt routing differs from averaging teachers, how domain mixtures weight learning, and why integration still has interference. |
| 11. Why a Stronger Teacher Can Teach Worse | Same-origin alignment, external-teacher failure, entropy collapse, and the limits of causal interpretation. |
| 12. Teacher Services, Throughput, and the Cost of Supervision | Asynchronous prefill, payload calculations, queue stability, and the difference between hidden latency and free compute. |
| 13. Reading the Multi-Teacher Experiments Correctly | The Qwen3 benchmark table, normalized headroom arithmetic, evaluation protocols, and the limits of efficiency claims. |
| 14. Frontier-Scale Integration and Repeated Rounds | MiMo-V2-Flash evidence, the second-round experiment, teacher surpassing, and retention without direct rehearsal. |
| 15. Multi-Rollout MOPD: Learning from Local Trial and Error | The second paper’s rollout groups, verifier partition, peer-conditioned teacher, and self-distillation setting. |
| 16. Peer Selection, Availability, and Context Budgets | When successful peers exist, leave-one-out coverage, informative failures, and the combinatorics behind rollout groups. |
| 17. Privileged Information and the Limits of Self-Teaching | How a teacher can know more without having more parameters, why verifier information matters, and where contextual distillation can fail. |
| 18. What the Multi-Rollout Results Show | Code, math, science, tools, peer ablations, teacher-student comparisons, and multi-sample evaluation. |
| 19. Auditing Teacher Signals, Diversity, and the Source | Ranking metrics, undefined prompt cases, Brier limitations, diversity interpretation, and manuscript inconsistencies. |
| 20. Worked Examples from Task to Update | A full identifier-composition example, peer construction, toy gradients, top-k comparison, and a routed multi-teacher trace. |
| 21. An Implementation Blueprint with Explicit Assumptions | A practical component design for both methods, record schemas, causal scoring, and failure modes to test before scaling. |
| 22. Designing a Reproduction That Answers the Right Question | Known settings, missing details, fair budgets, uncertainty, held-out tasks, and an ablation plan. |
| 23. Limits, Guarantees, and What Small KL Cannot Promise | Capacity, support, distribution shift, sequence-level bounds, verifier limits, and research questions. |
| 24. Synthesis and Frequently Asked Questions | Direct answers to common misconceptions and a comparison of the two papers’ contributions. |
| 25. Notation, Glossary, and an Auditable Source Map | A reference for symbols, technical terms, paper sections, local source snapshots, and further primary reading. |
| 26. Exercises and Worked Solutions | Checks of understanding for KL direction, sparse objectives, headroom scores, peer coverage, metrics, and system cost. |
Reading paths
- Complete sequential reading (Chapters 1–26): Chapters 1–5 build the probabilistic and RL foundations, Chapters 6–14 cover MT-MOPD, Chapters 15–19 cover MR-MOPD, and Chapters 20–26 synthesize both through worked traces, system blueprints, evaluation design, theoretical bounds, and reference material.
- Mathematical foundations (Chapters 2, 4–5, 7–9, 20, 23, 26): Focuses on KL directionality, fixed-context versus full trajectory-distribution gradients, importance-weighted policy gradients, and the corrected top- objective.
- Systems and training pipelines (Chapters 3, 6, 8–12, 15–17, 21–22): Covers specialist RL decoupling, asynchronous teacher prefill services, loss masking, rollout-group combinatorics, and end-to-end cluster throughput.
- Empirical results and source audit (Chapters 1, 13–14, 18–19, 22–24): Examines the Qwen3-32B and MiMo-V2-Flash integration benchmarks, MR-MOPD's pass@ and signal-quality evaluations, and the manuscript audit.
- Fast conceptual overview (Chapters 1, 4, 6, 15, 20, 24): Traces what each algorithm modifies in the distillation loop and walks through concrete token-level updates before diving into full derivations.
1. Two Papers, One Acronym, Two Problems
A production language model has to handle very different tasks inside a single set of weights: proving mathematical claims, satisfying brittle formatting constraints, patching multi-file software repositories, and invoking external tools with well-typed arguments. Training a model to excel at any one of those domains is already demanding, but combining them into a single checkpoint introduces a distinct engineering challenge: capability integration.
Multi-Teacher On-Policy Distillation addresses capability integration by decoupling skill acquisition from skill consolidation. Domain teams first train dedicated specialists using domain-specific reinforcement learning recipes. A single generalist student then generates its own trajectories across all domains while the corresponding specialist provides dense next-token probability targets along the student's visited states. Because the student generates the prefixes on which it is supervised, it learns how to recover and complete reasoning paths it actually takes at inference time.
The naming collision
Two contemporary papers share the acronym MOPD while tackling different parts of post-training:
| Short name used here | Exact paper title | Version studied | Main question |
|---|---|---|---|
| MT-MOPD | MOPD: Multi-Teacher On-Policy Distillation for Capability Integration in LLM Post-Training | arXiv:2606.30406v1, June 29, 2026 | How can one student inherit skills from several domain specialists? |
| MR-MOPD | Multi-Rollout On-Policy Distillation via Peer Successes and Failures | arXiv:2605.12652v2, June 1, 2026 | How can other attempts on the same question improve the teacher's supervision? |
We use the labels MT-MOPD and MR-MOPD throughout this book to keep the two experimental programs distinct (MT paper, MR paper); whenever a chapter refers simply to "multi-teacher distillation," it means the first paper.
Both methods build on on-policy distillation, where the training loop samples a trajectory from the current student policy and queries a teacher for next-token distributions at every prefix along that trajectory. Where they diverge is how the teacher target is constructed: MT-MOPD changes which teacher scores the trajectory by routing each prompt to a domain specialist, whereas MR-MOPD changes what context the teacher sees by conditioning the teacher on verified peer rollouts from the same prompt.
Why specialist improvements do not simply add together
Suppose we start from a shared supervised fine-tuned checkpoint and train three separate copies: one on competition mathematics with symbolic answer verification, a second on instruction-following prompts with programmatic constraint checkers, and a third on repository repair inside containerized test harnesses. Each specialist improves substantially on its target benchmark.
Combining those three checkpoints into one deployable model exposes immediate trade-offs among standard post-training strategies:
- Parameter merging: Averaging the weights of the three specialists requires no extra training, but neural network parameters do not partition cleanly by domain. Because the same attention heads and MLP projections participate across tasks, linear interpolation in weight space often degrades nonlinear circuit behavior that each specialist relied on.
- Joint multi-domain reinforcement learning (Mix-RL): Training a single model on all three reward functions simultaneously forces heterogeneous workloads into one optimization loop. A learning rate, rollout length, or KL penalty tuned for 32-thousand-token math proofs can destabilize short formatting prompts, while container-bound software engineering rollouts that take minutes to execute stall synchronous batch collection for fast text-only tasks.
- Sequential reinforcement learning (Cascade RL): Training on math first, then instruction following, and finally software engineering avoids multi-environment synchronization, but later stages overwrite earlier gains unless carefully regularized. Moreover, final performance becomes sensitive to the arbitrary ordering of domains.
Integrating behavior on student-visited states
To teach a student effectively, a specialist does not need to generate the demonstration from scratch. Suppose the student is halfway through a flawed mathematical derivation. When the math teacher evaluates that exact student prefix under teacher forcing, it assigns low probability to continuations that compound the error and higher probability to tokens that pivot toward a valid proof.
By querying the teacher on prefixes the student actually produced, the training loop delivers dense token-level corrections precisely along the student's current state visitation distribution. As the student's parameters update, its rollout distribution shifts, and the teacher automatically supervises the new frontier of states the student reaches.
In interactive agent tasks such as software engineering, a trajectory interleaves model-generated tool calls with environment-generated outputs (compiler errors, test logs, file contents). During distillation, the SWE specialist reads the entire interaction prefix produced by the student's live sandbox session and provides target distributions only over the action tokens controlled by the student. The environment still dictates what each command returns, while the teacher shapes how the student reacts to those observations.
MT-MOPD scales this mechanism across multiple domains by routing each training prompt to its designated domain specialist. At inference time, the resulting student runs as a single standalone model with no routing overhead or specialist ensemble required.
Conditioning the teacher on peer attempts
Even a strong teacher can struggle to provide sharp token-level credit assignment when it only sees the problem statement and the student's partial attempt. Consider a coding prompt where the student generates eight rollouts: two pass the unit tests, while six fail because they confuse 0-indexed and 1-indexed array bounds. A binary test verifier flags which rollouts passed and failed, but that scalar outcome does not tell the student which token in a 500-token function introduced the off-by-one bug.
MR-MOPD converts those group rollouts into privileged context for the teacher. Before scoring a target rollout , the teacher's prompt is augmented with verified passing and failing peer rollouts from the same group. Seeing a passing peer shows the teacher a concrete working implementation for that exact problem, while seeing a failing peer highlights common pitfalls.
Crucially, this setup works even in a self-distillation regime where the teacher and student start from the exact same model weights. Because the teacher conditions on verified peer solutions that are withheld from the student, it solves an easier conditional prediction problem and translates that privileged hindsight into dense token-level probability targets for the student.
Sources: Problem formulation and method taxonomies follow MT-MOPD §§1, 3, 5 and MR-MOPD §§1, 3.
Previous: Book introduction · Contents · Next: 2. Language Models as Probability Distributions and Policies
2. Language Models as Probability Distributions and Policies
In reinforcement learning and on-policy distillation, an autoregressive language model acts as a stochastic policy over discrete token sequences: at each step, it conditions on the prompt and preceding history to output a categorical distribution over the vocabulary. This chapter establishes the probabilistic notation used throughout the book and highlights implementation invariants—vocabulary alignment, log-normalizer handling, causal index shifts, and action masking—that determine whether a distillation pipeline optimizes the intended objective.
Tokens, logits, and probabilities
A tokenizer maps raw strings into sequences of integer token IDs drawn from a finite vocabulary . Given a context , the language model's forward pass produces a vector of unnormalized real-valued logits , which the softmax function converts into a categorical probability distribution:
Notice the role of the partition function in the denominator. If a teacher service returns only the top raw logits without returning either the full log-normalizer or pre-normalized log-probabilities, the student cannot recover the teacher's true vocabulary probabilities.
Every token probability is strictly conditional on the exact prefix . Furthermore, computing a token-level divergence between a student and a teacher requires their tokenizers and vocabulary tables to match identically. If token ID 123 maps to different byte sequences in the two models, comparing against is meaningless. In both MT-MOPD and MR-MOPD, teachers and students share the same base model family, tokenizer, and chat template formatting.
Autoregressive trajectories
Let denote the input prompt and
denote a generated response of length , where is the prefix before step (with empty). By the chain rule of probability, a student policy parameterized by weights assigns sequence probability
which becomes a sum in log space:
Throughout the book, we abbreviate the context at step as , the student's next-token distribution as , and the teacher's target distribution as . All logarithms are natural (), so entropies and KL divergences are measured in nats.
For single-turn text generation, every token is an action chosen by the policy. For multi-turn tool-use or software-engineering agents, a trajectory interleaves model-generated action tokens with environment-generated observation tokens (such as bash stdout or compiler diagnostics). Only the model's own decisions are parameterized by ; environment observations must be conditioned on as context but masked out of the policy gradient.
Sampling and the visited-state distribution
A policy's underlying probability distribution and the decoding rule used to generate rollouts are distinct mechanisms. Greedy decoding deterministically picks , while temperature sampling rescales logits by before applying softmax:
Nucleus (top-) or top- sampling further truncates the support of the sampling distribution by zeroing out low-probability tails and renormalizing. In policy-gradient training, importance ratios and score-function estimators assume that actions are drawn from a known behavior policy. If rollout workers apply temperature scaling or top-/top- truncation, the behavior probability logged for each sampled token must reflect the actual sampling distribution used during generation.
Keep the two meanings of separate: top- decoding truncates which tokens a rollout worker is allowed to sample during generation, whereas top- distillation restricts how many teacher token probabilities are transmitted to the loss function during training. Using in top- distillation does not imply truncating student generation to 64 tokens.
Teacher forcing as a parallel scoring pass
When a teacher evaluates a student rollout , it operates in teacher-forcing (or prefill) mode: at step , the teacher reads the exact student-generated prefix as fixed input history and outputs its own next-token distribution . It never overwrites with the tokens it would have generated itself.
If the student writes 2 + 2 = 5, the teacher's distribution at the final position is conditioned on the prefix 2 + 2 =, allowing it to assign near-zero probability to the student's sampled token 5 and high probability to 4. Because all tokens of the student rollout are already materialized before the teacher is called, a causal Transformer teacher can evaluate across all positions in a single parallel prefill forward pass. Causal attention masks still prevent position from attending to tokens at , making teacher scoring vastly faster than autoregressive generation of a -token response.
In code, causal language model outputs are shifted by one index relative to their inputs: the hidden state produced after reading input token predicts target token . Off-by-one indexing bugs here are notorious because the tensor shapes still match and the loss still decreases, even though the student is being trained to predict the token it just emitted.
Full distributions versus single sampled tokens
To see how supervision granularity affects credit assignment, consider a three-action toy vocabulary at a single prefix where the student is editing a function:
| Continuation | Student | Teacher |
|---|---|---|
| A: omit the null check | 0.50 | 0.10 |
| B: insert the null check | 0.30 | 0.70 |
| C: refactor an unrelated variable | 0.20 | 0.20 |
If the student samples continuation A and we only evaluate an end-of-sequence unit test, a binary reward tells us merely that the full program failed somewhere. If we use sampled-token distillation, we evaluate the teacher's probability on the single realized action A, observing ; this single-sample signal immediately pushes down the student's probability of A at position , while leaving the relative preference between B and C to be discovered on future visits. If we use distribution-level (or top-) distillation, the update at step simultaneously suppresses A, boosts B from toward , and leaves C unchanged on that single forward pass.
Note that a high local teacher probability means the teacher prefers token given prefix , not that every continuation starting with is guaranteed to pass downstream verification.
Action masks and length normalization
A serialized training sequence typically concatenates system instructions, user prompts, assistant reasoning tokens, tool calls, tool execution outputs, and right-padding. Let be a binary loss mask that equals on assistant-generated decision tokens and on prompts, environment observations, and padding. The sequence-normalized loss for a trajectory is
provided . Normalizing per trajectory gives short and long responses equal weight in the batch gradient, whereas summing across the batch weights trajectories proportionally to their response length. Masking out environment observations () is mandatory in agentic rollouts so the policy gradient never attempts to train the student to predict deterministic or stochastic environment outputs that the model does not control.
Student, teacher, and verifier roles
Three distinct components interact across the MOPD papers:
- The student is the parametric policy being updated and ultimately deployed.
- The teacher supplies a target distribution over the vocabulary at each student prefix . In MT-MOPD, comes from the specialist for domain . In MR-MOPD, comes from a model conditioned on a set of verified peer attempts .
- The verifier evaluates completed trajectories to return a task outcome (such as unit test pass/fail or exact-match math grading). During specialist RL and MR-MOPD rollout partitioning, the verifier grounds correctness; during distillation updates, the teacher translates its specialized weights or verifier-labeled context into dense per-token probabilities.
Sources: Trajectory and context notation follows MR-MOPD §2 and MT-MOPD §3.1 (Eq. 1).
Previous: 1. Two Papers, One Acronym, Two Problems · Contents · Next: 3. Post-Training, Rewards, and Specialist Development
3. Post-Training, Rewards, and Specialist Development
Multi-Teacher MOPD operates as a multi-stage post-training pipeline. Rather than assuming pre-existing external teachers, it develops its own domain specialists through reinforcement learning starting from a shared supervised fine-tuned (SFT) checkpoint. Understanding how those specialists acquire their capabilities—and why training them separately works better than training them jointly—requires examining the mechanics of SFT, verifiable-reward reinforcement learning, and multi-task gradient interference.
Supervised fine-tuning establishes the shared base
Pretraining equips a language model with broad world knowledge and linguistic fluency, while supervised fine-tuning (SFT) shapes it to follow user instructions, adopt chat templates, format tool calls, and emit structured chain-of-thought reasoning. Given a curated demonstration for prompt , SFT minimizes the token-level cross-entropy loss:
Every token in the demonstration provides a direct gradient signal, making SFT fast and stable. However, the model is only supervised on prefixes drawn from the static demonstration corpus. Once the model generates its own tokens at inference time and drifts slightly off the demonstration manifold, SFT provides no explicit training on how to recover from its own errors.
In MT-MOPD, a broad multi-domain SFT stage produces the common ancestor checkpoint that initializes both every domain specialist teacher and the final unified student.
Reinforcement learning and temporal credit assignment
Reinforcement learning closes the loop between generation and evaluation by sampling rollouts from the current policy and scoring them with a task reward :
Applying the log-derivative trick yields the score-function (REINFORCE) policy gradient:
In practice, subtracting a context-dependent baseline from reduces gradient variance without biasing the expectation, and modern policy-gradient optimizers add importance-ratio clipping and reference-policy KL penalties.
Even with variance reduction, outcome-based RL faces a severe temporal credit assignment bottleneck: a single scalar reward at the end of a -token rollout weights the log-probability gradient of every token in the sequence equally. If a software patch fails its test suite because of a single mistyped variable name on line 400, the negative advantage penalizes all 399 preceding lines of valid setup and reasoning alongside the actual bug.
Verifiable rewards and their scope
Post-training pipelines rely heavily on programmatic, verifiable rewards across four core domains:
- Mathematics: Symbolic equivalence checkers parse the model's boxed final answer and compare it against a ground-truth expression.
- Code generation and SWE agents: Sandboxed execution environments compile the model's patch and run unit or regression test suites.
- Instruction following: Rule-based verifiers check explicit structural constraints (word counts, JSON schemas, forbidden keywords, bullet formatting).
- Agentic tool use: Mock or live environment harnesses verify whether the final environment state matches the target configuration.
While programmatic verifiers eliminate reward-model hacking on surface style, they still measure only what they test. A finite unit test suite can pass code that fails on edge cases; a final-answer math grader rewards a lucky guess reached via a flawed proof; a constraint checker verifies formatting without judging factual accuracy. Because MT-MOPD distills the behavior of RL-trained specialists, any blind spots in a domain's verifier propagate through the specialist into the student. In MR-MOPD, the verifier plays an even more direct role during distillation by partitioning peer rollouts into passing and failing examples for the teacher's context.
Group Relative Policy Optimization (GRPO)
To avoid training a separate value-network critic of equal size to the policy, Group Relative Policy Optimization (GRPO) samples a group of rollouts for each prompt , scores each with the verifier to obtain rewards , and computes a standardized within-group advantage:
where and are the sample mean and standard deviation across the rollouts for prompt . Rollouts that outperform their peers on the same prompt receive positive advantage (), while worse rollouts receive negative advantage ().
When a prompt is so easy that all rollouts pass () or so hard that all fail (), the group standard deviation vanishes and across the entire group, contributing zero gradient. Dynamic Sampling filters out these zero-variance groups on the fly and continues sampling until the batch is filled with prompts that exhibit reward variance.
Note how the two stages of MT-MOPD differ here: the domain specialists are trained using GRPO with rollouts per prompt and Dynamic Sampling enabled, whereas the subsequent MT-MOPD distillation stage generates just one rollout per prompt () with no verifier calls or Dynamic Sampling required.
Why domains benefit from decoupled RL recipes
Different capabilities place conflicting operational demands on an RL training loop:
- Rollout length and latency: Competition math problems require long single-turn reasoning chains, instruction following uses short responses, and interactive SWE tasks require multi-turn container execution that can take several minutes per rollout.
- Reward sparsity and variance: A batch of formatting prompts may yield mixed rewards immediately, while hard coding or math benchmarks may produce mostly all-zero groups that require heavy Dynamic Sampling filtration.
- Hyperparameter sensitivity: Clipping thresholds, entropy bonuses, and sampling temperatures that encourage exploration in math reasoning can cause an instruction-following model to violate strict output schemas.
Decoupling specialist development lets each domain team run its own RL loop, environment cluster, rollout horizon, and stopping criterion independently without blocking or destabilizing other domains.
First-order mechanics of multi-domain interference
When a single parameter vector is updated on two domain losses and with gradients and , a gradient step on domain changes domain 's loss to first order by
Whenever the inner product , the two gradients point in conflicting half-spaces, and stepping to improve domain directly degrades domain . In joint multi-task RL, this conflict is exacerbated by high-variance sequence-level policy gradients and shifting prompt distributions under Dynamic Sampling.
Replacing sparse sequence-level rewards with dense token-level distillation targets dramatically lowers gradient variance, though it does not eliminate shared-parameter capacity limits—the unified student in MT-MOPD still optimizes a single set of weights across a mixture of domain prompts, a trade-off we analyze in Chapter 10.
The four integration baselines in MT-MOPD
MT-MOPD evaluates its specialist-then-distill pipeline against four standard multi-domain post-training alternatives:
- Mix-RL: Pools prompts and verifiers from all domains into a single joint GRPO training run on one model.
- Cascade RL: Trains a single model sequentially through one domain RL stage after another (whose final balance depends heavily on stage ordering and stopping points).
- Off-Policy Finetune: Trains independent domain specialists via RL, uses them to generate static completions on the training prompts, and fine-tunes the student via standard off-policy cross-entropy on those teacher trajectories.
- Param-Merge: Trains independent domain specialists via RL and merges their parameter tensors directly (e.g., via weight averaging) without further behavioral training.
Sources: Specialist RL configurations and integration baselines follow MT-MOPD §§3–4 and Appendix A.
Previous: 2. Language Models as Probability Distributions and Policies · Contents · Next: 4. Why the Student Must Practice Its Own Paths
4. Why the Student Must Practice Its Own Paths
Standard knowledge distillation works by imitation: you collect responses from a teacher model and train the student to reproduce them. On-policy distillation flips the order of operations. The student generates a response first, and the teacher scores the next-token distributions along the path the student actually took.
In an autoregressive language model, a state is a prompt concatenated with the partial response generated so far. Evaluating the teacher on states visited by the student makes the supervision responsive to the student's current habits, mistakes, and recovery paths.
A branching example
Suppose a coding problem requires composing two lookup tables. A strong teacher keeps the two mappings separate from line one, whereas the student conflates them under a misleading variable name. By the fourth line of code, the student has entered a prefix that would never appear in a corpus of teacher demonstrations.
Offline imitation keeps drilling the student on the teacher's clean opening lines. That may eventually fix the student's initial variable declaration, but it provides no direct supervision on how to continue, recover, or catch the bug once the bad prefix is already on screen. On-policy supervision hands that exact fourth-line student prefix to the teacher and asks how the teacher distributes probability mass over the next token. The benefit comes from matching the sampled histories to the student's current policy, regardless of whether the student and teacher share the same parameter count or architecture.
State distributions formalize the mismatch
Let denote the distribution of contexts reached at generation step when policy rolls out responses. A corpus of teacher trajectories samples contexts from , while deploying the student exposes it to contexts drawn from .
An offline distillation objective evaluates the divergence over teacher contexts:
An on-policy local objective shifts the outer expectation to the student's state distribution, and typically reverses the divergence direction as well:
Notice that the context distribution ( vs. ) and the divergence direction (forward vs. reverse KL) are independent design axes. You can compute forward KL on student-generated prefixes or reverse KL on a static offline dataset, so calling a loss "on-policy" specifies where the prefixes come from, not which divergence measures disagreement at each token.
Sampling from ensures that the teacher evaluates states the student is actually likely to reach—including flawed intermediate states where the student most needs corrective steering.
How errors compound across long horizons
In a simplified -step generation process where the student has a constant per-step probability of stepping off the teacher's preferred path, independent steps would leave a chance of staying on track. Even at over tokens, .
Token transitions in real language models are heavily correlated and many deviations are benign paraphrases, yet the basic compounding dynamic remains: tiny local discrepancies rapidly shift the distribution of long prefixes. In multi-turn agent workflows, early actions alter the external environment itself. Editing the wrong line of code triggers a different compiler traceback, which changes every subsequent token in the context window. At that point, the student isn't just continuing a slightly unusual phrasing; it is operating in a different environment state altogether.
What "no exposure bias" covers—and what it leaves out
The MT-MOPD paper states that training on student rollouts eliminates exposure bias because the integration targets are evaluated on prefixes generated by the current student rather than on teacher-generated prefixes.
Training on closes the gap between the prefixes seen during training and those generated at inference under the training distribution, though several operational mismatches still remain in practice:
- Deployment traffic rarely matches the prompt distribution of the training corpus.
- Production serving may use different decoding temperatures, system prompts, tool schemas, or maximum context lengths.
- In asynchronous distributed training, worker rollouts can lag behind the optimizer by several steps, making the sampled prefixes slightly off-policy relative to the latest weights .
On-policy sampling tracks a moving student distribution during training rather than guaranteeing an exact match to production inference.
The five steps of an on-policy distillation update
A single training step follows a straightforward loop:
- Sample a task prompt (and its domain label, if routing across specialists).
- Roll out a complete response from the student under its current policy .
- Pass the prompt and student-generated response to the teacher for causal scoring.
- Compute the token-level divergence between the student and teacher distributions at all valid response positions.
- Backpropagate the loss to update , then draw fresh student rollouts.
Crucially, the teacher never has to generate text token by token. Because the full student sequence is already known, a teacher prefill service can score every prefix of the trajectory in a single parallel forward pass.
The two MOPD variants hook into this loop at different points: MT-MOPD routes step 3 to a domain-specific teacher based on the prompt's task label, whereas MR-MOPD inserts a verification and context-assembly step between steps 2 and 3 so the teacher conditions on peer rollouts alongside the prompt.
Why failed rollouts still carry rich training signal
When every rollout in a batch fails a binary unit test or math verifier, outcome-based RL methods like GRPO get zero relative advantage across the group and waste the batch. A teacher model scoring those same failed trajectories token by token still differentiates good local continuations from bad ones—assigning higher probability to a missing boundary check, a better tool call, or a cleaner algebraic step.
Local supervision does have a structural limit: if a student prefix has already painted itself into a dead end by token 50, token-level teacher targets at token 51 can encourage the model to backtrack or hedge, but they cannot erase the first 50 tokens of that trajectory. Instead, the gradients applied at the earlier positions shift so that subsequent rollouts are less likely to enter that dead end in the first place.
Rollout freshness and data reuse
A strictly on-policy loop uses each rollout batch for a single gradient step and discards it. Many large-scale RL pipelines instead take multiple epochs or minibatch updates over each collected rollout buffer to amortize generation cost. The first gradient step is genuinely on-policy; subsequent steps are off-policy updates over slightly stale trajectories, typically stabilized with importance-sampling ratios and PPO-style clipping.
MT-MOPD specifies single-use rollouts for its specialist RL stage, though its appendix leaves open the exact number of gradient updates per rollout batch during the distillation integration stage (a detail we revisit in Chapter 22).
Why this remains distillation rather than environment RL
Even when implemented inside a policy-gradient trainer, the training signal in MOPD comes from a teacher's predictive distribution rather than a ground-truth environment reward. That teacher may itself be the product of extensive RL, yet its token probabilities are still model beliefs: if a teacher assigns high probability to a plausible-sounding fallacy, the student is rewarded for matching it.
On-policy distillation borrows the rollout collectors and policy-gradient estimators of reinforcement learning to optimize distributional agreement with a teacher. Verifying that this agreement translates into actual task performance still requires independent outcome evaluation, and ensuring the supervision is trustworthy makes teacher selection and routing central to the pipeline.
Sources: On-policy distillation definitions follow MR-MOPD §2 and MT-MOPD §3.
Previous: 3. Post-Training, Rewards, and Specialist Development · Contents · Next: 5. What KL and Jensen–Shannon Actually Teach
5. What KL and Jensen–Shannon Actually Teach
A distillation loss measures the discrepancy between two probability distributions over the vocabulary at a given context. Which divergence you choose determines which disagreements get penalized most heavily, how the estimator interacts with sampling variance, and how the loss behaves when one model assigns near-zero probability to a token.
Throughout this chapter, denotes the student's next-token distribution and denotes the teacher's next-token distribution at a fixed context , defined over a common vocabulary with natural logarithms.
Forward KL
The forward (teacher-to-student) Kullback–Leibler divergence weights log-ratios by the teacher's probabilities:
Because the teacher distribution does not depend on the student parameters , minimizing with respect to is identical to minimizing the teacher-weighted cross-entropy:
Whenever the teacher places noticeable mass on a token () and the student assigns it nearly zero probability (), the term blows up. Forward KL therefore forces the student to spread probability mass across every token the teacher considers plausible, even tokens the student would rarely sample on its own.
In variational inference and distillation, this property is called mode covering (or zero-avoiding). When the student is capacity-limited and cannot match a multimodal teacher distribution exactly, forward KL pushes to bridge across the teacher's modes rather than dropping one. If the student's output layer can represent any categorical distribution over and optimization is unconstrained, the unique global minimum of both forward and reverse KL is simply .
Reverse KL
The reverse (student-to-teacher) KL divergence weights the log-ratio by the student's probabilities:
Here the expectation is taken under . If the student puts significant probability mass on a token that the teacher considers virtually impossible (), becomes huge and the student is sharply penalized. Conversely, if the student assigns near-zero probability to a token the teacher likes, the product approaches zero, and a sampled-token estimator under will rarely even visit to observe the discrepancy.
Expanding the log-ratio makes the role of student entropy explicit:
where is the Shannon entropy of the student distribution. Minimizing reverse KL simultaneously pushes the student to put mass on tokens with high teacher log-likelihood while maintaining its own entropy so it does not collapse onto a single argmax token faster than the teacher warrants.
Reverse KL is often called mode seeking (or zero-forcing) because an under-parameterized student—or an on-policy sampler that has already concentrated around one valid solution path—can achieve low loss by locking onto a single high-probability mode of and ignoring others.
Numerical comparison on a two-token vocabulary
Consider a binary vocabulary where the student strongly favors the first token while the teacher is indifferent between the two:
The reverse KL evaluates to
whereas the forward KL is larger because it weights the under-covered second token by instead of :
If we train with a sampled-token estimator that draws and uses the log-ratio as a policy-gradient advantage:
- Drawing the first token (probability ) yields , nudging downward.
- Drawing the second token (probability ) yields , pulling upward.
Although the second token carries a strong positive learning signal, a single-sample estimator only sees that signal on 10% of draws, linking divergence geometry directly to Monte Carlo variance and exploration.
Support mismatches, truncation, and numerical floors
Mathematically, whenever and , while whenever and . An exact softmax over finite logits produces strictly positive probabilities across the entire vocabulary, but practical serving and training pipelines introduce effective zeros in three ways:
- Floating-point underflow in
fp16orbf16when exponentiating large negative logits. - Hard vocabulary masks or mismatched special-token IDs between models.
- Top- or top- truncation in prefill services that only return the highest-scoring teacher tokens over the network.
Clamping teacher log-probabilities at a floor (or renormalizing a truncated top- payload) prevents NaN gradients, at the cost of altering the target distribution in the tails. Working directly in log-space via log_softmax and subtracting log-probabilities () avoids exponentiation underflow altogether.
Jensen–Shannon divergence
Defining the midpoint mixture distribution , the Jensen–Shannon (JS) divergence averages the KL from each distribution to :
JS divergence is symmetric, bounded between and for normalized distributions, and remains finite even when and have completely disjoint support. That boundedness softens gradient spikes when a student and teacher strongly disagree on tail tokens.
When differentiating with respect to , note that also depends on . Exact automatic differentiation propagates gradients through both appearances of (yielding ), whereas detaching changes the update into a different surrogate.
Across the two MOPD papers, divergence choices vary by setting: MR-MOPD uses reverse KL for mathematical reasoning and JS divergence for its remaining benchmarks, while MT-MOPD uses reverse KL everywhere (implemented via either a sampled-token policy gradient or a tail-corrected top- sum).
Temperature scaling changes the target
Dividing logits by a temperature before the softmax reshapes the target distribution: flattens the distribution and exposes dark knowledge in lower-ranked tokens, whereas sharpens mass onto the top candidates. Because changing alters the target distribution , three temperatures need to be kept distinct when reading or reproducing distillation experiments:
- The rollout sampling temperature used by the student to generate trajectories.
- The scoring temperature applied to teacher and student logits inside the divergence loss.
- The evaluation decoding temperature used at benchmark time.
Divergence, task accuracy, and diversity measure different things
Driving toward zero only certifies that the student matches the teacher's next-token probabilities on visited prefixes. It does not guarantee task correctness or output diversity:
- Correctness vs. agreement: A student can achieve zero KL against a teacher that hallucinates confidently, or have high KL against a teacher simply because it writes a valid proof using different variable names.
- Token entropy vs. semantic diversity: High average token entropy can reflect superficial synonym variation (choosing between
"however"and"nevertheless") along a single rigid algorithm, while a localized shift on a single branching token can switch between two completely different solution strategies with almost no change in sequence-averaged entropy.
Evaluating a distillation run therefore requires pairing distributional metrics (KL, token entropy) with ground-truth task verifiers (Pass@1, Pass@k, and semantic solution-cluster coverage).
Sources: Divergence definitions and task-specific loss choices in MR-MOPD appear in MR-MOPD §3 and Appendix; MT-MOPD's reverse-KL formulations appear in MT-MOPD §3.2.
Previous: 4. Why the Student Must Practice Its Own Paths · Contents · Next: 6. The Multi-Teacher Pipeline from Beginning to End
6. The Multi-Teacher Pipeline from Beginning to End
Multi-Teacher MOPD decouples capability acquisition from capability integration. Instead of training a single model with a fragile, multi-objective RL loop across every domain at once, domain specialists are trained independently with domain-tailored RL and then distilled into a single student model on the student's own rollouts.
Stage 1: Establish a shared SFT origin
The pipeline starts from a pretrained base model and runs a broad supervised fine-tuning (SFT) phase across all target domains to produce a shared starting checkpoint . This SFT stage establishes common chat formatting, reasoning delimiters, and baseline competence across tasks.
Both the domain teachers and the eventual unified student initialize from . Consequently, every specialist in the pool is a branch from the same ancestor—sharing an identical vocabulary, tokenizer, and architectural backbone—rather than an arbitrary collection of third-party checkpoints. In MT-MOPD's controlled experiments, is a custom SFT checkpoint trained on top of Qwen3-30B-A3B-Base.
Stage 2: Train domain specialists independently
Let index the target domains. Starting from , each domain team runs an independent reinforcement learning pipeline to produce specialist weights :
Each specialist run uses its own prompt dataset , reward verifier , rollout horizon, and RL hyperparameters. In the paper's controlled 30B study, covers competition mathematics, instruction following (IF), and software engineering (SWE); the production MiMo-V2-Flash deployment scales this up to also include competitive code generation and multi-turn agentic tool use.
Because the specialist runs do not share weights during Stage 2, a reward bug or instability in the SWE agent environment never corrupts the math specialist's weights. Domain teams can iterate asynchronously, tune domain-specific rollout lengths or exploration temperatures, and swap updated teachers into the pool without forcing other teams to restart their RL runs.
Stage 3: Freeze teachers and integrate via on-policy distillation
Once the domain specialists are ready, their weights are frozen and deployed as inference-only scoring services. A single student model is initialized at and trained on a mixed stream of prompts drawn from all domains.
For each prompt , the student generates an on-policy trajectory . The prompt's domain tag routes the completed trajectory (x, y) to the matching specialist teacher , which runs a causal forward pass over the student's tokens and returns token-level probability targets. The student then takes a gradient step to reduce the reverse KL divergence against that teacher:
broad SFT checkpoint (theta_0)
/ | \
math RL IF RL SWE RL
| | |
teacher M teacher I teacher S
\ | /
domain-routed prefill supervision
|
student rollouts initialized from theta_0
|
one unified student model
The multiple teachers exist only during training; at deployment, only the single unified student checkpoint is served.
Prompt-level routing vs. token-level ensembling
In MT-MOPD, every training prompt carries a known domain label from its source dataset, so the teacher target at step is simply the distribution of that domain's specialist:
Notice what this routing mechanism does not do:
- It does not query all teachers on every prompt and average their probability distributions.
- It does not train a learned gating network to switch teachers token by token mid-response.
- It does not require a classifier at inference time, because the distilled student internalizes all domains into one set of parameters.
Routing by prompt dataset keeps prefill compute at teacher forward pass per student rollout rather than , and avoids averaging conflicting stylistic priors (such as a terse IF teacher and a verbose chain-of-thought math teacher) on the same trajectory.
Why frozen teachers still provide an adaptive curriculum
Even though the specialist parameters are frozen throughout an integration round, the supervision targets change continuously as the student evolves. Early in integration, the student visits clumsy prefixes , and the teacher provides corrective next-token distributions from those states. As improves, its rollouts reach deeper reasoning steps or cleaner code structures, and the frozen teacher automatically scores those more advanced prefixes.
When the team wants to push capabilities further across multiple generations, they can start a new round by branching fresh RL specialists from the newly integrated student checkpoint—an iterative generational loop examined in Chapter 14.
Anatomy of a single integration step
To run one optimization step across a distributed training cluster:
- Sample and rollout: Draw a mixed-domain batch of prompts, recording each prompt's text, domain ID , generated token IDs , loss mask (masking out prompt tokens and injected environment outputs), and behavior-policy log-probabilities.
- Route and score: Dispatch each trajectory
(x, y)to the prefill service hosting teacher using the exact same tokenizer and chat template, and return either the teacher's log-probability on the sampled tokens or its top- logits at each position. - Update the student: Run a forward-backward pass on the student trainer to compute current student log-probabilities and step the optimizer using either the sampled-token policy-gradient loss (Chapter 8) or the tail-corrected top- reverse-KL loss (Chapter 9).
To prevent silent supervision bugs when swapping specialists in and out of a cluster, treat each teacher as a versioned teacher bundle that locks together the weight checkpoint, tokenizer, chat template, special-token masks, and scoring temperature.
Reported hyperparameters for the 30B controlled study
In Appendix A of the MT-MOPD paper, the controlled 30B integration stage uses:
- Global batch size: 2,048 prompts per step
- Rollouts per prompt: 1
- Domain mixture (Math : IF : SWE):
- Dynamic sampling filtering: disabled during distillation
- Advantage clipping ceiling: (for the policy-gradient formulation)
- Top- payload size: (for the top- formulation)
The paper leaves several secondary training hyperparameters (such as the exact integration learning-rate schedule and optimizer betas) unspecified in the public appendix; Chapter 21 and Chapter 22 detail sensible defaults and verification checks when building a reproduction pipeline.
Sources: The three-stage architecture, domain routing, and prefill service design are presented in MT-MOPD §3, with integration hyperparameters in MT-MOPD Appendix A.
Previous: 5. What KL and Jensen–Shannon Actually Teach · Contents · Next: 7. The Reverse-KL Objective and Its Gradient
7. The Reverse-KL Objective and Its Gradient
Multi-Teacher MOPD minimizes the token-level reverse KL divergence between the student and the routed domain teacher along trajectories sampled from the student. Because the student parameters govern both the local next-token distribution at each prefix and the probability of visiting that prefix in the first place, deriving the gradient requires distinguishing the local fixed-context gradient from the full trajectory-occupancy gradient.
The token-averaged reverse-KL objective
Let be a prompt with domain label , and let be a trajectory generated by the student. Writing the conditional next-token distributions at prefix as
MT-MOPD states its training objective (Equation 1) as the expected per-token reverse KL across student rollouts:
Here the inner sum over evaluates the exact categorical reverse KL at prefix , the sum over averages across the response length, and the outer expectation samples trajectories from the current student policy . Although the teacher parameters are frozen, still varies from rollout to rollout because it conditions on the student's prefix .
Differentiating reverse KL at a fixed context
Hold a single visited context fixed and consider the local reverse KL as a function of :
Applying the product rule with respect to while holding and constant gives
Because is a normalized probability distribution over , the sum of its probability gradients vanishes:
Dropping the term and applying the log-derivative identity yields the score-function form of the local reverse-KL gradient:
Sampling the actual next token during the student rollout therefore provides a single-sample Monte Carlo estimate of .
The log-probability ratio as a token-level advantage
MT-MOPD defines the reverse-KL log-ratio as a token-level advantage signal:
With this definition, the local gradient becomes , matching the form of a policy-gradient update:
- When , the teacher considers the sampled token more likely than the student does, so and the update increases .
- When , the student over-estimates the token relative to the teacher, so and the update pushes down.
- For example, if and , then ; if and , then ; and when , .
Notice that is an immediate conditional log-likelihood difference, not a cumulative return-to-go over future steps. In addition, subtracting any context-only baseline leaves the unclipped expectation unchanged because .
Why stop_gradient is required in the surrogate loss
To implement this update with standard automatic differentiation, we form the per-token surrogate loss
where detaches the advantage from the computation graph. Differentiating produces , whose expectation over equals .
If you omit and allow gradients to flow through the term inside , differentiation introduces an extra term on the sampled token (which only vanishes in expectation over the full vocabulary, adding unnecessary single-sample variance and breaking importance-sampled or clipped surrogates). Also keep in mind that the scalar value of is not the KL divergence itself—it can be positive or negative and should not be logged as a proxy for .
Local semi-gradients vs. full trajectory-distribution gradients
Now return to the outer expectation over student trajectories in Equation 1. Let
denote the trajectory-averaged local KL. Because both the integrand and the sampling distribution depend on , the exact gradient of has two parts:
- The local step-wise term differentiates the token-level KL at each visited prefix while treating the trajectory prefixes themselves as fixed.
- The state-occupancy term accounts for how changing an early token probability shifts the probability of reaching downstream states () where local KL costs may be higher or lower.
MT-MOPD's Equation 2—like most practical on-policy distillation algorithms—implements only the first term: it rolls out , treats the visited prefixes as fixed contexts, and applies the token-wise score-function update at each position independently. In reinforcement learning terminology, this is a local (or myopic) semi-gradient estimator on the current state distribution.
Contrast with sequence-level reverse KL
To see how trajectory occupancy enters when differentiating a full sequence divergence, consider the unnormalized sequence-level reverse KL over fixed-length trajectories:
By the chain rule of KL divergence, the scalar value of this sequence KL equals the sum of expected step-wise conditional KLs: . However, its exact policy gradient at step weights by the cumulative future log-ratio (reward-to-go) , rather than only the immediate step- log-ratio.
A two-step branching example makes the difference concrete: suppose at the student chooses between branch A and branch B, and on this first token already matches closely on both branches (). However, entering branch A leads to a state at where the student and teacher strongly disagree (), whereas branch B leads to a state where they agree ().
- The local token-wise update gives zero gradient at because , and only updates the student's second-step behavior inside branch A whenever branch A happens to be visited.
- The full sequence-KL gradient additionally pushes down at to avoid visiting the high-discrepancy state in the first place.
In practice, the myopic token-wise update is simpler, avoids the high variance of summing log-ratios over thousand-token trajectories, and prevents the student from gaming sequence KL by prematurely terminating responses or avoiding difficult reasoning branches just to dodge future teacher disagreement.
Sources: The token-averaged reverse-KL objective, log-ratio advantage, and stop-gradient surrogate correspond to MT-MOPD §3.2, Equations 1–4.
Previous: 6. The Multi-Teacher Pipeline from Beginning to End · Contents · Next: 8. Implementing the Sampled-Token Update
8. Implementing the Sampled-Token Update
The policy-gradient formulation of Multi-Teacher MOPD reduces the teacher's network payload to a single float—one log-probability—per sampled student token. Because the student rollout already specifies the exact sequence of chosen tokens , the teacher prefill service only needs to report how likely it considers those specific tokens at their respective prefixes.
Turning this formula into a reliable training loop requires keeping three probability distributions distinct at every token position: the behavior policy that generated the rollout, the current student policy being differentiated, and the frozen domain teacher.
The three distributions at a single token position
At context and sampled token , three models enter the calculation:
- : the behavior student snapshot that generated the rollout.
- : the current student weights on the trainer node receiving the gradient update.
- : the routed domain teacher .
In a strictly synchronous, single-update loop, and the pre-update are identical up to floating-point kernel differences between the inference engine (e.g., SGLang or vLLM) and the training backend (e.g., Megatron-LM or FSDP). If rollouts are buffered across asynchronous steps or reused for multiple minibatch updates, drifts away from . Logging and storing at rollout time makes any policy lag explicit and enables importance-sampling diagnostics.
The immediate reverse-KL token advantage is
where is evaluated under the student distribution.
Two-sided advantage clipping
When a student samples a token that lies in the far tail of the teacher's distribution (or vice versa), the raw log-ratio can spike to large magnitudes. To prevent single-token outliers from destabilizing the optimizer, MT-MOPD clips the advantage symmetrically:
and minimizes the trajectory-averaged surrogate loss
In Appendix A, MT-MOPD sets , which caps the effective probability ratio at (and on the negative side).
Note that advantage clipping on is distinct from PPO probability-ratio clipping on :
- Advantage clipping bounds how strongly any single teacher-student disagreement can pull the gradient, introducing a controlled bias into the local reverse-KL estimator to reduce variance.
- PPO ratio clipping bounds how far the updated actor can move away from the behavior snapshot across multiple off-policy epochs.
When monitoring training runs, track positive and negative advantage clipping fractions separately; a surge in negative clipping (A_t < -5.0) usually signals that the student has drifted into prefixes or formatting conventions that the teacher strongly rejects.
Tracing the gradient sign across token types
Minimizing scales the score function by . Because the vocabulary probabilities are coupled through the softmax normalizer, raising the logit of when slightly lowers the probabilities of competing tokens, whereas pushing down the logit of when redistributes mass across the remaining logits according to the network's representations.
Consider three representative token positions inside a single failed coding trajectory:
| Position type | Student | Teacher | Unclipped advantage | Effect of update |
|---|---|---|---|---|
| Routine boilerplate syntax | Mild reinforcement | |||
| Useful boundary check | Strong positive pull | |||
| Buggy variable shadowing | Strong suppression |
Where an outcome-based RL update would assign the exact same negative advantage to all three tokens because the unit test ultimately failed, the teacher's conditional probabilities reinforce the valid boundary check while specifically penalizing the buggy variable assignment.
Reference training step
The pseudocode below outlines a synchronous, single-update sampled-token step:
batch = sample_domain_labeled_prompts(domain_mixture)
rollouts = student_sampler.generate(batch, policy_version=current_version)
records = attach_masks_and_behavior_logprobs(rollouts)
# Route each sequence to its domain specialist for causal prefill scoring
teacher_logp = score_sampled_tokens_by_domain(records, frozen_teachers)
student_logp = actor.logprobs(records.token_ids, records.attention_mask)
# In a fresh single-step update, student_logp.detach() or behavior_logp may be used
advantage = (teacher_logp - student_logp.detach()).clamp(-5.0, 5.0)
per_token_loss = -advantage * student_logp
per_response_loss = masked_response_mean(per_token_loss, records.actor_mask)
loss = per_response_loss.mean()
optimizer.zero_grad()
loss.backward()
optimizer.step()
If your training infrastructure reuses rollouts across multiple gradient steps or tolerates asynchronous policy lag between student_sampler and actor, multiply the per-token surrogate by the importance ratio (with optional PPO clipping on ), while recomputing the reverse-KL advantage against .
Always transmit normalized log-probabilities, never raw logits
A common implementation bug when adapting inference servers for distillation is returning raw pre-softmax logits instead of normalized log-probabilities . Because adding an arbitrary context-dependent constant to every logit leaves the softmax distribution unchanged, raw logit differences are contaminated by the mismatch between the two models' log-partition functions .
The teacher prefill endpoint must therefore compute the full-vocabulary log_softmax at each position before gathering the scalar entry corresponding to the student's sampled token ID .
Loss masking and sequence length normalization
Only tokens actively sampled by the student policy should contribute to . The binary actor_mask must zero out:
- User prompt and system instruction tokens.
- Right-padding tokens in batched tensors.
- External environment observations injected mid-trajectory (such as compiler outputs, file contents, or tool responses in SWE and agentic domains).
Leaving tool outputs unmasked is particularly damaging in agentic trajectories: a 500-token stack trace returned by a bash tool is deterministic environment state, not an action chosen by , and training the student to match teacher probabilities over stack-trace tokens wastes gradient capacity and distorts sequence weighting.
Notice also how MT-MOPD normalizes across sequence length: Equation 1 averages over the active tokens within each trajectory first (), and then averages across the batch. Computing a flat global mean over all active tokens in a batch weights a 16,000-token SWE trajectory 32 times more heavily than a 500-token IF response, silently skewing the effective domain mixture toward whichever domain produces the longest rollouts.
Production telemetry and sanity checks
Because the surrogate loss has a detached advantage multiplier, its scalar value can be positive or negative and does not measure KL divergence. Instead, log the following metrics per domain at every step:
- Estimated reverse KL: the batch mean of (since ).
- Advantage quantiles and clip rates: fraction of tokens hitting and .
- Student token entropy and response length: broken down by domain to catch premature length collapse or verbosity drift.
- Inference-trainer logprob gap: on step 0 of a fresh batch, which catches chat-template, tokenizer, or RoPE position-ID mismatches immediately.
Sources: The sampled-token advantage, clipping threshold (), and policy-gradient surrogate loss follow MT-MOPD §3.2.1 and Appendix A.
Previous: 7. The Reverse-KL Objective and Its Gradient · Contents · Next: 9. Why Top-k Distillation Needs a Correction
9. Why Top-k Distillation Needs a Correction
While the sampled-token policy gradient sends just one float per token position, full-vocabulary KL distillation requires transmitting and storing ~150,000 floats per position. Multi-Teacher MOPD evaluates a middle ground: having the teacher service return its top- highest-probability tokens at each student prefix.
Truncating a reverse-KL sum to a subset of the vocabulary introduces a subtle mathematical trap. In a full-vocabulary KL sum, the constant terms in the derivative cancel out because is fixed. Over an unnormalized subset , the partial sum is free to shrink, so a naive partial KL sum actively pushes student probability mass out of the top- set and into the unscored tail. MT-MOPD adds a linear Bregman correction term to restore the minimum to on every scored coordinate.
The tail-corrected top- objective
At a fixed prefix, let denote the indices of the largest probabilities under the teacher distribution (with in MT-MOPD's experiments). Using the full-vocabulary normalized probabilities and (without renormalizing them over ), MT-MOPD defines the corrected sparse reverse-KL loss (Equation 5) as
Each summand is the scalar Bregman divergence generated by the negative entropy function , which is nonnegative everywhere and vanishes if and only if .
Why naive partial reverse KL fails
To see what goes wrong without the correction, consider the naive truncated sum:
Differentiating with respect to a single selected probability () while allowing the remaining mass to flow into unscored tail tokens yields
Setting this derivative to zero puts the stationary point at
rather than !
For a concrete two-token example, suppose and we score only the top- token :
- At the true teacher match , .
- At (which dumps into the unscored second token), .
Minimizing therefore drains student probability mass out of the teacher's top- tokens and hides it in the unscored tail so that becomes negative. Whenever a training log shows a negative "top- KL loss," the code is computing without the normalization correction.
How the correction fixes the optimum
Adding to each coordinate gives the corrected summand
Now the first and second partial derivatives with respect to are
The bias vanishes, is strictly convex in , and its unique minimum occurs at where . Writing makes nonnegativity immediate:
since for all with equality only at . In our two-token example with , evaluating the corrected loss at the naive optimum now yields , penalizing the mass evacuation and pulling back to .
What the sparse loss still leaves unobserved in the tail
Restoring the coordinate-wise optimum on does not make an unbiased estimator of the full-vocabulary reverse KL. Any redistribution of student probability mass among the unscored tail tokens is invisible to as long as the total tail mass stays fixed.
For instance, in a three-token vocabulary with () and distributions
the corrected top- loss is identically zero () because , even though and have swapped probabilities on tokens 2 and 3 (where the full reverse KL is ). When , , and reduces back to the exact full-vocabulary reverse KL .
Exact logit gradients through the full student softmax
Even though only sums over , the student probabilities are normalized over the entire vocabulary . Defining the active log-ratio vector
applying the Jacobian of the full softmax to yields the gradient with respect to any student logit ():
Notice that for an unselected tail token , , so its logit still receives a non-zero gradient:
This coupling through the full softmax normalizer is why you must compute log_softmax over all student logits before gathering the indices in , rather than slicing the logits first and running a -way softmax over .
Numerically stable implementation
Given the teacher's top- token indices topk_ids and full-vocabulary normalized log-probabilities log_q_topk, compute the full student log_p = log_softmax(student_logits, dim=-1), gather log_p_topk = gather(log_p, topk_ids), and evaluate
Although has zero gradient with respect to , keeping it in the forward pass ensures with at exact agreement, making training loss curves directly interpretable as a divergence in nats.
Note also that when the student samples a low-probability token , is not included in unless you explicitly append to the teacher's query payload. Pure top- distillation evaluates the student on the teacher's favored continuations at prefix regardless of which token was sampled to advance the prefix to .
Bandwidth vs. empirical performance
At using 32-bit token IDs and 32-bit log-probabilities, the teacher payload is bytes per token position—roughly a reduction compared with transmitting a 150,000-token fp32 distribution ( per position), though still larger than the single 4-byte float needed for the sampled-token policy gradient. On the teacher server, computing the full vocabulary logits and running topk(64) still incurs the full LM-head projection cost.
Empirically, MT-MOPD Table 4 shows that on same-origin teachers, the sampled-token policy gradient slightly outperforms top- distillation ( vs. normalized score), and when paired with an out-of-distribution external math teacher (Qwen3-235B-A22B), the top- loss suffers severe optimization collapse ( normalized score vs. for policy gradient), a phenomenon we analyze in Chapter 11.
Sources: The corrected top- reverse-KL objective and configuration appear in MT-MOPD §3.2.2, Equation 5, and Appendix A; empirical comparisons appear in MT-MOPD Table 4.
Previous: 8. Implementing the Sampled-Token Update · Contents · Next: 10. Routing, Teacher Disagreement, and Shared Capacity
10. Routing, Teacher Disagreement, and Shared Capacity
The "multi-teacher" in Multi-Teacher MOPD does not mean that an ensemble of teachers votes on every token. Instead, each training prompt is routed to a single domain specialist based on its task label. That routing rule shapes the optimization objective, keeps teacher scoring costs constant as more domains are added, and defines what happens when specialists have different stylistic habits.
Domain mixtures and effective gradient weighting
Let denote the probability of drawing a training prompt from domain with prompt distribution . The multi-domain integration objective is the mixture-weighted expectation
In MT-MOPD's controlled three-domain study, the training prompt mixture is set to , , and , while the aggregate evaluation metric weights the three domains equally ( each).
Keep in mind that prompt sampling proportions do not equal compute proportions:
- Because Equation 1 normalizes the loss by trajectory length within each response (), a 500-token IF rollout and a 12,000-token multi-turn SWE rollout contribute with equal weight to the batch gradient per prompt.
- In wall-clock rollout and teacher-prefill compute, however, those 30% SWE prompts can easily consume over 75% of the generated tokens and KV-cache memory in every batch.
Why prompt routing differs from averaging teacher distributions
Because every prompt in the training mixture comes from a known domain dataset, the target distribution at token is simply the single specialist . Even though the student receives no explicit domain tag at inference time, natural prompts carry strong contextual cues—problem statements, system instructions, or repository tool schemas—that allow a single shared network to condition its behavior on the task type.
Contrast this with an ensemble distillation scheme that queries all teachers on the same context and minimizes a weighted sum of reverse KLs simultaneously:
Expanding and solving with a Lagrange multiplier for shows that the unconstrained minimizer of a weighted reverse-KL sum is the normalized weighted geometric mean (or logarithmic opinion pool) of the teachers:
Similarly, minimizing a weighted sum of forward KLs forces to match the arithmetic mixture .
Averaging all teachers on every prompt creates two problems in multi-domain post-training:
- Veto power and style clashing: In the geometric mean , any single teacher that assigns near-zero probability to a token vetoes that token for the student. If an instruction-following teacher prefers concise direct answers while a math teacher insists on a 4,000-token
<think>block, forcing both to supervise a short formatting prompt pulls the student toward an incoherent compromise. - Untrained out-of-domain scoring: A math RL specialist has never been trained on multi-file SWE bash tool trajectories; querying it on SWE prefixes injects uncalibrated noise while multiplying teacher prefill compute by .
Routing each prompt to its designated specialist avoids both issues: the math teacher only supervises math contexts, and the IF teacher only supervises IF contexts.
Compound prompts that cross domain boundaries
Dataset-level routing works cleanly when training prompts fall into distinct buckets, but production queries sometimes combine constraints from multiple domains—for example, "Solve this combinatorics problem and format every intermediate step as a strict JSON schema with no markdown."
Because MT-MOPD routes by dataset origin, a prompt from the math corpus is supervised exclusively by the math teacher, while a prompt from the IF corpus is supervised exclusively by the IF teacher. The student must rely on parameter sharing inside its backbone to compose mathematical reasoning with strict output formatting at test time. When cross-domain composition is a priority for deployment, teams typically supplement single-domain datasets with compound prompts (either routed to a teacher explicitly trained on combined constraints or filtered by both verifiers) and include compositional evaluation benchmarks in their test suite.
How shared SFT initialization reduces cross-domain interference
Even with prompt-level routing, all domains update the same student parameter vector via the combined gradient . Why doesn't the math teacher's update overwrite the SWE teacher's representations?
Initializing all teachers and the student from the same broad SFT checkpoint minimizes unnecessary representational drift. On shared syntactic tokens, chat delimiters, and general language constructs, same-origin specialists remain close to and to one another, concentrating their distributional differences on the domain-specific reasoning and action tokens where each specialist actually improved during RL.
Auditing teacher replacements and multi-domain interference
When adding a new domain teacher or upgrading an existing specialist in a production pipeline, treat the swap as a controlled experiment:
- Check initial KL on student prefixes: Before starting a full integration run, sample a small batch of student rollouts and measure the initial token-level reverse KL against the candidate teacher. A sudden jump in baseline KL (e.g., from to , as seen in Chapter 11) warns of severe stylistic or distributional drift.
- Track per-domain gradient norms and outcome curves: Monitor each domain's evaluation accuracy independently rather than relying solely on the mean normalized score, since a spiky gradient from one uncalibrated teacher can dominate optimizer momentum and degrade quieter domains.
- Version routing metadata: Log the exact teacher bundle ID alongside every training trajectory so any regression in a specific capability can be traced directly to the specialist and prompt mixture that produced it.
Sources: Prompt-level domain routing and the domain mixture follow MT-MOPD §3 and Appendix A.
Previous: 9. Why Top-k Distillation Needs a Correction · Contents · Next: 11. Why a Stronger Teacher Can Teach Worse
11. Why a Stronger Teacher Can Teach Worse
A teacher's standalone benchmark score measures how well it solves problems on its own trajectories, not how well its conditional token distributions supervise a different model's prefixes. Section 4.4.2 of the MT-MOPD paper demonstrates this tension directly: replacing the 30B same-origin math specialist with a much larger, higher-scoring external model (Qwen3-235B-A22B) causes the student's math performance to degrade under policy-gradient distillation and collapse completely under top- distillation.
Understanding why a stronger teacher can teach worse requires separating teacher task competence from teacher-student distributional compatibility.
Same-origin specialists vs. external teachers
In the default MT-MOPD pipeline, every domain specialist is trained via RL starting from the exact same SFT checkpoint that initializes the student. Because the student and its teachers share the same 30B-A3B MoE architecture, tokenizer, SFT formatting conventions, and initial parameter basin, their next-token distributions start out closely aligned on prefixes sampled from .
An external teacher—even one from the same broad model family, like Qwen3-235B-A22B—has been pretrained and post-trained through a separate optimization trajectory at a different parameter scale. When evaluated on prefixes generated by the 30B student, the 235B model assigns sharply different probabilities to phrasing choices, reasoning transition phrases, and step granularity.
The external math teacher replacement experiment
To test how teacher origin and loss formulation interact, MT-MOPD keeps the 30B IF and SWE specialists fixed and swaps only the math teacher from the same-origin Qwen3-30B-A3B math RL specialist to Qwen3-235B-A22B, evaluating both the sampled-token policy gradient and the corrected top- () losses (Table 4):
| Math teacher | Distillation loss | AIME25 | AIME26 | IFBench | IFEval | SWE Verified | Normalized score |
|---|---|---|---|---|---|---|---|
| Same-origin 30B math RL | Policy gradient | 51.46 | 65.31 | 77.89 | 93.84 | 50.40 | 0.9373 |
| Same-origin 30B math RL | Top- () | 51.77 | 64.79 | 75.85 | 93.07 | 50.20 | 0.9093 |
External Qwen3-235B-A22B |
Policy gradient | 45.63 | 51.56 | 79.25 | 93.99 | 50.60 | 0.6003 |
External Qwen3-235B-A22B |
Top- () | 0.94 | 0.42 | 72.96 | 88.97 | 51.20 | −1.1898 |
All benchmark columns are percentages, and the normalized score is anchored against the 30B SFT baseline () and the 30B specialist teachers ().
Two patterns stand out in Table 4:
- With same-origin teachers, both losses work well: Policy gradient () and top- () achieve nearly identical math accuracy and strong cross-domain retention.
- With the external 235B math teacher, math transfer breaks down: Under the policy-gradient update, AIME25 drops by nearly 6 points and AIME26 drops by nearly 14 points (while IF and SWE remain unaffected). Under the top- update, math accuracy collapses to near zero ( and ) and pulls IF accuracy down with it.
Distributional diagnostics: initial KL and entropy contraction
The training curves reported in MT-MOPD Section 4.4.2 show what happens inside the optimizer before and during this collapse:
- Fivefold higher initial KL: At the start of integration, the average per-token reverse KL between the student and the same-origin teachers is roughly , whereas the initial reverse KL against the external
Qwen3-235B-A22Bteacher starts around —nearly larger. - Entropy contraction under policy gradient: When distilling from
Qwen3-235B-A22Bwith the sampled-token policy gradient, the student's token entropy steadily contracts from down to as math accuracy falls below the SFT starting point. - Optimization spike under top-: When distilling from
Qwen3-235B-A22Bwith the top- loss, token-level KL and student entropy begin oscillating wildly around step 18, driving the math policy into degenerate outputs.
Why large teacher-student divergence triggers punitive suppression
Consider what happens at a student prefix when the teacher distribution is far from the student distribution .
In the sampled-token policy-gradient update, the student draws and receives the advantage . When and have poorly aligned modes, the tokens the student naturally samples frequently land in low-probability regions of , producing a stream of strongly negative advantages (). Meanwhile, the tokens where are rarely sampled by , so the single-sample estimator seldom observes the positive advantages that would pull mass toward the teacher's preferred reasoning path. Faced with predominantly negative feedback on its own phrasing habits, the student suppresses its active vocabulary and collapses onto a narrow set of safe, repetitive tokens—shrinking entropy from to without discovering the 235B teacher's solution modes.
Why doesn't the top- loss rescue exploration by exposing the teacher's top 64 tokens directly? When is large ( nats/token) and comes from a much larger model with different representation geometry, pushing 64 logits simultaneously at the default learning rate injects large, unclipped gradient steps on every token position. Unlike the policy-gradient path—which bounds the per-token log-ratio at —the corrected top- gradient has no explicit clip on . When the student's 30B backbone cannot smoothly match the 235B teacher's multi-token transitions in a few steps, those unclipped multi-coordinate updates overshoot, shifting subsequent rollout prefixes into even more unfamiliar states and triggering the step-18 instability loop.
Pre-flight compatibility checks before distilling from an external teacher
The Table 4 failure does not mean cross-architecture or large-to-small on-policy distillation is impossible, but it shows that an unaligned teacher cannot simply be dropped into a hyperparameter recipe tuned for same-origin specialists. Before committing cluster compute to a new teacher checkpoint, run a pre-flight compatibility audit on a small sample of student rollouts:
- Measure baseline token-level KL and advantage histograms: Compute and plot the distribution of on sampled student tokens. If the median sampled advantage is strongly negative or of tokens hit the clip floor at step 0, the teacher is rejecting the student's baseline phrasing style.
- Inspect high-leverage decision tokens vs. formatting tokens: Separate KL spikes on chat templates, markdown headers, or LaTeX delimiters from KL differences on mathematical steps. Often an external teacher appears incompatible simply because it expects
\boxed{}or step numbering formatted slightly differently from . - Bridge the distribution gap before on-policy RL/OPD: If you must distill from a heterogeneous external teacher, warm-start the student with a brief offline SFT pass on teacher responses (or apply temperature smoothing, gradient clipping on top- log-ratios, or Jensen–Shannon divergence) so enters the teacher's support basin before switching to reverse-KL on-policy distillation.
Sources: The external math teacher replacement experiment, Table 4 results, and KL/entropy trajectory diagnostics are reported in MT-MOPD §4.4.2 and Table 4.
Previous: 10. Routing, Teacher Disagreement, and Shared Capacity · Contents · Next: 12. Teacher Services, Throughput, and the Cost of Supervision
12. Teacher Services, Throughput, and the Cost of Supervision
Every trajectory the student generates during on-policy distillation must be scored by a teacher model. Multi-Teacher MOPD architectures this step as a standalone, inference-only prefill service: student workers generate rollouts continuously, and as each trajectory finishes, an asynchronous RPC dispatches the completed token sequence to its domain teacher for scoring.
Overlapping teacher scoring with ongoing student rollouts can hide teacher latency from the wall-clock step time, though the underlying accelerator FLOPs, KV-cache memory, and network transfers still have to be provisioned and budgeted.
Autoregressive rollout vs. parallel teacher prefill
Student rollout generation and teacher scoring have fundamentally different hardware utilization profiles:
- Student generation is memory-bandwidth bound and sequential: The sampler decodes token by token, reading model weights and growing KV caches at every step. In multi-turn SWE or tool-use domains, generation also pauses frequently while waiting for external sandboxes, compilers, or test suites to return environment observations.
- Teacher scoring is compute-bound and parallelizable: Because the complete student sequence
(x, y)is already finished when it arrives at the teacher service, the teacher evaluates all positions in a single causal forward pass (prefill), achieving high matrix-multiply utilization across the sequence dimension.
As a result, a single teacher prefill replica can score tokens much faster than a student rollout replica can generate them—especially when student workers spend substantial wall-clock time blocked on environment execution.
Asynchronous overlap and queue stability
MT-MOPD deploys each domain specialist as an independent prefill service decoupled from the student trainer's GPU pool. As soon as a single rollout completes, the rollout worker fires a non-blocking scoring request to teacher while remaining rollouts in the batch continue decoding (or running sandbox tests). When the teacher pool is provisioned with enough throughput to keep pace with rollout generation, teacher scoring adds virtually zero wall-clock overhead to the training loop.
To keep the asynchronous scoring queues stable, each domain's teacher service capacity must exceed its arrival rate. Let denote the average rate (in tokens per second) at which student workers finish trajectories for domain , and let denote the sustainable prefill throughput of teacher service . Queue stability requires
Because requests are routed by domain rather than shared across a homogeneous pool, an under-provisioned math teacher cannot borrow capacity from an idle SWE teacher unless the serving layer dynamically reallocates GPUs across specialist weights.
In terms of batch timing, let be the wall-clock time to complete all rollouts in a batch, the teacher scoring time, and the student forward-backward update time. A synchronous serial loop takes
whereas streaming completed trajectories to dedicated teacher servers overlaps behind , reducing the step time toward
where is the latency of scoring the final straggler trajectories that finish right at the end of the rollout phase. Monitoring per-domain queue depth, request age, and 99th-percentile straggler latency prevents a handful of 16,000-token SWE trajectories from stalling the optimizer barrier.
Network payload arithmetic: full vocabulary vs. top- vs. sampled token
To see why payload compression matters for remote teacher services, take a representative 8,192-token response over a vocabulary of tokens stored in 32-bit floats (4 bytes):
- Full-vocabulary distribution: Returning all 150,000 probabilities at each of the 8,192 positions requires Across a batch of 2,048 trajectories, shipping full vocabulary distributions over the network would require roughly of data transfer per step.
- Top- payload (): Returning 64 4-byte token IDs and 64 4-byte log-probabilities per position requires
- Sampled-token payload ( known ID): Returning only the teacher's scalar log-probability on the student's sampled token requires
Shrinking the response payload from to eliminates network serialization bottlenecks and trainer buffer bloat, though the teacher GPU itself still executes the full transformer forward pass and final LM-head projection to compute the log-partition normalizer at every position.
When packing multiple variable-length trajectories into a single ragged prefill batch on the teacher server, the attention kernel must enforce strict document-level causal masking (and reset RoPE position IDs at each sequence boundary) so earlier trajectories in the pack cannot leak into later ones.
Accounting for end-to-end pipeline compute
When comparing the sample efficiency of MT-MOPD against baselines like Mix-RL, distinguish marginal integration cost from total pipeline cost:
- If the domain specialists are built from scratch solely to produce a single unified model, the total GPU-hours spent on specialist RL () are part of the end-to-end budget. Running the specialist jobs in parallel across separate clusters compresses calendar time to , while still spending the sum of accelerator hours.
- In an ongoing model-development organization where domain teams continuously train and evaluate specialists regardless, MT-MOPD's marginal integration cost is the relevant operational price to merge a newly upgraded specialist into the unified checkpoint without rerunning RL across the other domains.
How Multi-Rollout MOPD changes the prefill cost profile
While MT-MOPD scores each student trajectory (x, y) in isolation, Multi-Rollout MOPD (MR-MOPD) prepends up to three peer rollouts—such as two successful trajectories and one failed trajectory—into the teacher's conditioning prompt . That context expansion multiplies the input sequence length processed by the teacher's prefill pass.
In MR-MOPD's reported timing benchmarks (Appendix, Training Statistics), adding peer-conditioned teacher scoring increases per-step wall-clock time from to () on LiveCodeBench and from to () on QA-Chemistry. The relative overhead is smaller on coding because unit-test execution and long rollout generation dominate the baseline, whereas on shorter QA tasks the longer teacher prefill contexts account for a larger share of the total step time.
Engineering checklist for teacher scoring RPCs
To prevent silent training corruption in a distributed prefill service, enforce a strict request/response contract:
- Pass token IDs, not raw strings: Send the exact integer token sequence generated by the student worker so the teacher service cannot re-tokenize text differently across chat-template boundaries.
- Pin the teacher bundle version: Every request header should verify the expected specialist checkpoint hash, temperature, and vocabulary size; retry logic or load balancers must never fail over to a different domain teacher on timeout.
- Include peer-context hashes when caching: In MR-MOPD, teacher targets depend on both the target trajectory and the selected peer context , so any prefix cache must key on the full concatenated token sequence
(x, C_i, y^{(i)}).
Sources: The standalone asynchronous prefill service architecture is described in MT-MOPD §3.3; step-time measurements for peer-conditioned distillation are reported in MR-MOPD Appendix (Training Statistics).
Previous: 11. Why a Stronger Teacher Can Teach Worse · Contents · Next: 13. Reading the Multi-Teacher Experiments Correctly
13. Reading the Multi-Teacher Experiments Correctly
The central controlled experiment in Multi-Teacher MOPD tests how completely a single 30B student can absorb the gains of three domain-specific RL teachers—mathematics, instruction following (IF), and software engineering (SWE)—compared against mixed-domain RL, sequential cascade RL, offline distillation, and weight-space model merging.
The paper summarizes this comparison with a headline normalized score of ( capability recovery). Reading that figure accurately requires unpacking both the five underlying benchmark columns and the exact headroom normalization formula used to aggregate them.
Experimental setup and the five evaluation benchmarks
Every method in the controlled study starts from the same custom SFT checkpoint trained on top of Qwen3-30B-A3B-Base. Three specialist teachers are trained independently from via RL, and all candidate integration methods attempt to consolidate those three domains into a single 30B-A3B model:
- Mathematics: evaluated on
AIME25andAIME26(usingavg@32, the mean accuracy across 32 independent samples per problem at temperature ). - Instruction Following: evaluated on
IFBenchandIFEval(single-sample accuracy at temperature ). - Software Engineering: evaluated on
SWE-bench Verified(single-sample resolution rate at temperature ).
Note that in Table 2, the Domain RL teachers row ( normalized score) is a composite anchor across three separate specialist checkpoints: the math specialist is evaluated on AIME25/26, the IF specialist on IFBench/IFEval, and the SWE specialist on SWE-bench Verified. No single teacher model achieves all five numbers simultaneously.
Full comparison across integration methods (MT-MOPD Table 2)
| Method | AIME25 | AIME26 | IFBench | IFEval | SWE Verified | Normalized score |
|---|---|---|---|---|---|---|
| SFT student () | 45.42 | 54.48 | 42.69 | 84.17 | 35.80 | 0.0000 |
| Domain RL teachers (composite) | 54.79 | 63.65 | 78.40 | 95.50 | 51.20 | 1.0000 |
| Mix-RL | 52.71 | 63.75 | 75.00 | 94.58 | 48.80 | 0.8818 |
| Cascade RL | 48.54 | 61.88 | 77.11 | 95.80 | 47.80 | 0.7752 |
| Off-Policy Finetune (RFT) | 51.56 | 63.44 | 80.95 | 93.35 | 45.80 | 0.8241 |
| Param-Merge (uniform average) | 47.81 | 59.58 | 53.74 | 88.79 | 39.60 | 0.3280 |
| Param-Merge (task arithmetic) | 49.38 | 63.96 | 78.23 | 95.81 | 48.80 | 0.8574 |
| MT-MOPD | 51.46 | 65.31 | 77.89 | 93.84 | 50.40 | 0.9373 |
Looking across the individual columns shows why MT-MOPD wins the aggregate score: rather than winning every single benchmark outright (Mix-RL scores higher on AIME25, Off-Policy Finetune scores higher on IFBench, and Task Arithmetic edges out IFEval), MT-MOPD avoids the sharp single-domain drops that hurt every baseline—such as Off-Policy Finetune lagging on SWE Verified ( vs. ) or Cascade RL forgetting early math gains ( on AIME25).
Reconstructing the normalized headroom arithmetic
For each domain , let denote the SFT student's domain score, the corresponding RL specialist's domain score, and the integrated model's domain score. The normalized headroom recovery in domain is
By construction, matches the SFT starting point, matches the specialist teacher's full gain over SFT, exceeds the teacher, and indicates regression below SFT. To compute the headline score, MT-MOPD first averages the two benchmarks within math and within IF to form three domain scores, normalizes each domain against its teacher headroom, and takes the unweighted mean of the three domain ratios:
- Mathematics domain recovery:
- Instruction-Following domain recovery:
- Software Engineering domain recovery:
Averaging the three domain recoveries reproduces the reported headline figure to four decimal places:
Interpreting normalized headroom vs. raw percentage points
Normalizing by teacher headroom prevents domains with wide raw percentage gains—like IF, where RL adds percentage points—from swamping domains with tighter headroom like competition math ( points).
At the same time, keep two properties of this metric in mind when quoting headline numbers:
- Headroom points are not raw accuracy points: When the paper notes that MT-MOPD outperforms Mix-RL by points (), that gap is of the specialist RL gain over SFT, not a percentage-point jump on raw benchmark accuracy.
- Sensitivity to small denominators: In any domain where the specialist teacher improves over SFT by only – percentage points, normal evaluation noise in gets magnified by . Always inspect the raw benchmark columns alongside .
Sample efficiency during integration vs. total training budget
In Section 4.2, the paper plots validation performance as a function of integration-stage training samples, observing that MT-MOPD reaches the teacher plateau after roughly samples on IF and samples on SWE—converging in to fewer samples than Mix-RL needs per domain.
Why does integration converge so much faster per prompt than multi-domain RL?
- Dense token-level supervision vs. sparse group rewards: In Mix-RL (GRPO), the learner generates 8 or 16 rollouts per prompt, filters out zero-variance groups via Dynamic Sampling, and extracts a single scalar outcome reward per trajectory. In MT-MOPD, a single rollout () receives dense, low-variance log-probability supervision at every token position from an already-competent teacher, with no Dynamic Sampling discards.
- Amortized exploration: The expensive trial-and-error exploration required to discover working proofs and repository patches already happened during Stage 2 when training the specialist teachers. MT-MOPD's sample-efficiency curves measure how quickly Stage 3 transfers those discovered behaviors into the unified student, rather than claiming that Stage 2 + Stage 3 combined uses less total compute than a single Mix-RL run from scratch.
Sources: Experimental protocols, Table 2 benchmarks, normalized score definitions, and integration sample-efficiency curves are reported in MT-MOPD §§4.1–4.2, Table 2, and Appendix B.
Previous: 12. Teacher Services, Throughput, and the Cost of Supervision · Contents · Next: 14. Frontier-Scale Integration and Repeated Rounds
14. Frontier-Scale Integration and Repeated Rounds
Beyond the controlled 30B experiments, the MT-MOPD paper tests two questions that matter for production post-training pipelines:
- Does multi-teacher on-policy distillation hold up at frontier MoE scale across five domains? (Evaluated on
MiMo-V2-Flash, a 309B-parameter model.) - Can the unified student serve as the launchpad for a second generation of even stronger RL specialists? (Evaluated via a two-round iterative loop on the 30B testbed.)
Frontier-scale integration on MiMo-V2-Flash (309B)
In Section 4.3, the authors apply the three-stage MT-MOPD pipeline to MiMo-V2-Flash (309B total parameters), expanding the specialist pool to five domains: competition mathematics, code generation, instruction following, software engineering, and agentic tool use.
Table 3 compares the initial SFT student checkpoint, the domain-specific RL teachers (each evaluated on its respective domain benchmark), and the unified MiMo-V2-Flash student after MT-MOPD integration:
| Benchmark | Domain | Initial Student | Domain RL Teacher | Unified MT-MOPD | MT-MOPD minus Teacher |
|---|---|---|---|---|---|
| AIME25 | Math | 89.3 | 93.9 | 94.1 | +0.2 |
| HMMT25 | Math | 76.9 | 82.6 | 84.4 | +1.8 |
| LiveCodeBench (LCB) | Code | 77.5 | 82.6 | 83.2 | +0.6 |
| IFBench | Instruction Following | 55.4 | 68.9 | 66.7 | −2.2 |
| SWE-bench Verified | Software Engineering | 67.8 | 74.2 | 73.4 | −0.8 |
| -Bench | Agentic Tool Use | 75.9 | 79.6 | 80.3 | +0.7 |
| -Telecom | Agentic Tool Use | 92.7 | 95.0 | 95.3 | +0.3 |
Across all seven benchmarks, the single unified 309B checkpoint closely tracks—and on five benchmarks slightly exceeds—the standalone scores of the five domain-specific RL teachers, retaining of the IF teacher's gain and of the SWE teacher's gain while consolidating five separate models into one deployable weight set.
How a distilled student can score higher than its specialist teacher
At first glance, seeing the student edge out its teacher on HMMT25 () or -Bench () might look surprising: if the objective minimizes , shouldn't the teacher's accuracy be a strict upper bound?
Several mechanisms allow an on-policy distilled student to exceed a single teacher's benchmark score:
- Cross-domain skill transfer in shared weights: A math specialist trained solely on math problems may occasionally drop formatting constraints or fumble structured reasoning steps that the IF and code teachers reinforce. Because the student updates a single shared backbone across all five domains, improvements in instruction compliance and structured step-by-step execution can carry over to math and tool-use benchmarks.
- Regularization against specialist over-optimization: Long single-domain RL runs can develop brittle stylistic quirks or high-variance tail transitions. Distilling onto a fresh student initialized at with clipped advantages acts as a distributional regularizer, smoothing out noisy transitions while preserving the core reasoning trajectory.
- Imperfect distribution matching and evaluation variance: The student does not reach everywhere, and finite-sample evaluation noise on benchmarks like AIME (30 problems) or HMMT naturally produces tenths-of-a-point fluctuations.
Multi-round iterative evolution: branching new teachers from the unified student
Once Stage 3 produces a unified student that combines all domain capabilities, that unified model is a strictly stronger starting point than the original SFT checkpoint . Instead of stopping after one pass, a team can treat as the new base checkpoint for Round 2—branching a fresh set of domain RL specialists from and then distilling them into a second-generation student :
Crucially, this loop is not closed-system self-distillation: every round injects fresh ground-truth environment verification during the stage before consolidating the resulting specialists back into .
The Round-2 experiment and incremental domain updates
Section 4.4.3 tests this iterative workflow on the 30B model family with a practical twist: in Round 2, the authors run fresh specialist RL only on Mathematics and Instruction Following starting from the Iteration-1 MT-MOPD student, intentionally skipping SWE RL and omitting SWE prompts from the Round-2 distillation mixture to test whether an untouched domain survives without rehearsal.
| Model Stage | AIME25 | AIME26 | IFBench | IFEval | SWE Verified | Normalized score |
|---|---|---|---|---|---|---|
| Iteration 1 MT-MOPD student () | 51.46 | 65.31 | 77.89 | 93.84 | 50.40 | 0.937 |
| Iteration 2 RL teachers (composite ref.) | 54.27 | 65.52 | 81.46 | 95.65 | 50.40 | 1.030 |
| Iteration 2 MT-MOPD student () | 53.44 | 64.90 | 79.76 | 95.44 | 50.20 | 0.986 |
In the Iteration 2 teacher row, the AIME and IF columns show the newly trained Round-2 math and IF specialists, while the SWE column () simply carries forward 's SWE score as a reference anchor; all normalized scores remain anchored to the original Iteration 1 SFT () and Iteration 1 teacher () scale.
Three operational takeaways emerge from Table 5:
- Second-round teachers break past first-round ceilings: Starting IF RL from the Iteration-1 student pushes IFBench from (Round-1 teacher) to (Round-2 teacher), lifting the composite teacher reference to .
- The Iteration-2 student absorbs the new gains: climbs from to overall, gaining points on AIME25, points on IFBench, and points on IFEval over .
- Minimal forgetting on the un-rehearsed SWE domain: Even though Round 2 performs zero SWE rollouts or distillation updates,
SWE-bench Verifiedbarely moves (). Because the Round-2 math and IF specialists were branched directly from (which already possessed SWE competence) and distilled back into with small reverse-KL updates, their weight updates stay close to 's representation basin rather than overwriting SWE skills.
In longer production runs or larger domain shifts, omitting a domain entirely across multiple rounds can eventually erode its performance, so keeping at least a small rehearsal fraction of existing domains in the integration prompt mixture (and running the full benchmark suite after every round) remains good practice.
Sources: The 309B MiMo-V2-Flash results appear in MT-MOPD §4.3 and Table 3; the two-round iterative experiment appears in MT-MOPD §4.4.3 and Table 5.
Previous: 13. Reading the Multi-Teacher Experiments Correctly · Contents · Next: 15. Multi-Rollout MOPD: Learning from Local Trial and Error
15. Multi-Rollout MOPD: Learning from Local Trial and Error
We now turn to the second paper in this book: Multi-Rollout MOPD (MR-MOPD). Where Multi-Teacher MOPD asks which specialist model should supervise a given domain prompt, Multi-Rollout MOPD asks what privileged context a single teacher model should see when scoring a student's rollout.
Instead of evaluating one student trajectory in isolation, MR-MOPD samples a group of rollouts for the same prompt, grades each rollout with a task verifier, and feeds selected peer attempts—both verified successes and labeled mistakes—into the teacher's context window before scoring the target rollout token by token.
Grouping rollouts and partitioning by verifier outcome
For each training prompt , the student policy samples a group of trajectories in parallel (with in the paper's experiments):
A ground-truth task verifier (such as an answer matcher for math or a unit-test suite for code) scores each rollout with a scalar reward . Comparing against a success threshold partitions the group into a verified positive set and a failed negative set :
In standard group-relative RL (GRPO), those scalar rewards are normalized across the group and broadcast directly to every token in . MR-MOPD instead uses and to construct an in-context reference sheet for the teacher model.
Leave-one-out peer exclusion prevents future-token leakage
When the teacher scores a specific target trajectory , the candidate peer pools must exclude itself:
Why is leave-one-out exclusion mandatory? In causal teacher forcing, the teacher predicts the distribution over token given only the prompt and the prefix . If the complete trajectory were pasted into the teacher's conditioning context ahead of the scoring region, causal attention masks over the target suffix would not stop the teacher from attending back to the full copy of in —leaking the exact future tokens and collapsing the teacher distribution onto a trivial copy operation.
Excluding ensures that any positive or negative peer placed in is an independent sample drawn from .
Conditioning the teacher on verified peer rollouts
Given the leave-one-out pools and , a context-construction rule selects and formats a small subset of peers into a privileged context block:
where denotes either the positive-only (MR-Pos) or contrastive (MR-Con) selection strategy. The teacher then scores each prefix of the target rollout while conditioning on :
Meanwhile, the student sees only the original prompt and its own partial response , with no access to .
This asymmetric conditioning turns the teacher into a privileged critic:
- A verified positive peer () gives the teacher a working derivation or passing implementation on the exact problem , anchoring the teacher's next-token beliefs even on problems it might struggle to solve zero-shot.
- A labeled negative peer () alerts the teacher to a concrete pitfall or edge-case bug that the current student policy is prone to making on .
The group distillation objective
For each target rollout in the group , MR-MOPD sums the token-level divergence between the unprivileged student and the peer-conditioned teacher:
and averages across the rollouts in the group. As noted in Chapter 5, MR-MOPD sets to the reverse KL divergence on competition math benchmarks and the symmetric Jensen–Shannon divergence on coding and question-answering benchmarks, evaluated via top- logit truncation (top-k = 100).
Notice two structural differences from MT-MOPD's Equation 1:
- Sequence sum vs. length average: MR-MOPD's displayed equation writes an unnormalized sum over rather than dividing by inside the expectation (though framework-level token averaging in
verlmay still normalize across active batch tokens). - Hybrid RL/OPD mixing coefficient : Algorithm 1 and the experimental setup introduce a weighting coefficient when combining distillation gradients with group-relative reward updates; we examine the exact implementation details and open questions around in Chapter 21 and Chapter 22.
Positive-only (MR-Pos) vs. contrastive (MR-Con) context modes
MR-MOPD defines two concrete peer-selection rules for building :
MR-Pos(Positive-only): Selects up to two verified successful peers from —a primary anchor and, when , a second positive rollout chosen to maximize solution diversity (detailed in Chapter 16).MR-Con(Contrastive): Combines up to two positive peers from with one failed peer , giving a default three-peer context of 2 positives + 1 negative.
Crucially, in MR-Con the negative peer is included in-context with an explicit failure header (telling the teacher that the trajectory is an incorrect attempt to avoid), not plugged into an unlikelihood or negative-gradient loss term. The teacher model itself reads the labeled positive and negative attempts and translates that contrast into sharper next-token probabilities .
Why self-distillation works when the teacher has privileged context
In every experiment in the MR-MOPD paper, the teacher weights are initialized from the exact same base checkpoint as the student (such as Qwen3-4B-Base or Qwen3-8B-Base). If the teacher and student start with identical weights, where does the learning signal come from?
The asymmetry comes entirely from information access and external verification:
- Through repeated sampling () and ground-truth verification , the rollout group surfaces rare correct solutions and exposes common failure modes.
- Conditioning the teacher on reduces its task from solving cold to evaluating a partial continuation with verified reference solutions and counterexamples already on the page.
Because verifying and guiding a solution with reference answers in hand is much easier than generating a solution from scratch, is substantially more accurate than —allowing the student to internalize into its zero-shot weights what the teacher inferred from privileged group context.
Reported verl training configuration
MR-MOPD builds on the open-source verl framework using asynchronous vLLM rollout workers and FSDP actor training in bfloat16:
- Batch size: 32 prompts per step rollouts per prompt ( trajectories per step).
- Optimizer & learning rate: AdamW with actor learning rate and 10 linear warmup steps.
- Distillation truncation:
top-k = 100teacher tokens per position, mixing coefficient . - Sequence lengths: Maximum prompt length tokens and maximum response length tokens ( tokens for math), with extra context window headroom allocated on the teacher prefill side to accommodate the prepended peer rollouts .
Sources: The rollout group partition, leave-one-out peer sets, MR-Pos/MR-Con context constructors, and verl hyperparameters are reported in MR-MOPD §§2–3 and §4.1.
Previous: 14. Frontier-Scale Integration and Repeated Rounds · Contents · Next: 16. Peer Selection, Availability, and Context Budgets
16. Peer Selection, Availability, and Context Budgets
A peer-conditioned distillation recipe like "prepend two successful peers and one failed peer" can only include trajectories that actually exist in the rollout group after excluding the target rollout . Because the student's pass rate varies dramatically across prompts and across training epochs, the actual context delivered to the teacher shifts between full contrastive sets, partial positive sets, and all-failure fallbacks.
Leave-one-out exclusion changes peer availability within the same group
Suppose a group of rollouts produces 1 success () and 7 failures ():
- When scoring any of the 7 failed rollouts (), the leave-one-out positive pool contains 1 positive peer.
- When scoring the single successful rollout (), leave-one-out exclusion removes , leaving —so the successful trajectory itself receives zero positive peers!
Similarly, if a group contains 2 successes and 6 failures, the 6 failed targets each see 2 positive peers (), whereas the 2 successful targets each see only 1 positive peer (). Group-level success counts () therefore overestimate target-level peer availability ().
Binomial availability across difficulty regimes
To quantify how often a target rollout actually receives its requested peers, suppose each rollout on prompt succeeds independently with probability . Across all rollouts, the group contains at least one success with probability . For a specific target rollout , however, the peer pool consists of the remaining rollouts, where the number of positive peers follows :
- At least 1 positive peer ():
- At least 2 positive peers (, required for full
MR-Pos): - Full
MR-Conavailability (, i.e., positives and negative among peers):
Evaluating these probabilities at ( peers) across three pass-rate regimes illustrates the curriculum shift during training:
| Prompt Pass Rate | Group Has Success | Target Sees Pos. | Target Sees Pos. (MR-Pos) |
Target Sees (MR-Con) |
|---|---|---|---|---|
| (hard) | ||||
| (low-mid) | ||||
| (balanced) | ||||
| (easy) |
On hard prompts (), barely of target rollouts receive two positive peers; on very easy prompts (), nearly half of the targets have (all peers succeed), starving MR-Con of its negative peer.
All-failure groups are the majority case on hard benchmarks
In Section 5 of the MR-MOPD paper, the authors' own teacher-signal audit on LiveCodeBench reveals that 57% of prompts produce zero successful rollouts () under the base model. That statistic makes the fallback behavior on all-failure and single-success groups a primary determinant of training dynamics:
- When , MR-MOPD specifies that
MR-Posdrops the second positive slot and conditions on the single available positive peer . - When (no positive peers exist), conditioning the teacher solely on a failed peer (
1 Failure) performs poorly in the paper's ablation (Table 5: on Chemistry vs. for2 Pos + 1 Neg, and on LCB vs. ). In a production trainer, logging the exact fraction of targets that receive(2+, 1-),(1+, 1-),(1+, 0-),(0+, 1-), or(0+, 0-)contexts—and masking or falling back to standard OPD/GRPO when —prevents unanchored negative contexts from degrading the teacher signal.
How MR-MOPD selects diverse positives and hard negatives
When multiple positive and negative peers are available in and , how should pick the two positives and one negative?
- Primary positive anchor (): Chosen from as the highest-reward or canonical verified solution.
- Diversity-maximizing second positive (): If two positive peers are identical token-for-token copies, the second peer wastes context window budget without showing the teacher alternative valid phrasings or algorithms. Selecting the second positive to have minimal lexical or structural overlap with broadens the teacher's support across multiple valid solution modes.
- Informative negative peer (): Not all failures are equally diagnostic. A truncated rollout or a malformed JSON string teaches less about the problem's core logic than a near-miss failure—a trajectory that shares high structural similarity with (or with the target rollout ) yet fails a boundary test case. Contrasting a passing solution against a closely related failing attempt helps the teacher pinpoint the exact token transition where the bug was introduced.
Context window budgets and the peer-count ablation
Every peer trajectory added to expands the teacher's prefill sequence length. If a prompt is tokens and each rollout averages tokens, prepending three full peers adds tokens in front of the -token target rollout—pushing the teacher prefill pass to tokens per target (or prefill tokens across an 8-rollout group).
Does cramming all rollouts into the teacher's context beat the compact 3-peer (2 Pos + 1 Neg) selection? MR-MOPD's peer-context ablation (Table 5) tests this directly on QA-Chemistry and LiveCodeBench:
| Peer Context Configuration | QA-Chemistry (mean@8 / pass@8) |
LiveCodeBench (mean@8 / pass@8) |
|---|---|---|
1 Positive (SDPO equivalent) |
51.90 / 58.92 | 49.49 / 64.34 |
2 Positives (MR-Pos) |
52.62 / 59.02 | 55.62 / 64.02 |
1 Negative (Failure only) |
35.67 / 37.64 | 46.72 / 54.86 |
1 Positive + 1 Negative |
60.50 / 68.12 | 58.90 / 62.01 |
2 Positives + 1 Negative (MR-Con) |
74.29 / 83.53 | 61.82 / 67.23 |
All 8 Rollouts (2h wall-clock budget) |
73.57 / 83.11 | 58.43 / 63.68 |
All 8 Rollouts (4h wall-clock budget) |
81.25 / 84.49 | 58.95 / 64.71 |
Three practical engineering lessons emerge from this ablation:
- Negative peers only help when paired with positive anchors: Conditioning on
1 Negativealone hurts performance dramatically, whereas adding1 Negativealongside1 Positiveor2 Positivesproduces a large jump inmean@8( on Chemistry; on LCB). - Three curated peers beat eight unfiltered peers at matched wall-clock time: On LCB, dumping all 8 rollouts into the context window lowers
mean@8( vs. ) even when given double the wall-clock training budget (, ), both because extra redundant failures dilute attention and because longer teacher prefill contexts slow down each step. - Never truncate the tail of a peer trajectory: If context limits force compression, truncating the final lines of a peer rollout often cuts off the exact final answer or terminal bug that explains its verifier label. Keep complete peer trajectories and cap the number of selected peers at or instead.
Sources: Leave-one-out peer sets and MR-Pos/MR-Con selection rules follow MR-MOPD §3; the 57% all-failure LCB statistic and the peer-context ablation appear in MR-MOPD §5 and Table 5.
Previous: 15. Multi-Rollout MOPD: Learning from Local Trial and Error · Contents · Next: 17. Privileged Information and the Limits of Self-Teaching
17. Privileged Information and the Limits of Self-Teaching
A teacher model can outperform a student for two distinct reasons: either the teacher has stronger weights (), or the teacher is given privileged conditioning information () that is hidden from the student at test time. Multi-Rollout MOPD exploits the second mechanism—often using the exact same model checkpoint for both teacher and student while giving the teacher verified peer rollouts in its context window.
Framing MR-MOPD as learning under privileged information clarifies both why self-distillation can bootstrap substantial gains over zero-shot generation and where its fundamental limits lie.
Generation vs. privileged conditional verification
Compare the two conditional probability distributions evaluated at step of trajectory :
Even when , these two distributions solve different inference tasks:
- The student must solve cold from the problem statement alone.
- The teacher observes —which contains up to two verified working solutions and a labeled failure on the exact same prompt —and only has to judge how should continue in light of those references.
For a concrete example from MR-MOPD's coding case studies, suppose a problem specification uses an ambiguous indexing convention (0-indexed person IDs vs. 1-indexed display labels). Zero-shot rollouts from split between the two interpretations, and those that confuse them fail the unit tests. Once the verifier labels which peer rollouts passed and which failed, the teacher immediately sees which indexing convention passed the test suite and assigns high probability to the correct index offset when scoring .
Earlier self-distillation methods like SDPO (arXiv:2601.20802) already demonstrated that conditioning a self-teacher on a single successful rollout converts sparse binary rewards into dense token-level supervision. MR-MOPD extends this paradigm by moving from a single positive demonstration to a structured multi-rollout context (2 Pos + 1 Neg) that contrasts diverse working solutions against explicit local failure modes.
Where the new information actually comes from
The term "self-distillation" can make it sound as if the model is pulling capability out of thin air without external supervision. Tracing the information flow through a training step shows that the external ground-truth signal enters through repeated sampling plus the environment verifier:
- Exploration via group sampling (): Stochastic decoding searches the space of candidate trajectories around the current policy .
- Ground-truth selection via : The external verifier injects bit-level truth by partitioning into and .
- Credit assignment via in-context teacher scoring: The teacher uses its language modeling priors to compare the target prefix against the verified peers in , translating a sequence-level pass/fail bit into token-level log-probability ratios across the trajectory.
- Amortization into student weights : Minimizing trains the unprivileged student to produce zero-shot what the teacher inferred with in view.
Because the verifier is the sole anchor to ground truth, privileged self-distillation cannot rise above a flawed verifier: if a unit test suite has missing edge cases and labels a buggy shortcut as , the teacher will treat that shortcut as a verified reference solution and actively distill the bug into the student.
When privileged context is learnable vs. unlearnable
Not every difference between and can be internalized into the student's weights.
- Learnable structural patterns: When helps the teacher catch a dropped constraint from the prompt , select the right library call, or insert a missing boundary check, the information needed to make that decision was already latent in . Distilling into teaches the student to attend more carefully to and reproduce those reasoning habits at test time without needing .
- Unlearnable arbitrary facts: Suppose asks the model to guess an undocumented secret key that only appears inside and cannot be deduced from . No amount of training on can teach to predict a secret that is statistically independent of ; the student can at best learn a smoothed prior over plausible guesses.
Guarding against illegitimate target leakage
Because MR-MOPD deliberately feeds verified answers into the teacher prompt during training, engineers implementing the pipeline must enforce three strict isolation boundaries so legitimate privileged training does not turn into illegitimate data leakage:
- Strict leave-one-out exclusion (): As established in Chapter 15, the target trajectory being scored must never appear inside its own conditioning context . If a bug in the group indexer allows , the teacher achieves near-zero perplexity by simply copying from earlier in its prompt, destroying the distillation signal.
- Zero privileged context at evaluation time: During benchmark evaluation, the student must be evaluated zero-shot (or under standard multi-sample test protocols like
mean@8/pass@8) without any verifier-filtered peers in its prompt. - Prompt split hygiene: Privileged peer rollouts must be generated online from training prompts only, never retrieved from held-out test benchmarks.
Interpreting small-student vs. larger-teacher results
In Section 4.4, MR-MOPD pairs a Qwen3-4B student with an external Qwen3-14B teacher, finding that the distilled 4B student (66.44% on ToolUse, 61.92% on LCB) surpasses the standalone zero-shot accuracy of the 14B teacher (56.02% on ToolUse, 46.75% on LCB).
Why can a 4B student beat its 14B teacher's standalone score? During training, the 4B student is not matching the unconditioned 14B distribution ; it is matching the peer-conditioned 14B distribution , which has access to verified passing code and failure traces from the environment verifier, on top of RL reward updates over the rollout group. Combining environment verification with privileged teacher conditioning allows the student to exceed the teacher's unconditioned zero-shot baseline on the target task domain.
Teacher weight synchronization in self-distillation
When running MR-MOPD in self-distillation mode (where teacher and student start from the same checkpoint), an implementation must decide how the teacher parameters evolve as the student updates:
- Frozen initial checkpoint (): Keeps the teacher distribution stationary throughout training, preventing feedback loops at the cost of capping teacher competence at the base model's in-context verification ability.
- Online shared weights ( with
stop_gradient) or EMA teacher: Allows the teacher's in-context scoring ability to improve alongside the student, but requires careful entropy and clipping controls so teacher and student do not co-collapse onto repetitive phrasing.
We examine how these synchronization choices map onto concrete verl training loops in Chapter 21 and Chapter 22.
Sources: Privileged peer-conditioned teacher distributions, relationship to SDPO, and the 4B-from-14B teacher-student experiments are reported in MR-MOPD §§2–4.
Previous: 16. Peer Selection, Availability, and Context Budgets · Contents · Next: 18. What the Multi-Rollout Results Show
18. What the Multi-Rollout Results Show
Multi-Rollout MOPD evaluates peer-conditioned supervision across four task families: competitive programming (LiveCodeBench v6), competition mathematics (AIME and HMMT), scientific question answering (Biology, Chemistry, Physics, Materials), and agentic tool use. In each benchmark, the main experiments compare the base model, group-relative policy optimization (GRPO), single-positive self-distillation (SDPO), and multi-rollout contrastive self-distillation (MR-MOPD).
Reading these tables carefully requires tracking two evaluation metrics—mean@8 and pass@8—and noting where MR-MOPD achieves clear gains over both GRPO and SDPO versus where it ties GRPO.
Evaluation metrics: mean@8 vs. pass@8
For every test prompt, the evaluation harness generates independent responses from the trained student policy:
mean@8(per-sample accuracy): The average correctness across all 8 responses per prompt, averaged over the benchmark. It measures how reliably a single random rollout solves the task.pass@8(group coverage): The probability that at least one of the 8 responses solves the task. In general, given samples with correct responses, the unbiased estimator for () is which for reduces to the binary indicator averaged across prompts.
Tracking both metrics simultaneously reveals whether a training method is merely sharpening probability mass onto trajectories the model could already find (mean@8 rises while pass@8 stagnates or drops) or genuinely expanding the set of problems the model can solve within 8 tries (pass@8 rises alongside mean@8).
Competitive programming: LiveCodeBench v6
On LiveCodeBench v6 (131 contest problems released between February and May 2025), MR-MOPD is evaluated at both the 4B and 8B scales (Table 1):
| Method | Qwen3-4B mean@8 |
Qwen3-4B pass@8 |
Qwen3-8B mean@8 |
Qwen3-8B pass@8 |
|---|---|---|---|---|
| Base model | 28.80 | 49.36 | 30.97 | 53.02 |
| GRPO | 40.75 | 55.43 | 43.65 | 58.72 |
| SDPO | 48.84 | 63.23 | 49.49 | 64.34 |
| MR-MOPD | 57.01 | 65.48 | 61.82 | 67.23 |
On LCB, MR-MOPD delivers large improvements on both model sizes:
- Over SDPO,
mean@8jumps by points onQwen3-4Band points onQwen3-8B, whilepass@8improves by and points. - Over GRPO,
mean@8improves by points (4B) and points (8B), withpass@8up by and points.
Competition mathematics: AIME and HMMT
Table 2 evaluates Qwen3-4B across four competition math benchmarks (AIME25, AIME24, HMMT25 Feb, and HMMT25 Nov), reporting mean@8 / pass@8:
| Method | AIME25 (mean / pass) |
AIME24 (mean / pass) |
HMMT25 Feb (mean / pass) |
HMMT25 Nov (mean / pass) |
|---|---|---|---|---|
| Base model | 17.92 / 32.57 | 16.89 / 31.60 | 5.06 / 10.00 | 9.58 / 13.91 |
| GRPO | 25.80 / 36.66 | 17.09 / 32.05 | 16.92 / 20.94 | 13.16 / 19.53 |
| SDPO | 7.81 / 16.66 | 7.29 / 16.29 | 8.59 / 13.61 | 12.01 / 18.49 |
| MR-MOPD | 25.41 / 36.28 | 28.54 / 33.12 | 18.50 / 19.58 | 15.83 / 22.47 |
The math table shows a much more nuanced picture than coding:
- SDPO collapses on AIME: Single-positive self-distillation (
SDPO) drops far below even the untrained base model on AIME25 ( vs. ) and AIME24 ( vs. ). When math rewards are sparse binary answer checks and single successful peers are rare or noisy, uncontrasted self-distillation reinforces unproductive reasoning chains. - MR-MOPD fixes SDPO's collapse and trades wins with GRPO: Adding multi-rollout contrastive context (
MR-MOPD) recovers and surpasses the base model across all four benchmarks, beating GRPO substantially on AIME24 (mean@8vs. ) and HMMT25 Nov ( vs. ), while trailing GRPO slightly on AIME25 ( vs. ) and HMMT25 Febpass@8( vs. ).
Scientific QA and Agentic Tool Use
On Qwen3-8B, Table 3 evaluates four scientific QA domains and the ToolUse benchmark (mean@8):
| Method | QA-Biology | QA-Chemistry | QA-Physics | QA-Materials | ToolUse |
|---|---|---|---|---|---|
| Base model | 30.89 | 42.98 | 58.44 | 65.59 | 59.11 |
| GRPO | 47.32 | 64.24 | 64.12 | 72.09 | 60.32 |
| SDPO | 50.60 | 62.91* | 67.36 | 72.34 | 63.45 |
| MR-MOPD | 55.69 | 74.29 | 76.25 | 78.59 | 66.73 |
*Note on QA-Chemistry SDPO: While the main body table reports for SDPO on Chemistry, the three-seed uncertainty table in the paper's appendix reports for SDPO against for MR-MOPD (we catalog this manuscript discrepancy in Chapter 19). Across Biology, Physics, Materials, and ToolUse, MR-MOPD consistently outperforms both GRPO and SDPO by to points.
Distilling from a larger teacher (Qwen3-14B Qwen3-4B)
In addition to pure self-distillation (), Section 4.4 tests whether peer-conditioned contexts also help when distilling from a larger external teacher (Qwen3-14B supervising a Qwen3-4B student) on ToolUse and LiveCodeBench:
| Method | Supervision Setup | ToolUse (mean@8 / pass@8) |
LCB (mean@8 / pass@8) |
|---|---|---|---|
Student baseline (Qwen3-4B) |
None | 53.27 / 58.58 | 28.80 / 49.36 |
Teacher baseline (Qwen3-14B) |
None | 56.02 / 60.89 | 46.75 / 65.16 |
| Offline SFT / GKD baseline | 14B 4B offline | 55.91 / 60.05 | 46.05 / 56.67 |
| Standard OPD (no peer context) | 14B 4B on-policy | 59.63 / 61.58 | 60.92 / 67.30 |
| SDPO (single-pos self-teacher) | 4B 4B on-policy | 62.04 / 65.97 | 48.84 / 63.23 |
| MR-MOPD (self-teacher) | 4B 4B on-policy | 64.61 / 66.81 | 57.01 / 65.48 |
| MR-MOPD (14B teacher) | 14B 4B on-policy | 66.44 / 68.61 | 61.92 / 67.35 |
Comparing the rows isolates two separate effects:
- Moving from offline distillation to standard on-policy distillation (OPD) with the 14B teacher lifts LCB
mean@8from to and ToolUse from to . - Adding multi-rollout peer context (
MR-MOPD) to the 14B teacher adds another points on ToolUse () and point on LCBmean@8(). Remarkably, even 4B self-distillation with MR-MOPD ( on ToolUse) beats unconditioned 14B-to-4B on-policy distillation (), showing that conditioning a small teacher on verified peer rollouts can matter even more than scaling up an unconditioned teacher's parameter count.
Sources: Experimental results and ablation tables follow MR-MOPD §§4–6 and Appendix (from the compiled v2 source tables text/exp_1.tex, text/exp.tex, and text/exp_3.tex).
Previous: 17. Privileged Information and the Limits of Self-Teaching · Contents · Next: 19. Auditing Teacher Signals, Diversity, and the Source
19. Auditing Teacher Signals, Diversity, and the Source
Beyond downstream benchmark accuracy, MR-MOPD Section 5 investigates why peer-conditioned contexts help by auditing two intermediate properties:
- Teacher signal quality: When holding a set of candidate student rollouts fixed, does prepending
2 Pos + 1 Negpeers make the teacher's sequence log-probabilities correlate better with ground-truth verifier rewards? - Output diversity: Does contrastive multi-rollout conditioning preserve higher lexical and structural diversity across student rollouts than standard self-distillation?
Both analyses provide useful insight into the mechanism, and both contain subtle metric definitions and source-manuscript discrepancies worth understanding before reproducing the numbers.
How MR-MOPD measures teacher signal quality
For a fixed prompt and a group of candidate student responses with binary verifier outcomes , MR-MOPD computes the teacher's length-averaged sequence log-probability on each candidate under a chosen peer context :
Holding the trajectories and binary outcomes fixed while varying the context rule isolates how peer conditioning reshapes the teacher's sequence rankings. The paper evaluates six correlation and calibration metrics between continuous teacher scores and binary rewards across LiveCodeBench rollouts:
| Context Condition | Spearman | Kendall | Pairwise Acc. | Success AUC | Point-Biserial | Sigmoid Brier |
|---|---|---|---|---|---|---|
| No peers (standard OPD) | −0.0024 | −0.0031 | 0.1275 | 0.1283 | −0.0037 | 0.2071 |
1 Positive (primary success) |
0.0988 | 0.1262 | 0.3211 | 0.3217 | 0.0859 | 0.2986 |
2 Positives (MR-Pos) |
0.1190 | 0.1632 | 0.3528 | 0.3547 | 0.1065 | 0.3139 |
1 Negative (failure only) |
0.0097 | 0.0095 | 0.1326 | 0.1332 | 0.0052 | 0.1728 |
1 Positive + 1 Negative |
0.1122 | 0.1326 | 0.4045 | 0.4045 | 0.1038 | 0.2701 |
2 Positives + 1 Negative (MR-Con) |
0.1595 | 0.1879 | 0.4733 | 0.4733 | 0.1520 | 0.2908 |
All 8 Rollouts |
0.1260 | 0.1623 | 0.3550 | 0.3556 | 0.1107 | 0.3124 |
Across all five ranking and correlation columns (Spearman, Kendall, Pairwise Accuracy, AUC, and Point-Biserial), the ordering tracks the downstream benchmark ablations closely: unconditioned teacher log-probabilities (No peers) have near-zero correlation with code correctness (), adding positive peers lifts correlation, and the compact contrastive context (2 Positives + 1 Negative) achieves the highest discrimination across every ranking metric.
Two mathematical subtleties in the signal-quality table
If you look closely at the table above, two numbers should immediately jump out as unusual: why is the best Success AUC only (when random guessing on a valid binary classification problem has ), and why does 1 Negative (the worst-performing ranking condition) achieve the "best" (lowest) Sigmoid Brier score of ?
1. Undefined ranking metrics on all-failure prompts (the 57% zero-fill effect)
For any single prompt , let and . Both Pairwise Accuracy and Success AUC divide by the number of positive-negative pairs :
When all 8 rollouts on a prompt fail ()—which happens on 57% of the LCB prompts in this dataset—or when all 8 succeed (), the denominator is zero and Spearman, Point-Biserial, Pairwise Accuracy, and AUC are mathematically undefined.
Because the evaluation script replaces undefined per-prompt metrics with 0.0 before averaging across all 131 prompts, the maximum possible dataset-averaged AUC when of prompts have is bounded above by (or slightly higher depending on the exact mixed-label prompt fraction in the sample). Divided by the ~43% of prompts that actually have both positive and negative rollouts, an unconditional average of corresponds to a conditional within-prompt AUC well above on prompts with non-trivial variance! Meanwhile, under No peers, the unconditional AUC of reflects random ~0.30–0.50 ordering multiplied by the fraction of mixed-outcome prompts. When implementing this audit in your own codebase, always report metrics conditioned on mixed-outcome groups () alongside the fraction of all-zero and all-one groups.
2. Why is bounded by in the Sigmoid Brier column
The appendix defines the Sigmoid Brier score as , where is applied directly to the average token log-probability .
Because every normalized log-probability is nonpositive (), their average is always , which forces
Furthermore, because of prompts have all (and most rollouts overall fail), any condition that lowers the teacher's average log-probability pushes , shrinking on the majority failure class. That is why 1 Negative—which makes the teacher assign lower log-probabilities across the board—gets the lowest Sigmoid Brier score () despite having virtually zero discriminative power (). Raw without an affine calibration temperature and bias () should therefore not be used as a calibrated probability metric.
Lexical and syntactic diversity metrics
To test whether MR-Con avoids the mode collapse often seen in single-target distillation, Section 5.2 compares lexical -gram diversity (Distinct-1, Distinct-2) and Abstract Syntax Tree (AST) structural distance across the 8 generated code solutions per prompt:
| Method | Distinct-1 |
Distinct-2 |
AST Jaccard Distance |
|---|---|---|---|
| Base model | 0.025 | 0.111 | 0.092 |
| SDPO | 0.027 | 0.110 | 0.110 |
| MR-MOPD | 0.052 | 0.141 | 0.129 |
Here Distinct-n counts unique -grams divided by total -grams across the concatenated responses for a prompt, and AST Jaccard Distance parses the extracted Python code blocks into syntax trees and computes over node-type multisets between pairs of rollouts. Conditioning the teacher on two diverse positive peers plus a negative peer (MR-MOPD) doubles Distinct-1 relative to SDPO ( vs. ) and increases AST structural variation ( vs. ).
When interpreting AST Jaccard distance in code generation, keep in mind that only syntactically parseable Python blocks can be converted into ASTs; always log the syntax parse rate alongside AST distance so syntactic failures or fallback text extractions are not conflated with algorithmic diversity.
Summary of source-manuscript discrepancies in MR-MOPD (v2)
Because we audited the raw LaTeX source archive of arXiv:2605.12652v2 directly while preparing this book, the table below records every discrepancy between sections of the manuscript so readers and reproducers have a clean ledger:
| Topic | Manuscript Observation in arXiv:2605.12652v2 |
How to Handle in Analysis & Reproduction |
|---|---|---|
| QA-Chemistry SDPO score | Main Table 3 (text/exp_1.tex) reports 62.91; Appendix 3-seed Table (text/exp_3.tex) reports 73.22 ± 2.5 (with MR-MOPD at 74.29). |
Cite both figures; note that the main-table margin over SDPO shrinks to in the appendix 3-seed table. |
| Commented LCB v1 table | text/exp_1.tex contains a commented-out earlier LCB table with lower numbers alongside the active v2 table. |
Use the active compiled v2 table (57.01 / 61.82 mean@8). |
| Signal-quality table caption | Table caption states "six teacher context conditions," while the table body lists seven rows. | Include all seven rows reported in the table body. |
Distinct-n pooling scope |
Main text describes within-response lexical diversity; Appendix formula concatenates all responses per prompt before dividing. | Follow the explicit Appendix formula (cross-rollout concatenation) when reproducing the 0.025–0.052 scale. |
| Hybrid mixing weight | Algorithm 1 and setup list , without writing out the exact combined RL + OPD loss equation in the main text. | Treat as the convex combination weight between the GRPO policy gradient and the MR-MOPD divergence gradient (see Chapter 21). |
| Context length budget | Setup lists 2,048 prompt + 4,096 response (8,192 for math) and mentions an 8,192 total limit with extra teacher headroom. |
Allocate teacher prefill max_model_len large enough for prompt + 3 * max_response + target_response (up to 16K–32K) to avoid silent peer truncation. |
Sources: Teacher signal correlation metrics, diversity definitions, case studies, and LaTeX source comparisons follow MR-MOPD §5 and Appendices (text/exp.tex, text/exp_1.tex, text/exp_3.tex, text/appendix.tex, and text/case_study.tex).
Previous: 18. What the Multi-Rollout Results Show · Contents · Next: 20. Worked Examples from Task to Update
20. Worked Examples from Task to Update
To see how every piece of the MOPD machinery fits together in a single training step, let us trace one concrete programming task from prompt to parameter update—first under peer-conditioned Multi-Rollout MOPD (MR-MOPD), then under domain-routed Multi-Teacher MOPD (MT-MOPD), and finally under a hybrid design that combines both.
A task with two distinct index spaces
Consider a classic competitive-programming bug family highlighted in MR-MOPD's case studies: confusing person IDs with displayed badge numbers.
Suppose three people (-indexed IDs ) each wear a badge showing a displayed label and look at another person . For each badge label , we must output the badge label worn by the person that 's wearer is looking at.
Take the input arrays:
First invert to map each displayed badge label to the person wearing it: badge is worn by person , badge by person , and badge by person . Walking through the three steps for each badge label gives:
| Badge Label | Wearer | Target Person | Target's Badge |
|---|---|---|---|
| 1 | 2 | ||
| 2 | 3 | ||
| 3 | 1 |
The correct output is [3, 2, 1], corresponding to the three-step composition
Group rollout, verification, and leave-one-out peer selection
Suppose the student samples rollouts on this prompt:
- 2 rollouts pass (): Rollout builds an explicit
poslookup array for and outputsQ[P[pos[l]]]; rollout uses a Python dictionary comprehension and also passes all unit tests. - 6 rollouts fail (): Rollout forgets the final lookup and outputs the raw person ID
P[pos[l]]; rollouts index directly by badge label (Q[P[l]]).
The unit-test verifier labels and . Look at how leave-one-out peer selection constructs under MR-Con:
- For a failed target rollout (say ): has two passing solutions, and has five failing peers. The context builder selects both passing solutions plus a near-miss failing peer , giving the full
2 Pos + 1 Negteacher context. - For a passing target rollout (): Excluding leaves only one passing peer alongside the six failures , so drops to a
1 Pos + 1 Negcontext.
When the teacher scores prefix right at the return expression, having (which wrap the result in Q[...]) contrasted against (which mis-indexes P[l]) lets the teacher assign high probability to the outer Q[ token and low probability to returning the unmapped person index.
Tracing the local distributions, reverse KL, and gradients
To trace the exact numbers at that critical branching token , compress the vocabulary at prefix down to three simplified next-token choices:
- Token A: emit the unmapped person index (the student's habitual bug).
- Token B: wrap the lookup in
Q[...](the valid composition). - Token C: emit a comment or whitespace token.
Suppose the unprivileged student distribution and the peer-conditioned teacher distribution are:
1. Exact full-vocabulary reverse KL
The local reverse KL at this token position is
2. Sampled-token policy-gradient advantages
Under the sampled-token estimator, the advantage for each possible draw is:
Because rollout sampled the buggy token , the single-sample update observes (well inside the clip range) and pushes down .
3. Exact logit gradients
With , the exact gradient of with respect to the student logits is
Plugging in gives:
The three logit derivatives sum to (as required by shift invariance of softmax). A gradient descent step lowers , strongly raises , and slightly raises through the shared normalizer even though .
4. Tail-corrected top- loss ()
If instead we use MT-MOPD's tail-corrected top- objective with , the teacher's top-2 tokens are (). Evaluating Equation 5 on gives
Notice that is smaller than the full reverse KL () because the third coordinate is outside , yet its logit gradient still pulls mass into and out of the unscored tail token .
How MT-MOPD and a combined MT+MR pipeline process the same prompt
Now compare how the two architectures route this problem at the system level:
- In Multi-Teacher MOPD (
MT-MOPD): The student generates a single rollout (, no unit-test verification required during integration). Because the prompt comes from the coding/SWE dataset, the router sends to the frozen coding RL specialist . That specialist already learned how to compose index arrays during its Stage-2 RL training, so its unconditioned prefill pass directly assigns high probability to token (Q[...]) and low probability to token . - In a combined Multi-Teacher + Multi-Rollout pipeline: If you have both domain specialists and an online verifier during integration, you can sample a group of rollouts, build the verified peer context , and route to the domain specialist: This hybrid target gives a domain-specialized teacher in-context verification from peer rollouts, at the cost of increasing the integration rollout budget from to and running online verifiers during integration.
Sources: The index-composition bug pattern is adapted from MR-MOPD Appendix (Case Studies); the reverse-KL and corrected top- equations follow MT-MOPD §3.2.
Previous: 19. Auditing Teacher Signals, Diversity, and the Source · Contents · Next: 21. An Implementation Blueprint with Explicit Assumptions
21. An Implementation Blueprint with Explicit Assumptions
Translating MT-MOPD and MR-MOPD from paper equations into a distributed training codebase requires pinning down several systems interfaces that neither paper spells out in full—such as token-offset alignment when prepending peer rollouts, trajectory record schemas, and unit tests for loss normalization. This chapter provides a concrete engineering blueprint for building both variants on top of a modern RL/post-training stack (such as verl, OpenRLHF, or a custom Megatron/vLLM harness).
Lock down the training contract before writing service code
Before wiring up rollout workers and teacher RPCs, specify the exact mathematical choices that framework defaults often obscure:
- Rollout freshness and epoch count: Is each rollout batch used for a single gradient step (
ppo_epochs = 1with one minibatch) or reused across multiple off-policy sub-steps? - Length vs. token reduction: Does the loss divide by sequence length per trajectory first (MT-MOPD Equation 1) or average flatly across all unmasked tokens in the microbatch?
- Teacher synchronization (for MR-MOPD): Is the self-teacher frozen at , synced from the actor every steps, or evaluated online from the current actor weights with
stop_gradient? - Hybrid RL + OPD mixing (for MR-MOPD): When combining group-relative reward advantages with token-level distillation divergences, specify whether blends the total scalar losses or blends the per-token advantages directly.
Unified trajectory record schema
A clean implementation passes a self-contained, immutable trajectory record between the rollout engine, the verifier, the teacher prefill service, and the trainer:
@dataclass
class DistillationRecord:
record_id: str
prompt_id: str
domain: str # Routes to specialist phi_d in MT-MOPD
policy_version: int # Tracks asynchronous lag against trainer step
tokenizer_hash: str # Guards against vocab/template drift
# Student view: [prompt_tokens + response_tokens]
student_token_ids: Tensor # shape: [L_student]
actor_loss_mask: BoolTensor # 1 on student-sampled tokens, 0 on prompt/tool outputs
behavior_logprobs: FloatTensor # log p_b(y_t | c_t) recorded during rollout
# Verifier & MR-MOPD peer context metadata
reward: Optional[float]
peer_ids: List[str] # Strictly excludes record_id (leave-one-out)
peer_context_mode: str # e.g., "2pos_1neg", "1pos_0neg", "fallback_no_peers"
# Teacher supervision payload (aligned to active student response positions)
teacher_bundle_id: str
teacher_sampled_logprobs: Optional[FloatTensor] # shape: [L_response]
teacher_topk_ids: Optional[IntTensor] # shape: [L_response, k]
teacher_topk_logprobs: Optional[FloatTensor] # shape: [L_response, k] (full-vocab log_softmax)
Keeping student_token_ids, actor_loss_mask, and teacher_topk_logprobs aligned to the exact same response coordinates at the boundary of the teacher service prevents off-by-one indexing bugs inside the trainer.
Aligning student and teacher token offsets in MR-MOPD
In MT-MOPD, the student and the routed domain teacher process the exact same token sequence (x, y), so token index in the student forward pass matches token index in the teacher prefill pass.
In MR-MOPD, the teacher input prepends the peer context block between the prompt and the target rollout :
Student input: [ Prompt x ] [ Target response y^(i) ]
^--- student response starts at index L_x
Teacher input: [ Prompt x ] [ Peer block C_i ] [ Target response y^(i) ]
^--- teacher target starts at index L_x + L_{C_i}
If a target response has length , the teacher service must:
- Concatenate the token IDs of
x,C_i, andy^{(i)}without re-tokenizing the boundary betweenC_iandy^{(i)}in a way that merges BPE tokens across the boundary. - Run a causal forward pass over the full sequence of length .
- Slice out the last logit positions (remembering that in standard next-token prediction, the logit at index predicts the token at index ) so the returned tensor has shape
[T, k](or[T]), matching the response tokens of the student view one-to-one.
Orchestration loops for MT-MOPD and MR-MOPD
Multi-Teacher MOPD loop
for step in range(num_steps):
prompts = sample_domain_mixture(batch_size=2048, weights={"math": 0.35, "if": 0.35, "swe": 0.30})
# Asynchronous student rollout + streamed domain-routed teacher prefill
records = await rollout_and_score_mt(
prompts=prompts,
student_sampler=vllm_sampler,
teacher_clients=domain_teacher_pool, # Routes record.domain -> specialist prefill RPC
policy_version=step,
)
# Recompute student log-probabilities on the trainer and step optimizer
student_logits = actor_model(records.student_token_ids)
loss = compute_mt_reverse_kl_loss(student_logits, records, mode="pg_or_topk64")
optimizer.zero_grad()
loss.backward()
optimizer.step()
sync_weights_to_sampler(actor_model, vllm_sampler, version=step + 1)
Multi-Rollout MOPD loop
for step in range(num_steps):
prompts = sample_prompts(batch_size=32)
groups = vllm_sampler.generate_groups(prompts, n_rollouts=8, policy_version=step)
# Score all 256 rollouts with task verifier and partition Y+ / Y-
verified_groups = verifier_pool.score_all(groups)
teacher_requests = []
for group in verified_groups:
for i, target in enumerate(group.rollouts):
pos_peers = [r for j, r in enumerate(group.rollouts) if j != i and r.passed]
neg_peers = [r for j, r in enumerate(group.rollouts) if j != i and not r.passed]
context_tokens, mode = build_mr_context(pos_peers, neg_peers, variant="mr_con")
teacher_requests.append(make_aligned_teacher_request(target, context_tokens, mode))
teacher_targets = teacher_service.prefill_topk(teacher_requests, k=100)
loss = compute_mr_hybrid_loss(actor_model, verified_groups, teacher_targets, alpha=0.5)
optimizer.zero_grad()
loss.backward()
optimizer.step()
sync_weights_to_sampler(actor_model, vllm_sampler, version=step + 1)
Five mandatory pre-scale unit tests
Before launching a multi-node run, verify these five invariants on a small synthetic test case:
- Zero-loss identity check (): Load the exact same checkpoint into both the student trainer and the teacher prefill service (with no peer context ). Verify that the sampled-token advantage and the corrected top- loss evaluate to within
bf16tolerance () across every token of a multi-turn trajectory. Any spike reveals an off-by-one logit shift, chat-template discrepancy, or RoPE position mismatch. - Coordinate minimum of corrected top-: On a synthetic 5-token vocabulary with fixed and , optimize a free logit vector using
compute_topk_corrected_lossand assert that at convergence for all and throughout optimization (catching a missing term immediately). - Leave-one-out leakage assertion: In the MR context builder, add an explicit runtime
assert target.record_id not in [p.record_id for p in selected_peers]and verify that when a group has , the single passing rollout receives0positive peers while the 7 failing rollouts each receive1positive peer. - Tool-observation masking check: Construct a mock 3-turn SWE trajectory containing user prompts, assistant
<think>and tool-call blocks, and 500-token environment bash outputs. Assert thatactor_loss_maskisTruestrictly on assistant-generated tokens andFalseon all prompt and tool-return spans. - Packed-sequence causal isolation: Score the same trajectory twice on the teacher service—once alone with batch size 1, and once packed into a ragged batch alongside three other trajectories—and assert that the returned teacher log-probabilities match to machine precision.
Operational safeguards for asynchronous queues and verifiers
- Bound policy staleness: If rollout workers run asynchronously ahead of the learner, tag every trajectory with
policy_versionand reject (or apply importance-sampling clipping to) trajectories whose agecurrent_step - policy_versionexceeds a hard ceiling (e.g., – steps). - Apply backpressure on teacher queues: If one domain's teacher service slows down, apply backpressure to the prompt sampler rather than letting unscored rollouts accumulate in host RAM.
- Version your verifiers: Docker container updates, Python package upgrades, or regex parser tweaks in a math/code verifier can silently alter pass rates and change which peers enter and . Log a verifier version hash in every
DistillationRecord.
Sources: The MT-MOPD service architecture follows MT-MOPD §3; the MR-MOPD rollout-group and peer-conditioning loop follows MR-MOPD §§3–4.
Previous: 20. Worked Examples from Task to Update · Contents · Next: 22. Designing a Reproduction That Answers the Right Question
22. Designing a Reproduction That Answers the Right Question
Reproducing a post-training paper is as much about experimental controls as it is about code. Before launching GPUs, you need a clear ledger of which hyperparameters are explicitly specified in the papers, which implementation details have to be filled in or inspected from code repositories, and which compute budgets must be held constant for a fair comparison.
Complete hyperparameter ledger: Multi-Teacher MOPD
The table below compiles all reported training and evaluation settings for the controlled 30B study from MT-MOPD Section 4 and Appendices A–B:
| Pipeline Stage / Component | Reported Specification in MT-MOPD (arXiv:2606.30406v1) |
|---|---|
| Base & SFT starting point | Qwen3-30B-A3B-Base + broad custom SFT () |
| Math training data | SFT: Mixture-of-Thoughts math; RL: BigMath + ORZ math problems |
| IF training data | Synthetic IFBench-style prompts; SFT responses distilled from gpt-oss-120b |
| SWE training data | SFT: distilled trajectories on R2E-Gym; RL: R2E-Gym-Lite |
| Max sequence length | tokens (Math & IF); tokens and up to turns (SWE) |
| Stage-2 Specialist RL | On-policy GRPO with Dynamic Sampling; LR ; rollouts/prompt |
| Specialist RL batch & volume | Batch size prompts (Math/IF, sequences) and prompts (SWE, sequences) |
| Mix-RL baseline | GRPO with Dynamic Sampling; LR ; batch size prompts; rollouts |
| Cascade-RL baseline | Sequential RL order: |
| Stage-3 MT-MOPD integration | Batch size prompts; rollout/prompt; Dynamic Sampling disabled |
| Integration domain mixture | |
| Loss configurations | Sampled-token PG with advantage clip ; or Corrected Top- with |
| Evaluation decoding | Temperature , no top- or top- truncation; avg@32 on AIME25/26, pass@1 on IF/SWE |
Unspecified details to document in any MT-MOPD reproduction: The appendix does not state the exact learning rate, warmup schedule, weight decay, or total step count used during Stage-3 MT-MOPD integration (do not blindly assume the Stage-2 specialist RL learning rate of is optimal for batch-2,048 distillation), nor does it release the proprietary SFT checkpoint or the exact filtered prompt lists.
Complete hyperparameter ledger: Multi-Rollout MOPD
The table below compiles all reported settings from MR-MOPD Section 4.1 and its appendices:
| Component | Reported Specification in MR-MOPD (arXiv:2605.12652v2) |
|---|---|
| Self-distillation models | Qwen3-4B-Base and Qwen3-8B-Base (student and teacher share initial weights) |
| External-teacher study | Qwen3-14B teacher supervising Qwen3-4B student |
| Training framework | verl with asynchronous vLLM rollout workers and FSDP (bfloat16) |
| Batch & group size | prompts per step rollouts per prompt ( trajectories/step) |
| Optimizer & learning rate | AdamW, actor LR , warmup steps |
Default peer context (MR-Con) |
verified positive peers () + failed peer () |
| Divergence & truncation | Reverse KL (Math); Jensen–Shannon divergence (Code, QA, ToolUse); distillation_topk = 100 |
| Hybrid mixing weight | |
| Math training dataset | filtered DeepMath problems with difficulty |
| Sequence length limits | Max prompt ; max response ( for math), plus teacher context headroom |
| Evaluation protocol | samples per test prompt (mean@8 and pass@8) |
| Compute cluster | or per self-distillation run; nodes for 14B4B |
Details to verify against the verl codebase: When replicating MR-MOPD, document (1) the exact fallback rule when (the 57% all-failure prompt case), (2) how the top-100 truncated distributions are normalized or tail-bucketed inside the Jensen–Shannon divergence calculation, (3) how often the self-teacher weights synchronize with the actor , and (4) the exact formula combining the distillation loss with the RL advantage.
Choosing the right compute-fairness axis
"Sample efficiency" and "compute efficiency" can mean five different things depending on what you hold constant across baselines:
- Equal student rollout trajectories: Compares how much value each method extracts per generated trajectory (and per unit-test sandbox execution). Because MT-MOPD uses rollout per prompt without Dynamic Sampling discards while GRPO uses with Dynamic Sampling discards, MT-MOPD consumes far fewer integration rollouts per step—though Stage-2 specialist RL rollouts must be accounted for separately in end-to-end cost.
- Equal student generated tokens: Normalizes for verbosity drift, ensuring a baseline that inflates chain-of-thought length by is charged for generating twice as many tokens.
- Equal total FLOPs (student rollout + teacher prefill + student backward): Charges MR-MOPD for the – longer teacher prefill sequences created by prepending peer rollouts .
- Equal wall-clock time on identical hardware: Captures real systems bottlenecks, such as sandbox verifier latency on SWE/Code vs. teacher prefill latency on short QA tasks.
Report both marginal integration cost and total pipeline cost (including specialist RL or verifier execution) so readers can evaluate the trade-off for their own deployment scenario.
Designing clean ablations
If you are running an ablation study on a smaller open-weight model (for example, Qwen3-1.7B or Qwen3-4B across two or three public domains such as GSM8K/MATH, IFEval, and MBPP+/LiveCodeBench), structure the comparisons as a factorial grid rather than changing multiple knobs at once:
- To test MT-MOPD's core claims:
- Compare Same-Origin RL Teachers vs. External Heterogeneous Teachers across both Sampled-Token PG () and Corrected Top- (), and include a Naive Uncorrected Top- run on a short pilot to demonstrate the mass-evacuation bug from Chapter 9.
- Sweep the learning rate for the external teacher to separate fundamental representation incompatibility from step-size overshoot.
- To test MR-MOPD's core claims:
- Hold the prompt batch size, rollout budget, and fixed while varying only the context constructor :
No Peers(standard OPD),1 Pos(SDPO),2 Pos(MR-Pos),1 Pos + 1 Neg, and2 Pos + 1 Neg(MR-Con). - Log the exact distribution of realized context modes across training steps so you can separate improvements on mixed-outcome prompts () from fallback behavior on all-failure prompts ().
- Hold the prompt batch size, rollout budget, and fixed while varying only the context constructor :
- To test a combined MT + MR pipeline: Run a factorial experiment crossing Teacher Routing (single generalist self-teacher vs. domain-routed RL specialists) with Teacher Context (unconditioned vs.
2 Pos + 1 Negpeer-conditioned).
Statistical rigor and compositional evaluation
Small benchmarks like AIME24 and AIME25 contain only 30 problems each—a single problem is worth percentage points! Even when averaging 8 or 32 samples per problem to reduce decoding variance, the questions themselves are fixed. When reporting results:
- Compute paired bootstrap confidence intervals at the prompt level (resampling the 30 or 131 problems with replacement, keeping all rollouts of a resampled problem together) before declaring a 1-point margin statistically meaningful.
- Evaluate cross-domain conjunction prompts (e.g., solving a math problem under strict IFEval length and formatting constraints) alongside single-domain benchmarks to verify that the unified student can compose its distilled skills in a single response.
Sources: Reported hyperparameters are compiled from MT-MOPD §4 and Appendices A–B and MR-MOPD §4.1 and Appendices.
Previous: 21. An Implementation Blueprint with Explicit Assumptions · Contents · Next: 23. Limits, Guarantees, and What Small KL Cannot Promise
23. Limits, Guarantees, and What Small KL Cannot Promise
On-policy distillation optimizes a distributional agreement objective: it trains the student to match a teacher's next-token probabilities along student-visited prefixes. Understanding what small token-level KL divergence mathematically guarantees—and what it leaves unconstrained—clarifies the structural limits of both MOPD variants and highlights the open research questions they raise.
What Pinsker's inequality and the KL chain rule actually bound
At any fixed prefix , Pinsker's inequality bounds the total variation distance between the student's next-token distribution and the teacher's distribution in terms of the reverse KL divergence:
Driving therefore guarantees that the student and teacher assign similar probabilities to any next-token event at context .
What happens when we chain those local decisions across a full -token trajectory ? By the chain rule of KL divergence, the sequence-level reverse KL between the student trajectory distribution and a fixed teacher trajectory distribution equals the sum of expected step-wise conditional KLs along student-visited prefixes:
If the expected per-token reverse KL is bounded by at every step , then the sequence-level KL is at most . Applying Pinsker's inequality to the full trajectory distributions and bounds the gap in expected reward for any binary verifier :
Plug in concrete numbers to see how quickly sequence length loosens this worst-case guarantee: at an average token-level reverse KL of nats over a -token reasoning chain, the Pinsker upper bound is ( percentage points of pass-rate gap!).
Even more importantly, a low sequence-averaged KL can hide concentrated errors:
- Dilution across boilerplate tokens: If a 1,000-token code solution has zero KL on 999 syntax and indentation tokens and a -nat KL spike on the single comparison operator (
<vs.<=) that determines whether the algorithm passes or fails, the trajectory-averaged KL is just , yet the student fails the unit test every time. - Unvisited branches: Because the expectation is weighted by the student's current visitation distribution, zero divergence on the prefixes the student currently visits says nothing about how well the student would behave on reasoning branches it has already stopped exploring.
- Partial top- truncation: When training with the corrected top- loss , probability mass rearrangements outside the teacher's top- set are not bounded by .
Representational capacity and multi-domain interference
In MT-MOPD, the student and all specialist teachers have the exact same parameter count (30B-A3B in the controlled study, 309B in MiMo-V2-Flash). Consolidating specialists into one weight vector relies on the assumption that a single model has enough spare representational capacity to realize across all domains simultaneously.
Two factors make this consolidation work well in MT-MOPD's regime—and define where it will eventually strain:
- Disjoint contextual conditioning: Because math prompts, SWE repository interactions, and IF formatting tasks occupy largely distinct regions of the input prompt space, a high-capacity MoE transformer can partition its experts and attention heads by context without severe interference.
- Same-origin basin sharing: Because every was trained via a bounded number of RL steps from the same SFT checkpoint , the specialists agree on most general language tokens and differ primarily on task-specific action transitions.
As the number of domains scales from – to dozens of fine-grained specialties, or when distilling large teachers into a much smaller student (compression + consolidation), finite model capacity forces trade-offs across domains. Mapping out the pareto frontier between student parameter count, number of specialist domains , and headroom recovery remains an important empirical question.
Verifier false positives and reward hacking amplification
Both MOPD pipelines ultimately depend on the integrity of the task verifiers :
- In MT-MOPD: If a Stage-2 specialist teacher learns to exploit a loophole in its reward function (for example, an IF specialist learning a degenerate formatting trick or a SWE specialist gaming unit-test harnesses), Stage-3 distillation faithfully copies that reward hack into the unified student—even though Stage 3 itself never calls the flawed reward function.
- In MR-MOPD: Verifier errors enter even more directly. If a weak unit-test suite mislabels a buggy rollout as a verified success (), that buggy code is pasted directly into the teacher's context under the header "Verified Correct Reference Solution." Conversely, if a fragile regex parser marks a mathematically valid proof as a failure () because of a whitespace quirk,
MR-Conhands that valid proof to the teacher as a negative counterexample to avoid.
Privileged peer conditioning amplifies the quality of the verifier: when the verifier is exact, sharpens credit assignment; when the verifier is noisy, injects mislabeled in-context demonstrations into the teacher's prompt.
The test-time information gap in privileged distillation
In MR-MOPD, the teacher conditions on verified peer attempts , whereas at deployment the student must act without . As discussed in Chapter 17, any decision that depends solely on carefully reading and avoiding common pitfalls can be internalized into . However, when a problem requires brute-force trial-and-error search just to discover which branch works (information that is only revealed by running the external verifier on 8 rollouts), no zero-shot policy can fully replicate the privileged teacher's certainty on the first attempt without performing multi-turn self-verification or test-time search of its own.
Open research directions
Bringing the two MOPD papers together points to several natural next steps for post-training research:
- Unified Multi-Teacher + Multi-Rollout distillation (
MT-MR-MOPD): During domain integration, routing groups of student rollouts along with verified positive and negative peers to the corresponding domain specialist combines specialist parameters with privileged in-context verification. - Cross-architecture alignment bridges: Can a brief offline SFT warmup, temperature-scheduled JS divergence, or logit-ratio clipping allow MT-MOPD to safely distill from heterogeneous external frontier teachers (like the
Qwen3-235Bteacher in Table 4) without triggering entropy collapse? - Decision-token weighted divergences: Instead of weighting every boilerplate syntax token equally with , weighting token positions by teacher-student entropy differences or critic value changes could focus capacity on the critical branching tokens that determine trajectory outcomes.
- Full trajectory-occupancy corrections: Incorporating lightweight reward-to-go KL terms alongside the local myopic token advantage could help students avoid early branching choices that lead into high-discrepancy dead ends.
Sources: Empirical limitations and future directions build on MT-MOPD §§4–5 and MR-MOPD Appendix (Limitations).
Previous: 22. Designing a Reproduction That Answers the Right Question · Contents · Next: 24. Synthesis and Frequently Asked Questions
24. Synthesis and Frequently Asked Questions
Multi-Teacher MOPD (arXiv:2606.30406v1) and Multi-Rollout MOPD (arXiv:2605.12652v2) intervene at two complementary points in the on-policy distillation loop:
- Multi-Teacher MOPD (
MT-MOPD) chooses who teaches: it routes each student trajectory to a domain-specialized RL teacher branched from the same SFT checkpoint, consolidating multiple specialists into one unified model. - Multi-Rollout MOPD (
MR-MOPD) enriches what the teacher sees: it samples a group of rollouts per prompt, partitions them with a task verifier, and prepends verified positive and negative peer attempts into the teacher's context window.
This chapter answers the most common mathematical, architectural, and operational questions that arise when comparing or implementing the two methods.
Architecture and routing
Are the two MOPD papers describing the same algorithm?
No. They were developed independently, share the acronym MOPD, and both train on student-generated rollouts using token-level divergences, but their core mechanisms are orthogonal: MT-MOPD routes across multiple domain-specialist teacher weights , whereas MR-MOPD conditions a single teacher weight set (often the student's own base checkpoint) on multiple verified peer rollouts .
Does "Multi-Teacher" mean averaging logits across all teachers on every token?
No. In MT-MOPD, each training prompt carries a domain label and is scored by one specialist teacher . Averaging teacher distributions across domains on the same token would multiply prefill compute by and force the student toward the weighted geometric mean , allowing an out-of-domain teacher to veto valid domain-specific transitions.
Does MOPD require running teachers or multiple rollouts at test time?
No. In both papers, the teachers, rollout groups, and verifiers are used strictly during training. At deployment, only the single distilled student checkpoint is served, generating responses zero-shot with no teacher calls and no peer-context construction.
Does the student have to be smaller than the teacher?
No. In MT-MOPD, the student and all domain teachers have the exact same architecture and parameter count (Qwen3-30B-A3B in the controlled study, MiMo-V2-Flash 309B in production); the goal is capability consolidation rather than parameter compression. In MR-MOPD, the main experiments use self-distillation ( and share the same 4B or 8B scale), along with an external-teacher study distilling Qwen3-14B into Qwen3-4B.
Why can a teacher supervise prefixes it would never generate on its own?
Because autoregressive transformers evaluate conditional probabilities via causal teacher forcing. When fed a student prefix that contains an awkward variable name or sub-optimal intermediate step, the teacher's forward pass still computes a normalized distribution over how best to continue or recover from step onward.
Objectives, gradients, and sparse losses
Does on-policy distillation eliminate every distribution shift?
Training on student-generated prefixes eliminates the training-time exposure bias between teacher prefixes and student prefixes . It does not automatically prevent distribution shifts between the training prompt mixture and production user traffic, nor does it eliminate asynchronous policy lag when rollout workers run several steps behind the learner.
Is the token log-ratio a true RL return-to-go?
No. is an immediate conditional log-likelihood ratio at step . It tells the optimizer whether the teacher assigns higher or lower probability to the sampled token at prefix , without summing future log-ratios over steps .
Why can the logged policy-gradient surrogate loss be negative?
Because the surrogate loss detaches . Its gradient matches the local reverse-KL score function, but its scalar value is a signed product of and , not a nonnegative divergence. To monitor reverse KL in nats, log the batch average of separately.
Why is the sampled-token update called a local semi-gradient?
In the full trajectory objective , the parameters control both the local KL at each visited prefix and the probability of visiting trajectory in the first place. Differentiating while holding the sampled prefixes fixed computes the local step-wise gradient and omits the trajectory-occupancy score-function term.
Why does top- reverse KL need the correction term?
In a naive partial sum over a proper subset , the derivative with respect to is , which sets the coordinate minimum at and pushes student probability mass out of the top- set into the unscored tail. Adding turns each summand into the nonnegative Bregman divergence , whose derivative is and whose unique minimum is at .
Does zero corrected top- loss imply across the full vocabulary?
Only if . When , guarantees that for every and that the total remaining tail mass matches, but it leaves how the student distributes mass among the unscored tail tokens completely unconstrained.
Is top- distillation the same thing as top- decoding?
No. Top- distillation selects which teacher vocabulary coordinates enter the training loss at each prefix; top- decoding truncates the sampling distribution during text generation. MT-MOPD uses full-vocabulary sampling (temperature , no top- or top- cutoff) during rollout and evaluation even when training with the top- distillation loss.
Teacher compatibility and multi-rollout conditioning
Why did replacing the 30B math teacher with a stronger 235B external teacher hurt the student?
In MT-MOPD Table 4, swapping the same-origin Qwen3-30B-A3B math RL specialist for Qwen3-235B-A22B jumped the initial token-level reverse KL on student prefixes nearly fivefold (). Under reverse KL, large mismatches on the student's natural phrasing generate predominantly negative advantages that suppress student entropy () under policy-gradient training and trigger step-18 gradient oscillations under unclipped top- training.
What does MT-MOPD's headline normalized score represent?
It is the unweighted mean across three domains (Math, IF, SWE) of the fraction of specialist-over-SFT headroom recovered by the unified student: . It means the single integrated model recovers of the benchmark gains that the three domain-specific RL teachers achieved over the SFT starting point.
How does MR-MOPD differ from SDPO?
Single-positive self-distillation (SDPO, arXiv:2601.20802) conditions the self-teacher on a single passing rollout from the group. MR-MOPD expands the teacher context to combine multiple diverse positive peers with an explicit failed peer (2 Pos + 1 Neg), giving the teacher both alternative valid solution structures and a concrete local pitfall to contrast against.
Why does conditioning on a single failed rollout alone (1 Neg) perform so poorly?
Showing a teacher a failed attempt without a passing reference tells the model what went wrong on one branch without anchoring what a working solution looks like. In MR-MOPD Table 5, 1 Neg drops LCB mean@8 to (and Chemistry to ), whereas pairing that same negative peer with two positive anchors (2 Pos + 1 Neg) lifts LCB to and Chemistry to .
What happens in MR-MOPD when all rollouts fail (or only one succeeds)?
Under leave-one-out exclusion (), an all-failure group () leaves every target with zero positive peers, and a single-success group () leaves the single passing target with zero positive peers while giving the 7 failing targets one positive peer. Because of base-model LCB prompts have , a production implementation must define an explicit fallback rule (such as dropping back to unconditioned OPD or GRPO when ).
Can Multi-Teacher and Multi-Rollout MOPD be combined in one pipeline?
Yes: during integration, you can sample a group of student rollouts per prompt, verify them with the domain verifier to construct the contrastive peer context , and route to the domain specialist to evaluate . Designing and ablating that combined architecture (MT-MR-MOPD) is one of the most promising extensions of the two papers.
Sources: Synthesized from MT-MOPD, MR-MOPD, and SDPO.
Previous: 23. Limits, Guarantees, and What Small KL Cannot Promise · Contents · Next: 25. Notation, Glossary, and an Auditable Source Map
25. Notation, Glossary, and an Auditable Source Map
This reference chapter collects the mathematical notation, glossary definitions, and exact LaTeX source locators for both MOPD papers so you can jump directly from any equation, table, or ablation in this book to the primary manuscript files.
Primary papers and arXiv versions
- MT-MOPD: Wenhan Ma et al., MOPD: Multi-Teacher On-Policy Distillation for Capability Integration in LLM Post-Training,
arXiv:2606.30406v1(submitted June 29, 2026). Abstract · HTML · TeX Source. - MR-MOPD: Weichen Yu et al., Multi-Rollout On-Policy Distillation via Peer Successes and Failures,
arXiv:2605.12652v2(submitted May 12, 2026; revised June 1, 2026). Abstract · HTML · TeX Source.
Repository layout of local TeX source snapshots
Under src/content/docs/papers/mopd/, the versioned LaTeX archives retrieved from arXiv are organized as follows:
book/ 27 Markdown chapters of this book
_sources/manifest.json Retrieval timestamps and SHA-256 checksums
_sources/multi-teacher/ arXiv:2606.30406v1 source tree
xiaomi.tex Root document defining active chapter inclusions
chapters/ Method, experiment, and appendix .tex files
latex_fig/ Benchmark tables and figure macros
custom.bib, references.bib
_sources/multi-rollout/ arXiv:2605.12652v2 source tree
main.tex Root document defining active v2 section inclusions
text/ Active sections, algorithm blocks, appendices, case studies
custom.bib, custom_new.bib
In _sources/multi-rollout/, main.tex determines which files and macros are active in the compiled v2 PDF (intro, related_work_short, prelim, method, exp_1, exp, exp_3, conclusion, and appendix). Whenever an archive file contains commented-out v1 tables or \iffalse blocks, this book reports the active compiled v2 numbers and notes any internal discrepancies in Chapter 19.
Standard notation table
| Symbol | Meaning |
|---|---|
| Task prompt (including system instructions and initial problem state) | |
| Autoregressively generated trajectory of length | |
| Trajectory prefix prior to step | |
| Complete conditioning context at decision step | |
| Shared token vocabulary | |
| Trainable student policy parameters () | |
| Shared broad SFT starting checkpoint in MT-MOPD | |
| Frozen domain-specialist teacher parameters for domain in MT-MOPD | |
| Teacher parameters in MR-MOPD (either shared self-teacher or external teacher) | |
| Student next-token probability distribution at context | |
| Teacher next-token probability distribution at context | |
| Domain routing label for prompt in MT-MOPD | |
| Training mixture sampling weight for domain | |
| Number of student rollouts sampled per prompt in a rollout group ( in MR-MOPD) | |
| Ground-truth environment verifier or reward function | |
| Reward threshold partitioning rollouts into passing () and failing () sets | |
| Leave-one-out passing and failing peer sets with target rollout excluded | |
| Privileged peer context prepended to the teacher prompt for target | |
| Stop-gradient operator (detaches expression from automatic differentiation) | |
| Sampled-token reverse-KL log-probability ratio advantage | |
| Symmetric clipping bound on ( in MT-MOPD) | |
| Set of highest-probability vocabulary tokens under the teacher at step | |
| Tail-corrected top- reverse-KL loss | |
| Marginal distribution over contexts visited by policy at step | |
| Normalized specialist headroom recovery in domain |
Glossary of key terms
- Actor: The trainable student policy generating rollouts and receiving gradient updates.
- Behavior policy (): The exact snapshot of the student policy that generated a stored trajectory at rollout time; may lag behind the current trainer weights in asynchronous setups.
- Capability integration: Consolidating specialized improvements from multiple domain-specific post-training runs into a single deployable model checkpoint.
- Causal teacher forcing (prefill scoring): Computing next-token distributions across all positions of an existing student trajectory in a single parallel forward pass.
- Dynamic Sampling: A GRPO filtering heuristic that discards prompt groups whose rollouts all receive identical rewards (zero group variance); disabled during Stage-3 MT-MOPD integration.
- Exposure bias: The distributional mismatch that occurs when a student is trained exclusively on teacher-generated prefixes () but deployed autoregressively on its own prefixes ().
- Forward KL (): Teacher-weighted log-ratio expectation; penalizes the student heavily wherever and (mode-covering).
- Reverse KL (): Student-weighted log-ratio expectation; penalizes the student heavily wherever and (mode-seeking / zero-forcing).
- Jensen–Shannon (JS) divergence: The symmetric, bounded divergence to the midpoint mixture .
- Leave-one-out peer set: The subset of passing () and failing () rollouts in a group remaining after removing the target rollout being scored.
- Local semi-gradient: A policy update that differentiates the step-wise divergence at visited prefixes while holding the trajectory visitation distribution fixed.
- Privileged information: Conditioning context (such as verified peer solutions ) provided to the teacher during training but withheld from the student during both training and test-time inference.
- Same-origin specialist: A domain teacher trained via RL starting from the exact same SFT checkpoint that initializes the student.
Source locator map: Multi-Teacher MOPD (arXiv:2606.30406v1)
| Topic / Equation / Table | Paper Section | Local TeX File in _sources/multi-teacher/ |
|---|---|---|
| Three-stage pipeline & prompt routing | Section 3.1 | chapters/03_method.tex |
| Token-averaged reverse-KL objective | Section 3.2, Equation 1 | chapters/03_method.tex |
| Sampled-token PG gradient & clipping | Section 3.2.1, Equations 2–4 | chapters/03_method.tex |
| Tail-corrected top- reverse-KL loss | Section 3.2.2, Equation 5 | chapters/03_method.tex |
| Standalone asynchronous prefill services | Section 3.3 | chapters/03_method.tex |
| Controlled 30B benchmark comparison | Section 4.2, Table 2 | latex_fig/tab_qwen3_main.tex |
MiMo-V2-Flash 309B 5-domain results |
Section 4.3, Table 3 | latex_fig/fig_mimo_bars.tex |
| PG vs. Top- & external 235B math teacher | Section 4.4.1–4.4.2, Table 4 | latex_fig/tab_distill_variant.tex |
| Two-round iterative evolution experiment | Section 4.4.3, Table 5 | latex_fig/tab_coevolve.tex |
| Specialist RL & integration hyperparameters | Appendix A | chapters/B_appendix.tex |
| Evaluation benchmarks & decoding settings | Appendix B | chapters/C_appendix.tex |
(Note: in _sources/multi-teacher/chapters/, Appendix A is stored in B_appendix.tex and Appendix B is stored in C_appendix.tex.)
Source locator map: Multi-Rollout MOPD (arXiv:2605.12652v2)
| Topic / Algorithm / Table | Paper Section | Local TeX File in _sources/multi-rollout/ |
|---|---|---|
| On-policy distillation preliminaries | Section 2 | text/prelim.tex |
Group partitioning, leave-one-out sets, MR-Pos/MR-Con |
Section 3 | text/method.tex |
| MR-MOPD training algorithm block | Section 3, Algorithm 1 | text/alg.tex |
verl setup, hyperparameters, and Math (Table 2) |
Section 4.1–4.2 | text/exp_1.tex |
| LiveCodeBench, Science QA, ToolUse, and peer ablation | Section 4.2–4.3, Tables 1, 3, 4, 5 | text/exp.tex |
External teacher (14B 4B) comparison |
Section 4.4 | text/exp_3.tex |
| Teacher signal correlation & diversity metrics | Section 5 & Appendix | text/exp.tex, text/appendix.tex |
| Step-time overhead & 3-seed Science QA table | Appendix (Training Statistics) | text/appendix.tex, text/exp_3.tex |
| Qualitative code & math error case studies | Appendix (Case Studies) | text/case_study.tex |
| Limitations discussion | Appendix | text/appendix_more.tex |
Related primary literature
- MiniLLM: Yuxian Gu et al., MiniLLM: Knowledge Distillation of Large Language Models, ICLR 2024 (arXiv:2306.08543) — early formulation of reverse-KL on-policy distillation for generative language models.
- GKD: Rishabh Agarwal et al., On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes, ICLR 2024 (arXiv:2306.13649v3) — generalized on-policy knowledge distillation mixing student and teacher rollouts with KL and JS divergences.
- SDPO: Reinforcement Learning via Self-Distillation (arXiv:2601.20802v2) — self-distillation baseline conditioning a self-teacher on environment feedback and single successful rollouts.
- GRPO (DeepSeekMath): Zhihong Shao et al., DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models (arXiv:2402.03300v3) — introduces Group Relative Policy Optimization.
- MR-MOPD Code Repository: github.com/viviable/mopd_code.
Previous: 24. Synthesis and Frequently Asked Questions · Contents · Next: 26. Exercises and Worked Solutions
26. Exercises and Worked Solutions
These fourteen problems test the core derivations, failure modes, and systems calculations developed across the book—ranging from reverse-KL gradients and top- Bregman corrections to headroom normalization, leave-one-out peer combinatorics, and prefill queue stability.
1. Rare-mode exploration under a sampled-token estimator
At a fixed context , a two-token student distribution is while the teacher distribution is . What sampled-token advantage does the second token receive when sampled, and why does a single-sample policy-gradient update still converge slowly on this coordinate?
Worked solution. When token is sampled, its unclipped log-ratio advantage is
Even though the gradient multiplier is large and positive, the student only samples token on of visits to context . On the other of visits, the student samples token and observes . In expectation over , the single-sample estimator is unbiased for , but its Monte Carlo variance is high whenever teacher-favored modes have tiny student probability .
2. Stationary point of naive vs. corrected top- reverse KL
Suppose a teacher's largest token probability at context is , and we score only () while allowing the remaining student mass to move freely into unscored tail tokens. Find the coordinate-wise minimum of the naive partial loss and compare it to the corrected loss .
Worked solution. Differentiating the naive partial loss with respect to gives
where . The naive truncated objective pushes nearly two-thirds of the teacher's top-token mass out into the unscored tail! Adding the linear correction changes the derivative to
with and for all .
3. Zero corrected top- loss with nonzero full-vocabulary KL
Construct a three-token example where the corrected top- loss is exactly zero, yet the full-vocabulary reverse KL is strictly positive.
Worked solution. Set and with (). On the scored coordinate , , so
Across the full vocabulary, however, the swapped tail probabilities on tokens and yield
Matching for all pins down the total tail mass , but cannot observe how the student allocates that mass among individual tail tokens in .
4. Computing normalized headroom recovery
In a single domain , the SFT student scores , the domain RL specialist teacher scores , and an integrated student scores . What is the normalized headroom score ? What if the integrated student scores , or if ?
Worked solution. Using :
- At : ( of the teacher's RL gain over SFT).
- At : (the student exceeds the specialist teacher by of the teacher's headroom).
- If : the denominator , making undefined; headroom normalization requires a specialist that measurably improves over the SFT baseline.
5. Non-commutativity of benchmark averaging vs. headroom normalization
Suppose the Mathematics domain has two benchmarks (AIME25 and AIME26) where the SFT student scores , the math teacher scores , and the distilled student scores . Compare (a) averaging the two benchmark scores first and then normalizing against (b) normalizing each benchmark separately and then averaging the two ratios.
Worked solution.
- (a) Domain-mean first (MT-MOPD's convention): The domain means are , , and . Normalizing gives
- (b) Per-benchmark normalization first: On benchmark 1, recovery is ; on benchmark 2, recovery is . Their average is .
Because ratios of sums do not equal averages of ratios when denominators differ across benchmarks, reproducing MT-MOPD's Table 2 headline () requires averaging within-domain benchmarks before dividing by domain headroom.
6. Leave-one-out peer availability within a single rollout group
A group of rollouts on prompt produces passing trajectory () and failing trajectories (). Under leave-one-out peer selection (), how many positive peers are available when scoring , and how many are available when scoring ?
Worked solution.
- For the failing target : , so positive peer is available.
- For the passing target : excluding leaves , so positive peers are available.
Pasting into its own teacher context to fake a positive peer would leak the entire target answer into the teacher's conditioning prefix.
7. Binomial discovery vs. leave-one-out availability
If a student policy has an independent per-rollout pass probability of on a hard prompt, what is the probability that a group of rollouts contains at least one passing solution, and what is the probability that a specific target rollout has at least one passing peer among the remaining rollouts?
Worked solution.
- Group-level discovery ( success in draws):
- Target-level peer availability ( success in peer draws):
8. Comparing mean@8 and pass@8 on a single prompt
On a single test problem, an evaluator samples responses from the model and exactly response passes the unit tests. What are the prompt's mean@8 and pass@8 scores?
Worked solution.
- .
- .
Averaged over a benchmark, mean@8 measures single-attempt reliability, whereas pass@8 measures whether the correct solution lies anywhere within an 8-sample search budget.
9. Why all-failure prompts distort dataset-averaged AUC
In a benchmark of prompts, prompts have zero passing rollouts (), and on the remaining mixed-outcome prompts the teacher achieves a strong within-prompt Success AUC of . If an evaluation script replaces undefined 0/0 prompt AUCs with 0.0 before averaging over all prompts, what dataset-averaged AUC does it report?
Worked solution. The script computes
making a strong discriminator look worse than a coin flip! Always filter to prompts with (and report the valid prompt count) when computing within-prompt ranking metrics.
10. Upper bound of the uncalibrated Sigmoid Brier score
Suppose a teacher assigns an average per-token log-probability of nats to candidate trajectory . What pseudo-probability does assign, and why can never exceed ?
Worked solution. At ,
Because is a normalized categorical distribution, every token probability satisfies , so every log-probability is nonpositive () and their average satisfies . Since is strictly increasing with , for every possible trajectory. On datasets where most rollouts fail (), models with lower log-probabilities () push and achieve artificially low Brier scores regardless of whether they rank passing rollouts above failing ones.
11. Network bandwidth for top- teacher prefill payloads
A student trajectory has active response tokens. If the teacher prefill service returns its top- token IDs (32-bit integers) and full-vocabulary normalized log-probabilities (32-bit floats) at every active position, how many megabytes is the uncompressed response payload?
Worked solution. Each position transmits . Across positions:
By comparison, returning only the single sampled-token log-probability ( known ID) requires (), while returning a full -token fp32 distribution requires .
12. Asynchronous teacher queue stability
During MT-MOPD integration, student rollout workers generate completed math trajectories at an average rate of tokens/s, while the dedicated math teacher prefill service has a maximum sustainable throughput of tokens/s. Does asynchronous overlap hide the teacher latency over a 100-step run?
Worked solution. No. Because , the math scoring queue grows without bound at a net rate of tokens/s. Asynchronous RPC calls only hide teacher latency when for every domain ; otherwise the trainer either stalls waiting for straggler math trajectories at the step barrier or consumes increasingly stale rollouts.
13. Local semi-gradient vs. full trajectory-occupancy gradient
In an on-policy distillation loop that collects fresh student trajectories at every step and updates using the token-wise score function , what exact derivative term from is omitted?
Worked solution. Writing , the exact gradient of the trajectory expectation is
The token-wise update estimates the first term (differentiating the local divergence at each visited state ), and omits the second term , which accounts for how changing early token probabilities alters the distribution of downstream states visited later in the trajectory.
14. Factorial ablation design for a combined MT-MR-MOPD system
Suppose you propose a unified algorithm that routes each prompt to a domain-specialist RL teacher and conditions that specialist on verified peer rollouts . What four experimental arms are required to test whether the two mechanisms are complementary?
Worked solution. Run a factorial grid under matched rollout and prefill budgets starting from the same SFT checkpoint :
- Single generalist teacher + no peer context: standard single-teacher OPD baseline.
- Domain-routed specialist teachers + no peer context: pure
MT-MOPD(). - Single generalist teacher +
2 Pos + 1 Negpeer context: pureMR-MOPD(). - Domain-routed specialist teachers +
2 Pos + 1 Negpeer context: combinedMT-MR-MOPD().
Comparing against measures whether specialist teachers benefit as much from in-context peer contrast as a generalist self-teacher, or whether domain specialization and peer conditioning partially substitute for one another.
Previous: 25. Notation, Glossary, and an Auditable Source Map · Contents