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:

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

Begin with Chapter 1.

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:

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 y(i)y^{(i)}, 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 VV. Given a context cc, the language model's forward pass produces a vector of unnormalized real-valued logits z(c)∈R∣V∣z(c) \in \mathbb{R}^{|V|}, which the softmax function converts into a categorical probability distribution:

p(v∣c)=exp⁡zv(c)∑u∈Vexp⁡zu(c).p(v\mid c)=\frac{\exp z_v(c)}{\sum_{u\in V}\exp z_u(c)}.

Notice the role of the partition function ∑u∈Vexp⁡zu(c)\sum_{u\in V}\exp z_u(c) in the denominator. If a teacher service returns only the top kk raw logits without returning either the full log-normalizer log⁡∑u∈Vexp⁡zu(c)\log \sum_{u\in V}\exp z_u(c) or pre-normalized log-probabilities, the student cannot recover the teacher's true vocabulary probabilities.

Every token probability p(v∣c)p(v\mid c) is strictly conditional on the exact prefix cc. Furthermore, computing a token-level divergence between a student pp and a teacher qq requires their tokenizers and vocabulary tables to match identically. If token ID 123 maps to different byte sequences in the two models, comparing p(123∣c)p(123\mid c) against q(123∣c)q(123\mid c) 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 xx denote the input prompt and

y=(y1,…,yT)y=(y_1,\ldots,y_T)

denote a generated response of length TT, where y<t=(y1,…,yt−1)y_{<t} = (y_1, \ldots, y_{t-1}) is the prefix before step tt (with y<1y_{<1} empty). By the chain rule of probability, a student policy parameterized by weights θ\theta assigns sequence probability

πθ(y∣x)=∏t=1Tπθ(yt∣x,y<t),\pi_\theta(y\mid x)=\prod_{t=1}^{T}\pi_\theta(y_t\mid x,y_{<t}),

which becomes a sum in log space:

log⁡πθ(y∣x)=∑t=1Tlog⁡πθ(yt∣x,y<t).\log\pi_\theta(y\mid x)=\sum_{t=1}^{T}\log\pi_\theta(y_t\mid x,y_{<t}).

Throughout the book, we abbreviate the context at step tt as ct=(x,y<t)c_t=(x,y_{<t}), the student's next-token distribution πθ(⋅∣ct)\pi_\theta(\cdot\mid c_t) as ptp_t, and the teacher's target distribution as qtq_t. All logarithms are natural (ln⁡\ln), so entropies and KL divergences are measured in nats.

For single-turn text generation, every token yty_t 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 θ\theta; 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 πθ(⋅∣c)\pi_\theta(\cdot\mid c) and the decoding rule used to generate rollouts are distinct mechanisms. Greedy decoding deterministically picks arg⁡max⁡vπθ(v∣c)\arg\max_v \pi_\theta(v\mid c), while temperature sampling rescales logits by τ>0\tau > 0 before applying softmax:

pτ(v∣c)=softmax⁡(z(c)/τ)v.p_\tau(v\mid c)=\operatorname{softmax}(z(c)/\tau)_v.

Nucleus (top-pp) or top-kk 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-pp/top-kk truncation, the behavior probability logged for each sampled token must reflect the actual sampling distribution used during generation.

Keep the two meanings of kk separate: top-kk decoding truncates which tokens a rollout worker is allowed to sample during generation, whereas top-kk distillation restricts how many teacher token probabilities are transmitted to the loss function during training. Using k=64k=64 in top-kk distillation does not imply truncating student generation to 64 tokens.

Teacher forcing as a parallel scoring pass

When a teacher evaluates a student rollout yy, it operates in teacher-forcing (or prefill) mode: at step tt, the teacher reads the exact student-generated prefix (x,y<t)(x, y_{<t}) as fixed input history and outputs its own next-token distribution qt(⋅∣x,y<t)q_t(\cdot\mid x, y_{<t}). It never overwrites y<ty_{<t} 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 y1,…,yTy_1, \ldots, y_T are already materialized before the teacher is called, a causal Transformer teacher can evaluate q1,…,qTq_1, \ldots, q_T across all TT positions in a single parallel prefill forward pass. Causal attention masks still prevent position tt from attending to tokens at ≥t\ge t, making teacher scoring vastly faster than autoregressive generation of a TT-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 t−1t-1 predicts target token tt. 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 ctc_t where the student is editing a function:

Continuation Student ptp_t Teacher qtq_t
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 qt(A)=0.10<pt(A)=0.50q_t(\text{A}) = 0.10 < p_t(\text{A}) = 0.50; this single-sample signal immediately pushes down the student's probability of A at position tt, while leaving the relative preference between B and C to be discovered on future visits. If we use distribution-level (or top-kk) distillation, the update at step tt simultaneously suppresses A, boosts B from 0.300.30 toward 0.700.70, and leaves C unchanged on that single forward pass.

Note that a high local teacher probability qt(v)q_t(v) means the teacher prefers token vv given prefix ctc_t, not that every continuation starting with vv 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 mt∈{0,1}m_t \in \{0, 1\} be a binary loss mask that equals 11 on assistant-generated decision tokens and 00 on prompts, environment observations, and padding. The sequence-normalized loss for a trajectory yy is

ℓ(y)=∑t=1Tmtℓt∑t=1Tmt,\ell(y)=\frac{\sum_{t=1}^T m_t\ell_t}{\sum_{t=1}^T m_t},

provided ∑t=1Tmt>0\sum_{t=1}^T m_t > 0. Normalizing per trajectory gives short and long responses equal weight in the batch gradient, whereas summing ∑tmtℓt\sum_t m_t \ell_t across the batch weights trajectories proportionally to their response length. Masking out environment observations (mt=0m_t = 0) 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:

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 y∗y^* for prompt xx, SFT minimizes the token-level cross-entropy loss:

LSFT=−∑t=1Tlog⁡πθ(yt∗∣x,y<t∗).\mathcal L_{\mathrm{SFT}}=-\sum_{t=1}^T\log\pi_\theta(y_t^*\mid x,y_{<t}^*).

Every token in the demonstration provides a direct gradient signal, making SFT fast and stable. However, the model is only supervised on prefixes y<t∗y_{<t}^* 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 θSFT\theta_{\mathrm{SFT}} 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 y∼πθ(⋅∣x)y \sim \pi_\theta(\cdot\mid x) from the current policy and scoring them with a task reward R(x,y)R(x, y):

J(θ)=Ex∼D, y∼πθ(⋅∣x)[R(x,y)].J(\theta)=\mathbb E_{x\sim\mathcal D,\,y\sim\pi_\theta(\cdot\mid x)}[R(x,y)].

Applying the log-derivative trick yields the score-function (REINFORCE) policy gradient:

∇θJ(θ)=Ex∼D, y∼πθ(⋅∣x)[R(x,y)∇θlog⁡πθ(y∣x)].\nabla_\theta J(\theta)=\mathbb E_{x\sim\mathcal D,\,y\sim\pi_\theta(\cdot\mid x)}\left[R(x,y)\nabla_\theta\log\pi_\theta(y\mid x)\right].

In practice, subtracting a context-dependent baseline b(x)b(x) from R(x,y)R(x, y) 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 R(x,y)R(x, y) at the end of a 10,00010{,}000-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:

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 NN rollouts {y(1),…,y(N)}\{y^{(1)}, \ldots, y^{(N)}\} for each prompt xx, scores each with the verifier to obtain rewards {R1,…,RN}\{R_1, \ldots, R_N\}, and computes a standardized within-group advantage:

Ai=Ri−Rˉstd⁡(R1,…,RN)+ϵ,A_i=\frac{R_i-\bar R}{\operatorname{std}(R_1,\ldots,R_N)+\epsilon},

where Rˉ\bar R and std⁡(R1,…,RN)\operatorname{std}(R_1, \ldots, R_N) are the sample mean and standard deviation across the NN rollouts for prompt xx. Rollouts that outperform their peers on the same prompt receive positive advantage (Ai>0A_i > 0), while worse rollouts receive negative advantage (Ai<0A_i < 0).

When a prompt is so easy that all NN rollouts pass (R1=⋯=RN=1R_1 = \cdots = R_N = 1) or so hard that all NN fail (R1=⋯=RN=0R_1 = \cdots = R_N = 0), the group standard deviation vanishes and Ai=0A_i = 0 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 N=8N=8 rollouts per prompt and Dynamic Sampling enabled, whereas the subsequent MT-MOPD distillation stage generates just one rollout per prompt (N=1N=1) 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:

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 θ\theta is updated on two domain losses La(θ)\mathcal L_a(\theta) and Lb(θ)\mathcal L_b(\theta) with gradients ga=∇θLa(θ)g_a = \nabla_\theta \mathcal L_a(\theta) and gb=∇θLb(θ)g_b = \nabla_\theta \mathcal L_b(\theta), a gradient step Δθ=−ηga\Delta \theta = -\eta g_a on domain aa changes domain bb's loss to first order by

ΔLb≈gb⊤Δθ=−η gb⊤ga.\Delta\mathcal L_b \approx g_b^\top \Delta\theta = -\eta\, g_b^\top g_a.

Whenever the inner product gb⊤ga<0g_b^\top g_a < 0, the two gradients point in conflicting half-spaces, and stepping to improve domain aa directly degrades domain bb. 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:

  1. Mix-RL: Pools prompts and verifiers from all domains into a single joint GRPO training run on one model.
  2. 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).
  3. 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.
  4. 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 dπ,t(c)d_{\pi,t}(c) denote the distribution of contexts reached at generation step tt when policy π\pi rolls out responses. A corpus of teacher trajectories samples contexts from dq,td_{q,t}, while deploying the student exposes it to contexts drawn from dπθ,td_{\pi_\theta,t}.

An offline distillation objective evaluates the divergence over teacher contexts:

Ec∼dq[D(q(⋅∣c)∥πθ(⋅∣c))].\mathbb E_{c\sim d_q}[D(q(\cdot\mid c)\|\pi_\theta(\cdot\mid c))].

An on-policy local objective shifts the outer expectation to the student's state distribution, and typically reverses the divergence direction as well:

Ec∼dπθ[D(πθ(⋅∣c)∥q(⋅∣c))].\mathbb E_{c\sim d_{\pi_\theta}}[D(\pi_\theta(\cdot\mid c)\|q(\cdot\mid c))].

Notice that the context distribution (dqd_q vs. dπθd_{\pi_\theta}) 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 dπθd_{\pi_\theta} 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 TT-step generation process where the student has a constant per-step probability ϵ\epsilon of stepping off the teacher's preferred path, independent steps would leave a (1−ϵ)T(1-\epsilon)^T chance of staying on track. Even at ϵ=0.01\epsilon=0.01 over T=100T=100 tokens, (1−0.01)100≈0.366(1-0.01)^{100} \approx 0.366.

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 dπθd_{\pi_\theta} 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:

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:

  1. Sample a task prompt (and its domain label, if routing across specialists).
  2. Roll out a complete response from the student under its current policy πθ\pi_\theta.
  3. Pass the prompt and student-generated response to the teacher for causal scoring.
  4. Compute the token-level divergence between the student and teacher distributions at all valid response positions.
  5. Backpropagate the loss to update θ\theta, 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 πθ\pi_\theta 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 log⁡q(yt∣x,y<t)\log q(y_t \mid x, y_{<t}) 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, pp denotes the student's next-token distribution and qq denotes the teacher's next-token distribution at a fixed context cc, defined over a common vocabulary VV with natural logarithms.

Forward KL

The forward (teacher-to-student) Kullback–Leibler divergence weights log-ratios by the teacher's probabilities:

DKL(q∥p)=∑vqvlog⁡qvpv.D_{\mathrm{KL}}(q\|p)=\sum_v q_v\log\frac{q_v}{p_v}.

Because the teacher distribution qq does not depend on the student parameters θ\theta, minimizing DKL(q∥p)D_{\mathrm{KL}}(q\|p) with respect to θ\theta is identical to minimizing the teacher-weighted cross-entropy:

−∑vqvlog⁡pv.-\sum_v q_v\log p_v.

Whenever the teacher places noticeable mass on a token vv (qv>0q_v > 0) and the student assigns it nearly zero probability (pv→0p_v \to 0), the −log⁡pv-\log p_v 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 qq exactly, forward KL pushes pp to bridge across the teacher's modes rather than dropping one. If the student's output layer can represent any categorical distribution over VV and optimization is unconstrained, the unique global minimum of both forward and reverse KL is simply p=qp = q.

Reverse KL

The reverse (student-to-teacher) KL divergence weights the log-ratio by the student's probabilities:

DKL(p∥q)=∑vpvlog⁡pvqv.D_{\mathrm{KL}}(p\|q)=\sum_v p_v\log\frac{p_v}{q_v}.

Here the expectation is taken under pp. If the student puts significant probability mass on a token that the teacher considers virtually impossible (qv→0q_v \to 0), log⁡(pv/qv)\log(p_v/q_v) becomes huge and the student is sharply penalized. Conversely, if the student assigns near-zero probability to a token the teacher likes, the product pvlog⁡(pv/qv)p_v \log(p_v/q_v) approaches zero, and a sampled-token estimator under pp will rarely even visit vv to observe the discrepancy.

Expanding the log-ratio makes the role of student entropy explicit:

DKL(p∥q)=−H(p)−Ev∼p[log⁡qv],D_{\mathrm{KL}}(p\|q)=-H(p)-\mathbb E_{v\sim p}[\log q_v],

where H(p)=−∑vpvlog⁡pvH(p)=-\sum_v p_v\log p_v 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 log⁡qv\log q_v while maintaining its own entropy H(p)H(p) 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 qq 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:

p=(0.9,0.1),q=(0.5,0.5).p=(0.9,0.1),\qquad q=(0.5,0.5).

The reverse KL evaluates to

DKL(p∥q)=0.9log⁡0.90.5+0.1log⁡0.10.5=0.9log⁡1.8+0.1log⁡0.2≈0.3681,D_{\mathrm{KL}}(p\|q) = 0.9\log\frac{0.9}{0.5}+0.1\log\frac{0.1}{0.5} = 0.9\log 1.8+0.1\log 0.2 \approx 0.3681,

whereas the forward KL is larger because it weights the under-covered second token by q2=0.5q_2 = 0.5 instead of p2=0.1p_2 = 0.1:

DKL(q∥p)=0.5log⁡0.50.9+0.5log⁡0.50.1=0.5log⁡(5/9)+0.5log⁡5≈0.5108.D_{\mathrm{KL}}(q\|p) = 0.5\log\frac{0.5}{0.9}+0.5\log\frac{0.5}{0.1} = 0.5\log(5/9)+0.5\log 5 \approx 0.5108.

If we train with a sampled-token estimator that draws v∼pv \sim p and uses the log-ratio log⁡(qv/pv)\log(q_v/p_v) as a policy-gradient advantage:

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, DKL(p∥q)=∞D_{\mathrm{KL}}(p\|q) = \infty whenever qv=0q_v = 0 and pv>0p_v > 0, while DKL(q∥p)=∞D_{\mathrm{KL}}(q\|p) = \infty whenever pv=0p_v = 0 and qv>0q_v > 0. 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:

  1. Floating-point underflow in fp16 or bf16 when exponentiating large negative logits.
  2. Hard vocabulary masks or mismatched special-token IDs between models.
  3. Top-kk or top-pp 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-kk 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 (log⁡pv−log⁡qv\log p_v - \log q_v) avoids exponentiation underflow altogether.

Jensen–Shannon divergence

Defining the midpoint mixture distribution m=12(p+q)m = \frac{1}{2}(p+q), the Jensen–Shannon (JS) divergence averages the KL from each distribution to mm:

DJS(p,q)=12DKL(p∥m)+12DKL(q∥m).D_{\mathrm{JS}}(p,q)=\frac12D_{\mathrm{KL}}(p\|m)+\frac12D_{\mathrm{KL}}(q\|m).

JS divergence is symmetric, bounded between 00 and log⁡2\log 2 for normalized distributions, and remains finite even when pp and qq have completely disjoint support. That boundedness softens gradient spikes when a student and teacher strongly disagree on tail tokens.

When differentiating DJS(pθ,q)D_{\mathrm{JS}}(p_\theta, q) with respect to θ\theta, note that m=12(pθ+q)m = \frac{1}{2}(p_\theta + q) also depends on pθp_\theta. Exact automatic differentiation propagates gradients through both appearances of pθp_\theta (yielding 12∑v∇θpvlog⁡(pv/mv)\frac{1}{2}\sum_v \nabla_\theta p_v \log(p_v / m_v)), whereas detaching mm 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-kk sum).

Temperature scaling changes the target

Dividing logits by a temperature τ\tau before the softmax reshapes the target distribution: τ>1\tau > 1 flattens the distribution and exposes dark knowledge in lower-ranked tokens, whereas τ<1\tau < 1 sharpens mass onto the top candidates. Because changing τ\tau alters the target distribution qτq_\tau, three temperatures need to be kept distinct when reading or reproducing distillation experiments:

Divergence, task accuracy, and diversity measure different things

Driving DKL(p∥q)D_{\mathrm{KL}}(p\|q) 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:

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 θ0\theta_0. 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 θ0\theta_0. 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, θ0\theta_0 is a custom SFT checkpoint trained on top of Qwen3-30B-A3B-Base.

Stage 2: Train domain specialists independently

Let d∈{1,…,D}d\in\{1,\ldots,D\} index the target domains. Starting from θ0\theta_0, each domain team runs an independent reinforcement learning pipeline to produce specialist weights ϕd\phi_d:

ϕd=RL⁡d(θ0;Dd,Rd,reciped).\phi_d=\operatorname{RL}_d(\theta_0;\mathcal D_d,R_d,\text{recipe}_d).

Each specialist run uses its own prompt dataset Dd\mathcal D_d, reward verifier RdR_d, rollout horizon, and RL hyperparameters. In the paper's controlled 30B study, D=3D=3 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 ϕ1,…,ϕD\phi_1, \dots, \phi_D are ready, their weights are frozen and deployed as inference-only scoring services. A single student model πθ\pi_\theta is initialized at θ0\theta_0 and trained on a mixed stream of prompts drawn from all domains.

For each prompt xx, the student generates an on-policy trajectory y∼πθ(⋅∣x)y \sim \pi_\theta(\cdot\mid x). The prompt's domain tag d(x)d(x) routes the completed trajectory (x, y) to the matching specialist teacher ϕd(x)\phi_{d(x)}, 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 θ\theta is served.

Prompt-level routing vs. token-level ensembling

In MT-MOPD, every training prompt xx carries a known domain label d(x)d(x) from its source dataset, so the teacher target at step tt is simply the distribution of that domain's specialist:

qd(x)(⋅∣x,y<t).q_{d(x)}(\cdot\mid x,y_{<t}).

Notice what this routing mechanism does not do:

Routing by prompt dataset keeps prefill compute at 1×1\times teacher forward pass per student rollout rather than D×D\times, 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 ϕd\phi_d are frozen throughout an integration round, the supervision targets qd(x)(⋅∣x,y<t)q_{d(x)}(\cdot\mid x, y_{<t}) change continuously as the student evolves. Early in integration, the student visits clumsy prefixes y<ty_{<t}, and the teacher provides corrective next-token distributions from those states. As πθ\pi_\theta 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:

  1. Sample and rollout: Draw a mixed-domain batch of prompts, recording each prompt's text, domain ID d(x)d(x), generated token IDs yy, loss mask (masking out prompt tokens and injected environment outputs), and behavior-policy log-probabilities.
  2. Route and score: Dispatch each trajectory (x, y) to the prefill service hosting teacher ϕd(x)\phi_{d(x)} using the exact same tokenizer and chat template, and return either the teacher's log-probability on the sampled tokens yty_t or its top-kk logits at each position.
  3. 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-kk 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:

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 θ\theta 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 xx be a prompt with domain label d(x)d(x), and let y=(y1,…,yT)∼πθ(⋅∣x)y=(y_1,\dots,y_T)\sim\pi_\theta(\cdot\mid x) be a trajectory generated by the student. Writing the conditional next-token distributions at prefix ct=(x,y<t)c_t = (x, y_{<t}) as

pt(v)=πθ(v∣x,y<t),qt(v)=πϕd(x)(v∣x,y<t),p_t(v)=\pi_\theta(v\mid x,y_{<t}),\qquad q_t(v)=\pi_{\phi_{d(x)}}(v\mid x,y_{<t}),

MT-MOPD states its training objective (Equation 1) as the expected per-token reverse KL across student rollouts:

L(θ)=Ex,y∼πθ[1T∑t=1T∑v∈Vpt(v)log⁡pt(v)qt(v)].\mathcal L(\theta)=\mathbb E_{x,y\sim\pi_\theta} \left[\frac1T\sum_{t=1}^{T} \sum_{v\in V}p_t(v)\log\frac{p_t(v)}{q_t(v)}\right].

Here the inner sum over VV evaluates the exact categorical reverse KL at prefix ctc_t, the sum over t=1,…,Tt=1,\dots,T averages across the response length, and the outer expectation samples trajectories from the current student policy πθ\pi_\theta. Although the teacher parameters ϕd(x)\phi_{d(x)} are frozen, qt(v)q_t(v) still varies from rollout to rollout because it conditions on the student's prefix y<ty_{<t}.

Differentiating reverse KL at a fixed context

Hold a single visited context cc fixed and consider the local reverse KL as a function of θ\theta:

K(θ;c)=∑v∈Vpθ(v∣c)log⁡pθ(v∣c)q(v∣c).K(\theta;c)=\sum_{v\in V} p_\theta(v\mid c)\log\frac{p_\theta(v\mid c)}{q(v\mid c)}.

Applying the product rule with respect to θ\theta while holding cc and q(⋅∣c)q(\cdot\mid c) constant gives

∇θK(θ;c)=∑v∈V∇θpv(log⁡pvqv+1).\nabla_\theta K(\theta;c)=\sum_{v\in V}\nabla_\theta p_v\left(\log\frac{p_v}{q_v}+1\right).

Because pθ(⋅∣c)p_\theta(\cdot\mid c) is a normalized probability distribution over VV, the sum of its probability gradients vanishes:

∑v∈V∇θpv=∇θ∑v∈Vpv=∇θ1=0.\sum_{v\in V}\nabla_\theta p_v=\nabla_\theta \sum_{v\in V} p_v = \nabla_\theta 1=0.

Dropping the +1+1 term and applying the log-derivative identity ∇θpv=pv∇θlog⁡pv\nabla_\theta p_v = p_v\nabla_\theta\log p_v yields the score-function form of the local reverse-KL gradient:

∇θK(θ;c)=Ev∼pθ(⋅∣c)[log⁡pvqv∇θlog⁡pv]=−Ev∼pθ(⋅∣c)[log⁡qvpv∇θlog⁡pv].\nabla_\theta K(\theta;c)=\mathbb E_{v\sim p_\theta(\cdot\mid c)} \left[\log\frac{p_v}{q_v}\nabla_\theta\log p_v\right] = -\mathbb E_{v\sim p_\theta(\cdot\mid c)} \left[\log\frac{q_v}{p_v}\nabla_\theta\log p_v\right].

Sampling the actual next token yt∼pθ(⋅∣ct)y_t \sim p_\theta(\cdot\mid c_t) during the student rollout therefore provides a single-sample Monte Carlo estimate of ∇θK(θ;ct)\nabla_\theta K(\theta;c_t).

The log-probability ratio as a token-level advantage

MT-MOPD defines the reverse-KL log-ratio as a token-level advantage signal:

A(v;c)=log⁡q(v∣c)−log⁡p(v∣c).A(v;c)=\log q(v\mid c)-\log p(v\mid c).

With this definition, the local gradient becomes −Ev∼p[A(v;c)∇θlog⁡pv]-\mathbb E_{v\sim p}[A(v;c)\nabla_\theta \log p_v], matching the form of a policy-gradient update:

Notice that A(v;c)A(v;c) is an immediate conditional log-likelihood difference, not a cumulative return-to-go over future steps. In addition, subtracting any context-only baseline b(c)b(c) leaves the unclipped expectation unchanged because Ev∼p[∇θlog⁡pv]=0\mathbb E_{v\sim p}[\nabla_\theta \log p_v] = 0.

Why stop_gradient is required in the surrogate loss

To implement this update with standard automatic differentiation, we form the per-token surrogate loss

ℓsur(θ;v,c)=−sg⁡[A(v;c)] log⁡pθ(v∣c),\ell_{\mathrm{sur}}(\theta; v, c)=-\operatorname{sg}[A(v;c)]\,\log p_\theta(v\mid c),

where sg⁡[⋅]\operatorname{sg}[\cdot] detaches the advantage from the computation graph. Differentiating ℓsur\ell_{\mathrm{sur}} produces −A(v;c)∇θlog⁡pθ(v∣c)-A(v;c)\nabla_\theta\log p_\theta(v\mid c), whose expectation over v∼pθv\sim p_\theta equals ∇θK(θ;c)\nabla_\theta K(\theta;c).

If you omit sg⁡[⋅]\operatorname{sg}[\cdot] and allow gradients to flow through the −log⁡pθ(v∣c)-\log p_\theta(v\mid c) term inside A(v;c)A(v;c), differentiation introduces an extra +∇θlog⁡pθ(v∣c)+\nabla_\theta\log p_\theta(v\mid c) 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 ℓsur\ell_{\mathrm{sur}} is not the KL divergence itself—it can be positive or negative and should not be logged as a proxy for DKL(p∥q)D_{\mathrm{KL}}(p\|q).

Local semi-gradients vs. full trajectory-distribution gradients

Now return to the outer expectation over student trajectories y∼πθ(⋅∣x)y \sim \pi_\theta(\cdot\mid x) in Equation 1. Let

fθ(y)=1T∑t=1TK(θ;ct(y))f_\theta(y)=\frac1T\sum_{t=1}^T K(\theta;c_t(y))

denote the trajectory-averaged local KL. Because both the integrand fθ(y)f_\theta(y) and the sampling distribution πθ(y∣x)\pi_\theta(y\mid x) depend on θ\theta, the exact gradient of Ey∼πθ[fθ(y)]\mathbb E_{y\sim\pi_\theta}[f_\theta(y)] has two parts:

∇θEy∼πθ[fθ(y)]=Ey∼πθ[∇θfθ(y)+fθ(y)∇θlog⁡πθ(y∣x)].\nabla_\theta\mathbb E_{y\sim\pi_\theta}[f_\theta(y)] =\mathbb E_{y\sim\pi_\theta}\left[\nabla_\theta f_\theta(y) +f_\theta(y)\nabla_\theta\log\pi_\theta(y\mid x)\right].
  1. The local step-wise term Ey[∇θfθ(y)]\mathbb E_y[\nabla_\theta f_\theta(y)] differentiates the token-level KL at each visited prefix ct(y)c_t(y) while treating the trajectory prefixes themselves as fixed.
  2. The state-occupancy term Ey[fθ(y)∇θlog⁡πθ(y∣x)]\mathbb E_y[f_\theta(y)\nabla_\theta\log\pi_\theta(y\mid x)] accounts for how changing an early token probability πθ(yt∣ct)\pi_\theta(y_t\mid c_t) shifts the probability of reaching downstream states ct′c_{t'} (t′>tt' > t) 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 y∼πθy \sim \pi_\theta, treats the visited prefixes c1,…,cTc_1,\dots,c_T as fixed contexts, and applies the token-wise score-function update −A(yt;ct)∇θlog⁡pθ(yt∣ct)-A(y_t;c_t)\nabla_\theta\log p_\theta(y_t\mid c_t) at each position tt 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:

DKL(Pθ(Y∣x) ∥ Q(Y∣x))=EY∼Pθ(⋅∣x)[∑t=1Tlog⁡pθ(Yt∣ct)q(Yt∣ct)].D_{\mathrm{KL}}\big(P_\theta(Y\mid x)\,\big\|\,Q(Y\mid x)\big) =\mathbb E_{Y\sim P_\theta(\cdot\mid x)} \left[\sum_{t=1}^T \log\frac{p_\theta(Y_t\mid c_t)}{q(Y_t\mid c_t)}\right].

By the chain rule of KL divergence, the scalar value of this sequence KL equals the sum of expected step-wise conditional KLs: ∑t=1TEct[K(θ;ct)]\sum_{t=1}^T \mathbb E_{c_t}[K(\theta;c_t)]. However, its exact policy gradient at step tt weights ∇θlog⁡pθ(Yt∣ct)\nabla_\theta\log p_\theta(Y_t\mid c_t) by the cumulative future log-ratio (reward-to-go) ∑t′=tTlog⁡pθ(Yt′∣ct′)q(Yt′∣ct′)\sum_{t'=t}^T \log\frac{p_\theta(Y_{t'}\mid c_{t'})}{q(Y_{t'}\mid c_{t'})}, rather than only the immediate step-tt log-ratio.

A two-step branching example makes the difference concrete: suppose at t=1t=1 the student chooses between branch A and branch B, and on this first token p1p_1 already matches q1q_1 closely on both branches (A1≈0A_1 \approx 0). However, entering branch A leads to a state at t=2t=2 where the student and teacher strongly disagree (K(θ;c2A)≫0K(\theta; c_2^A) \gg 0), whereas branch B leads to a state where they agree (K(θ;c2B)=0K(\theta; c_2^B) = 0).

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 y1,…,yTy_1, \dots, y_T, 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 ct=(x,y<t)c_t = (x, y_{<t}) and sampled token yty_t, three models enter the calculation:

  1. pb(yt∣ct)p_b(y_t\mid c_t): the behavior student snapshot that generated the rollout.
  2. pθ(yt∣ct)p_\theta(y_t\mid c_t): the current student weights on the trainer node receiving the gradient update.
  3. qd(yt∣ct)q_d(y_t\mid c_t): the routed domain teacher ϕd(x)\phi_{d(x)}.

In a strictly synchronous, single-update loop, pbp_b and the pre-update pθp_\theta 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, pθp_\theta drifts away from pbp_b. Logging and storing log⁡pb(yt∣ct)\log p_b(y_t\mid c_t) at rollout time makes any policy lag explicit and enables importance-sampling diagnostics.

The immediate reverse-KL token advantage is

At=sg⁡[log⁡qd(yt∣ct)−log⁡p(yt∣ct)],A_t=\operatorname{sg}[\log q_d(y_t\mid c_t)-\log p(y_t\mid c_t)],

where log⁡p(yt∣ct)\log p(y_t\mid c_t) 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 AtA_t can spike to large magnitudes. To prevent single-token outliers from destabilizing the optimizer, MT-MOPD clips the advantage symmetrically:

Aˉt=clip⁡(At,−Amax⁡,Amax⁡),\bar A_t=\operatorname{clip}(A_t,-A_{\max},A_{\max}),

and minimizes the trajectory-averaged surrogate loss

LPG(θ)=−1T∑t=1TAˉtlog⁡pθ(yt∣ct).\mathcal L_{\mathrm{PG}}(\theta) =-\frac1T\sum_{t=1}^T \bar A_t\log p_\theta(y_t\mid c_t).

In Appendix A, MT-MOPD sets Amax⁡=5.0A_{\max} = 5.0, which caps the effective probability ratio qd/pq_d/p at e5≈148.4e^5 \approx 148.4 (and e−5≈0.00674e^{-5} \approx 0.00674 on the negative side).

Note that advantage clipping on log⁡(qd/p)\log(q_d/p) is distinct from PPO probability-ratio clipping on pθ/pbp_\theta / p_b:

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 −Aˉtlog⁡pθ(yt∣ct)-\bar A_t \log p_\theta(y_t\mid c_t) scales the score function ∇θlog⁡pθ(yt∣ct)\nabla_\theta \log p_\theta(y_t\mid c_t) by Aˉt\bar A_t. Because the vocabulary probabilities are coupled through the softmax normalizer, raising the logit of yty_t when Aˉt>0\bar A_t > 0 slightly lowers the probabilities of competing tokens, whereas pushing down the logit of yty_t when Aˉt<0\bar A_t < 0 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 p(yt∣ct)p(y_t\mid c_t) Teacher qd(yt∣ct)q_d(y_t\mid c_t) Unclipped advantage AtA_t Effect of update
Routine boilerplate syntax 0.600.60 0.660.66 log⁡1.1≈+0.0953\log 1.1 \approx +0.0953 Mild reinforcement
Useful boundary check 0.050.05 0.200.20 log⁡4.0≈+1.3863\log 4.0 \approx +1.3863 Strong positive pull
Buggy variable shadowing 0.400.40 0.020.02 log⁡0.05≈−2.9957\log 0.05 \approx -2.9957 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 rt(θ)=exp⁡(log⁡pθ(yt∣ct)−log⁡pb(yt∣ct))r_t(\theta) = \exp(\log p_\theta(y_t\mid c_t) - \log p_b(y_t\mid c_t)) (with optional PPO clipping on rtr_t), while recomputing the reverse-KL advantage against sg⁡[log⁡pθ]\operatorname{sg}[\log p_\theta].

Always transmit normalized log-probabilities, never raw logits

A common implementation bug when adapting inference servers for distillation is returning raw pre-softmax logits zytteacherz^{\text{teacher}}_{y_t} instead of normalized log-probabilities log⁡qd(yt∣ct)\log q_d(y_t\mid c_t). Because adding an arbitrary context-dependent constant C(ct)C(c_t) to every logit leaves the softmax distribution unchanged, raw logit differences zytteacher−zytstudentz^{\text{teacher}}_{y_t} - z^{\text{student}}_{y_t} are contaminated by the mismatch between the two models' log-partition functions log⁡∑vexp⁡(zv)\log \sum_v \exp(z_v).

The teacher prefill endpoint must therefore compute the full-vocabulary log_softmax at each position tt before gathering the scalar entry corresponding to the student's sampled token ID yty_t.

Loss masking and sequence length normalization

Only tokens actively sampled by the student policy should contribute to LPG\mathcal L_{\mathrm{PG}}. The binary actor_mask must zero out:

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 πθ\pi_\theta, 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 TT active tokens within each trajectory first (1T∑t=1T\frac{1}{T}\sum_{t=1}^T), 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 LPG=−1T∑tAˉtlog⁡pθ(yt∣ct)\mathcal L_{\mathrm{PG}} = -\frac{1}{T}\sum_t \bar A_t \log p_\theta(y_t\mid c_t) 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:

Sources: The sampled-token advantage, clipping threshold (Amax⁡=5A_{\max}=5), 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-kk 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 +1+1 terms in the derivative ∂∂pv(pvlog⁡(pv/qv))=log⁡(pv/qv)+1\frac{\partial}{\partial p_v}(p_v \log(p_v/q_v)) = \log(p_v/q_v) + 1 cancel out because ∑v∈Vpv=1\sum_{v \in V} p_v = 1 is fixed. Over an unnormalized subset S⊂VS \subset V, the partial sum ∑v∈Spv\sum_{v \in S} p_v is free to shrink, so a naive partial KL sum actively pushes student probability mass out of the top-kk set and into the unscored tail. MT-MOPD adds a linear Bregman correction term to restore the minimum to pv=qvp_v = q_v on every scored coordinate.

The tail-corrected top-kk objective

At a fixed prefix, let S=TopK⁡k(q)S = \operatorname{TopK}_k(q) denote the indices of the kk largest probabilities under the teacher distribution qq (with k=64k = 64 in MT-MOPD's experiments). Using the full-vocabulary normalized probabilities pvp_v and qvq_v (without renormalizing them over SS), MT-MOPD defines the corrected sparse reverse-KL loss (Equation 5) as

LS(p,q)=∑v∈S[pvlog⁡pvqv−pv+qv].L_S(p,q)=\sum_{v\in S} \left[p_v\log\frac{p_v}{q_v}-p_v+q_v\right].

Each summand is the scalar Bregman divergence generated by the negative entropy function ϕ(u)=ulog⁡u−u\phi(u) = u \log u - u, which is nonnegative everywhere and vanishes if and only if pv=qvp_v = q_v.

Why naive partial reverse KL fails

To see what goes wrong without the −pv+qv-p_v + q_v correction, consider the naive truncated sum:

Lnaive(p,q)=∑v∈Spvlog⁡pvqv.L_{\mathrm{naive}}(p,q)=\sum_{v\in S}p_v\log\frac{p_v}{q_v}.

Differentiating with respect to a single selected probability pvp_v (v∈Sv \in S) while allowing the remaining mass 1−∑u∈Spu1 - \sum_{u \in S} p_u to flow into unscored tail tokens V∖SV \setminus S yields

∂Lnaive∂pv=log⁡pvqv+1.\frac{\partial L_{\mathrm{naive}}}{\partial p_v} =\log\frac{p_v}{q_v}+1.

Setting this derivative to zero puts the stationary point at

pv=qve≈0.3679 qv,p_v = \frac{q_v}{e} \approx 0.3679\, q_v,

rather than pv=qvp_v = q_v!

For a concrete two-token example, suppose q=(0.8,0.2)q = (0.8, 0.2) and we score only the top-11 token S={1}S = \{1\}:

Minimizing LnaiveL_{\mathrm{naive}} therefore drains student probability mass out of the teacher's top-kk tokens and hides it in the unscored tail so that pvlog⁡(pv/qv)p_v \log(p_v/q_v) becomes negative. Whenever a training log shows a negative "top-kk KL loss," the code is computing LnaiveL_{\mathrm{naive}} without the normalization correction.

How the −pv+qv-p_v + q_v correction fixes the optimum

Adding −pv+qv-p_v + q_v to each coordinate gives the corrected summand

f(pv,qv)=pvlog⁡pvqv−pv+qv.f(p_v,q_v)=p_v\log\frac{p_v}{q_v}-p_v+q_v.

Now the first and second partial derivatives with respect to pvp_v are

∂f∂pv=log⁡pvqv,∂2f∂pv2=1pv>0.\frac{\partial f}{\partial p_v}=\log\frac{p_v}{q_v},\qquad \frac{\partial^2 f}{\partial p_v^2}=\frac{1}{p_v}>0.

The +1+1 bias vanishes, f(pv,qv)f(p_v, q_v) is strictly convex in pv>0p_v > 0, and its unique minimum occurs at pv=qvp_v = q_v where f(qv,qv)=0f(q_v, q_v) = 0. Writing r=pv/qv>0r = p_v / q_v > 0 makes nonnegativity immediate:

f(pv,qv)=qv(rlog⁡r−r+1)≥0,f(p_v,q_v)=q_v(r\log r-r+1)\ge 0,

since rlog⁡r−r+1≥0r\log r - r + 1 \ge 0 for all r>0r > 0 with equality only at r=1r = 1. In our two-token example with q1=0.8q_1 = 0.8, evaluating the corrected loss at the naive optimum p1=0.2943p_1 = 0.2943 now yields f(0.2943,0.8)≈−0.2943−0.2943+0.8=+0.2114>0f(0.2943, 0.8) \approx -0.2943 - 0.2943 + 0.8 = +0.2114 > 0, penalizing the mass evacuation and pulling p1p_1 back to 0.80.8.

What the sparse loss still leaves unobserved in the tail

Restoring the coordinate-wise optimum on SS does not make LS(p,q)L_S(p,q) an unbiased estimator of the full-vocabulary reverse KL. Any redistribution of student probability mass among the unscored tail tokens V∖SV \setminus S is invisible to LSL_S as long as the total tail mass 1−∑v∈Spv1 - \sum_{v \in S} p_v stays fixed.

For instance, in a three-token vocabulary with k=1k=1 (S={1}S=\{1\}) and distributions

q=(0.7,0.2,0.1),p=(0.7,0.1,0.2),q=(0.7,0.2,0.1),\qquad p=(0.7,0.1,0.2),

the corrected top-11 loss is identically zero (L{1}(p,q)=0L_{\{1\}}(p,q) = 0) because p1=q1=0.7p_1 = q_1 = 0.7, even though pp and qq have swapped probabilities on tokens 2 and 3 (where the full reverse KL is 0.1log⁡0.5+0.2log⁡2≈0.06930.1\log 0.5 + 0.2\log 2 \approx 0.0693). When S=VS = V, ∑v∈Vpv=∑v∈Vqv=1\sum_{v \in V} p_v = \sum_{v \in V} q_v = 1, and LV(p,q)L_V(p,q) reduces back to the exact full-vocabulary reverse KL DKL(p∥q)D_{\mathrm{KL}}(p\|q).

Exact logit gradients through the full student softmax

Even though LSL_S only sums over v∈Sv \in S, the student probabilities p=softmax⁡(z)p = \operatorname{softmax}(z) are normalized over the entire vocabulary VV. Defining the active log-ratio vector

av=1[v∈S]log⁡pvqv,a_v=\mathbf 1[v\in S]\log\frac{p_v}{q_v},

applying the Jacobian of the full softmax ∂pv∂zj=pv(1[v=j]−pj)\frac{\partial p_v}{\partial z_j} = p_v(\mathbf 1[v=j] - p_j) to ∂LS∂pv=av\frac{\partial L_S}{\partial p_v} = a_v yields the gradient with respect to any student logit zjz_j (j∈Vj \in V):

∂LS∂zj=∑v∈V∂LS∂pv∂pv∂zj=pj(aj−∑v∈Spvav).\frac{\partial L_S}{\partial z_j} =\sum_{v\in V} \frac{\partial L_S}{\partial p_v}\frac{\partial p_v}{\partial z_j} =p_j\left(a_j-\sum_{v\in S}p_v a_v\right).

Notice that for an unselected tail token j∉Sj \notin S, aj=0a_j = 0, so its logit still receives a non-zero gradient:

∂LS∂zj=−pj∑v∈Spvlog⁡pvqv(j∉S).\frac{\partial L_S}{\partial z_j} = -p_j\sum_{v\in S} p_v\log\frac{p_v}{q_v}\qquad (j\notin S).

This coupling through the full softmax normalizer is why you must compute log_softmax over all ∣V∣|V| student logits before gathering the kk indices in SS, rather than slicing the kk logits first and running a kk-way softmax over SS.

Numerically stable implementation

Given the teacher's top-kk 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

LS=∑v∈S[exp⁡(log⁡pv)(log⁡pv−log⁡qv)−exp⁡(log⁡pv)+exp⁡(log⁡qv)].L_S = \sum_{v\in S}\Big[\exp(\log p_v)(\log p_v - \log q_v) - \exp(\log p_v) + \exp(\log q_v)\Big].

Although exp⁡(log⁡qv)\exp(\log q_v) has zero gradient with respect to θ\theta, keeping it in the forward pass ensures LS≥0L_S \ge 0 with LS=0L_S = 0 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 yt∉TopK⁡k(q)y_t \notin \operatorname{TopK}_k(q), yty_t is not included in SS unless you explicitly append yty_t to the teacher's query payload. Pure top-kk distillation evaluates the student on the teacher's kk favored continuations at prefix ctc_t regardless of which token yty_t was sampled to advance the prefix to ct+1c_{t+1}.

Bandwidth vs. empirical performance

At k=64k = 64 using 32-bit token IDs and 32-bit log-probabilities, the teacher payload is 64×(4+4)=51264 \times (4 + 4) = 512 bytes per token position—roughly a 1,170×1{,}170\times reduction compared with transmitting a 150,000-token fp32 distribution (600 KB600\text{ KB} per position), though still 64×64\times 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 k=64k=64 top-kk distillation (0.93730.9373 vs. 0.90930.9093 normalized score), and when paired with an out-of-distribution external math teacher (Qwen3-235B-A22B), the k=64k=64 top-kk loss suffers severe optimization collapse (−1.1898-1.1898 normalized score vs. 0.60030.6003 for policy gradient), a phenomenon we analyze in Chapter 11.

Sources: The corrected top-kk reverse-KL objective and k=64k=64 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 wdw_d denote the probability of drawing a training prompt from domain d∈{1,…,D}d \in \{1,\dots,D\} with prompt distribution Dd\mathcal D_d. The multi-domain integration objective is the mixture-weighted expectation

L(θ)=∑d=1Dwd Ex∼Dd, y∼πθ(⋅∣x)[1T∑t=1TDKL(pt(⋅) ∥ qd,t(⋅))].\mathcal L(\theta)=\sum_{d=1}^D w_d\,\mathbb E_{x\sim\mathcal D_d,\,y\sim\pi_\theta(\cdot\mid x)} \left[\frac1T\sum_{t=1}^T D_{\mathrm{KL}}\big(p_t(\cdot)\,\big\|\,q_{d,t}(\cdot)\big)\right].

In MT-MOPD's controlled three-domain study, the training prompt mixture is set to wmath=0.35w_{\text{math}} = 0.35, wIF=0.35w_{\text{IF}} = 0.35, and wSWE=0.30w_{\text{SWE}} = 0.30, while the aggregate evaluation metric weights the three domains equally (13\frac{1}{3} each).

Keep in mind that prompt sampling proportions wdw_d do not equal compute proportions:

Why prompt routing differs from averaging teacher distributions

Because every prompt xx in the training mixture comes from a known domain dataset, the target distribution at token tt is simply the single specialist qd(x)(⋅∣x,y<t)q_{d(x)}(\cdot\mid x, y_{<t}). 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 πθ\pi_\theta to condition its behavior on the task type.

Contrast this with an ensemble distillation scheme that queries all DD teachers on the same context cc and minimizes a weighted sum of reverse KLs simultaneously:

∑d=1DwdDKL(p(⋅∣c) ∥ qd(⋅∣c)).\sum_{d=1}^D w_d D_{\mathrm{KL}}\big(p(\cdot\mid c)\,\big\|\,q_d(\cdot\mid c)\big).

Expanding ∑vpvlog⁡pv−∑vpv∑dwdlog⁡qd(v)\sum_v p_v \log p_v - \sum_v p_v \sum_d w_d \log q_d(v) and solving with a Lagrange multiplier for ∑vpv=1\sum_v p_v = 1 shows that the unconstrained minimizer of a weighted reverse-KL sum is the normalized weighted geometric mean (or logarithmic opinion pool) of the teachers:

p∗(v)=∏d=1Dqd(v)wd∑u∈V∏d=1Dqd(u)wd.p^*(v) = \frac{\prod_{d=1}^D q_d(v)^{w_d}}{\sum_{u\in V}\prod_{d=1}^D q_d(u)^{w_d}}.

Similarly, minimizing a weighted sum of forward KLs ∑dwdDKL(qd∥p)\sum_d w_d D_{\mathrm{KL}}(q_d\|p) forces p∗p^* to match the arithmetic mixture ∑dwdqd(v)\sum_d w_d q_d(v).

Averaging all teachers on every prompt creates two problems in multi-domain post-training:

  1. Veto power and style clashing: In the geometric mean ∏dqd(v)wd\prod_d q_d(v)^{w_d}, 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.
  2. 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 DD.

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 DD domains update the same student parameter vector θ\theta via the combined gradient ∑dwdgd\sum_d w_d g_d. Why doesn't the math teacher's update overwrite the SWE teacher's representations?

Initializing all teachers ϕ1,…,ϕD\phi_1, \dots, \phi_D and the student θ0\theta_0 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 θ0\theta_0 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:

  1. 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 ∼0.04\sim 0.04 to ∼0.19\sim 0.19, as seen in Chapter 11) warns of severe stylistic or distributional drift.
  2. 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.
  3. 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 0.35:0.35:0.300.35:0.35:0.30 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-kk 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 ϕd\phi_d is trained via RL starting from the exact same SFT checkpoint θ0\theta_0 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 θ0\theta_0.

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-kk (k=64k=64) 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-kk (k=64k=64) 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-kk (k=64k=64) 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 (0.00.0) and the 30B specialist teachers (1.01.0).

Two patterns stand out in Table 4:

  1. With same-origin teachers, both losses work well: Policy gradient (0.93730.9373) and top-kk (0.90930.9093) achieve nearly identical math accuracy and strong cross-domain retention.
  2. 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-kk update, math accuracy collapses to near zero (0.94%0.94\% and 0.42%0.42\%) 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:

Why large teacher-student divergence triggers punitive suppression

Consider what happens at a student prefix ctc_t when the teacher distribution qq is far from the student distribution pθp_\theta.

In the sampled-token policy-gradient update, the student draws yt∼pθ(⋅∣ct)y_t \sim p_\theta(\cdot\mid c_t) and receives the advantage At=clip⁡(log⁡q(yt∣ct)−log⁡pθ(yt∣ct),−5,5)A_t = \operatorname{clip}(\log q(y_t\mid c_t) - \log p_\theta(y_t\mid c_t), -5, 5). When pθp_\theta and qq have poorly aligned modes, the tokens the student naturally samples frequently land in low-probability regions of qq, producing a stream of strongly negative advantages (At≪0A_t \ll 0). Meanwhile, the tokens where q(v∣ct)≫pθ(v∣ct)q(v\mid c_t) \gg p_\theta(v\mid c_t) are rarely sampled by pθp_\theta, 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 0.300.30 to 0.210.21 without discovering the 235B teacher's solution modes.

Why doesn't the top-kk loss rescue exploration by exposing the teacher's top 64 tokens directly? When DKL(pθ∥q)D_{\mathrm{KL}}(p_\theta\|q) is large (0.190.19 nats/token) and qq 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 Amax⁡=5A_{\max}=5—the corrected top-kk gradient ∂LS∂zj=pj(aj−∑v∈Spvav)\frac{\partial L_S}{\partial z_j} = p_j(a_j - \sum_{v\in S} p_v a_v) has no explicit clip on log⁡(pv/qv)\log(p_v/q_v). 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:

  1. Measure baseline token-level KL and advantage histograms: Compute DKL(pθ0∥q)D_{\mathrm{KL}}(p_{\theta_0}\|q) and plot the distribution of log⁡q(yt∣ct)−log⁡pθ0(yt∣ct)\log q(y_t\mid c_t) - \log p_{\theta_0}(y_t\mid c_t) on sampled student tokens. If the median sampled advantage is strongly negative or >10%>10\% of tokens hit the −Amax⁡-A_{\max} clip floor at step 0, the teacher is rejecting the student's baseline phrasing style.
  2. 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 θ0\theta_0.
  3. 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-kk log-ratios, or Jensen–Shannon divergence) so pθ0p_{\theta_0} 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:

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 ϕd\phi_d 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 d(x)d(x) 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 λd\lambda_d denote the average rate (in tokens per second) at which student workers finish trajectories for domain dd, and let μd\mu_d denote the sustainable prefill throughput of teacher service dd. Queue stability requires

λd<μdfor every domain d∈{1,…,D}.\lambda_d<\mu_d\qquad \text{for every domain } d\in\{1,\dots,D\}.

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 TsT_s be the wall-clock time to complete all rollouts in a batch, TqT_q the teacher scoring time, and TuT_u the student forward-backward update time. A synchronous serial loop takes

Tserial=Ts+Tq+Tu,T_{\mathrm{serial}}=T_s+T_q+T_u,

whereas streaming completed trajectories to dedicated teacher servers overlaps TqT_q behind TsT_s, reducing the step time toward

Toverlap≈max⁡(Ts,Tq)+Tu+Ttail,T_{\mathrm{overlap}}\approx\max(T_s,T_q)+T_u + T_{\mathrm{tail}},

where TtailT_{\mathrm{tail}} 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-kk vs. sampled token

To see why payload compression matters for remote teacher services, take a representative 8,192-token response over a vocabulary of V=150,000V = 150{,}000 tokens stored in 32-bit floats (4 bytes):

Shrinking the response payload from 4.92 GB4.92\text{ GB} to 32.8 KB32.8\text{ KB} 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:

Ctotal=CSFT+∑d=1DCRL,d+Cintegration.C_{\mathrm{total}}=C_{\mathrm{SFT}}+\sum_{d=1}^D C_{\mathrm{RL},d}+C_{\mathrm{integration}}.

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 CiC_i. 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 550 s550\text{ s} to 600 s600\text{ s} (+9.1%+9.1\%) on LiveCodeBench and from 90 s90\text{ s} to 120 s120\text{ s} (+33.3%+33.3\%) on QA-Chemistry. The relative overhead is smaller on coding because unit-test execution and long rollout generation dominate the 550 s550\text{ s} 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:

  1. 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.
  2. 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.
  3. Include peer-context hashes when caching: In MR-MOPD, teacher targets depend on both the target trajectory y(i)y^{(i)} and the selected peer context CiC_i, 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 0.93730.9373 (93.7%93.7\% 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 θ0\theta_0 trained on top of Qwen3-30B-A3B-Base. Three specialist teachers are trained independently from θ0\theta_0 via RL, and all candidate integration methods attempt to consolidate those three domains into a single 30B-A3B model:

Note that in Table 2, the Domain RL teachers row (1.00001.0000 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 (θ0\theta_0) 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 (45.80%45.80\% vs. 50.40%50.40\%) or Cascade RL forgetting early math gains (48.54%48.54\% on AIME25).

Reconstructing the normalized headroom arithmetic

For each domain d∈{math,IF,SWE}d \in \{\text{math}, \text{IF}, \text{SWE}\}, let sdss_d^s denote the SFT student's domain score, sdts_d^t the corresponding RL specialist's domain score, and sds_d the integrated model's domain score. The normalized headroom recovery in domain dd is

s~d=sd−sdssdt−sds.\widetilde s_d=\frac{s_d-s_d^s}{s_d^t-s_d^s}.

By construction, s~d=0\widetilde s_d = 0 matches the SFT starting point, s~d=1\widetilde s_d = 1 matches the specialist teacher's full gain over SFT, s~d>1\widetilde s_d > 1 exceeds the teacher, and s~d<0\widetilde s_d < 0 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:

  1. Mathematics domain recovery: smaths=45.42+54.482=49.95,smatht=54.79+63.652=59.22,smath=51.46+65.312=58.385.s^s_{\mathrm{math}}=\frac{45.42+54.48}{2}=49.95,\qquad s^t_{\mathrm{math}}=\frac{54.79+63.65}{2}=59.22,\qquad s_{\mathrm{math}}=\frac{51.46+65.31}{2}=58.385. s~math=58.385−49.9559.22−49.95=8.4359.27≈0.9099.\widetilde s_{\mathrm{math}}=\frac{58.385 - 49.95}{59.22 - 49.95}=\frac{8.435}{9.27}\approx 0.9099.
  2. Instruction-Following domain recovery: sIFs=42.69+84.172=63.43,sIFt=78.40+95.502=86.95,sIF=77.89+93.842=85.865.s^s_{\mathrm{IF}}=\frac{42.69+84.17}{2}=63.43,\qquad s^t_{\mathrm{IF}}=\frac{78.40+95.50}{2}=86.95,\qquad s_{\mathrm{IF}}=\frac{77.89+93.84}{2}=85.865. s~IF=85.865−63.4386.95−63.43=22.43523.52≈0.9539.\widetilde s_{\mathrm{IF}}=\frac{85.865 - 63.43}{86.95 - 63.43}=\frac{22.435}{23.52}\approx 0.9539.
  3. Software Engineering domain recovery: s~SWE=50.40−35.8051.20−35.80=14.6015.40≈0.9481.\widetilde s_{\mathrm{SWE}}=\frac{50.40 - 35.80}{51.20 - 35.80}=\frac{14.60}{15.40}\approx 0.9481.

Averaging the three domain recoveries reproduces the reported headline figure to four decimal places:

s~total=0.9099+0.9539+0.94813≈0.9373.\widetilde s_{\mathrm{total}} = \frac{0.9099 + 0.9539 + 0.9481}{3} \approx 0.9373.

Interpreting normalized headroom vs. raw percentage points

Normalizing by teacher headroom (sdt−sds)(s_d^t - s_d^s) prevents domains with wide raw percentage gains—like IF, where RL adds +23.52+23.52 percentage points—from swamping domains with tighter headroom like competition math (+9.27+9.27 points).

At the same time, keep two properties of this metric in mind when quoting headline numbers:

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 25K25\text{K} samples on IF and 30K30\text{K} samples on SWE—converging in 6×6\times to 8×8\times fewer samples than Mix-RL needs per domain.

Why does integration converge so much faster per prompt than multi-domain RL?

  1. 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 (G=1G=1) receives dense, low-variance log-probability supervision at every token position from an already-competent teacher, with no Dynamic Sampling discards.
  2. 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:

  1. Does multi-teacher on-policy distillation hold up at frontier MoE scale across five domains? (Evaluated on MiMo-V2-Flash, a 309B-parameter model.)
  2. 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
τ2\tau^2-Bench Agentic Tool Use 75.9 79.6 80.3 +0.7
τ2\tau^2-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 96.8%96.8\% of the IF teacher's gain and 87.5%87.5\% 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 (+1.8+1.8) or τ2\tau^2-Bench (+0.7+0.7) might look surprising: if the objective minimizes DKL(pθ∥qd)D_{\mathrm{KL}}(p_\theta\|q_d), 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:

Multi-round iterative evolution: branching new teachers from the unified student

Once Stage 3 produces a unified student θ1\theta_1 that combines all domain capabilities, that unified model is a strictly stronger starting point than the original SFT checkpoint θ0\theta_0. Instead of stopping after one pass, a team can treat θ1\theta_1 as the new base checkpoint for Round 2—branching a fresh set of domain RL specialists from θ1\theta_1 and then distilling them into a second-generation student θ2\theta_2:

θr+1=Integrate⁡(θr, {RL⁡d(θr)}d=1D).\theta_{r+1}=\operatorname{Integrate} \Big(\theta_r,\,\big\{\operatorname{RL}_d(\theta_r)\big\}_{d=1}^D\Big).

Crucially, this loop is not closed-system self-distillation: every round injects fresh ground-truth environment verification during the RL⁡d(θr)\operatorname{RL}_d(\theta_r) stage before consolidating the resulting specialists back into θr+1\theta_{r+1}.

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 (θ1\theta_1) 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 (θ2\theta_2) 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 (50.4050.40) simply carries forward θ1\theta_1's SWE score as a reference anchor; all normalized scores remain anchored to the original Iteration 1 SFT (0.00.0) and Iteration 1 teacher (1.01.0) scale.

Three operational takeaways emerge from Table 5:

  1. Second-round teachers break past first-round ceilings: Starting IF RL from the Iteration-1 student pushes IFBench from 78.40%78.40\% (Round-1 teacher) to 81.46%81.46\% (Round-2 teacher), lifting the composite teacher reference to 1.0301.030.
  2. The Iteration-2 student absorbs the new gains: θ2\theta_2 climbs from 0.9370.937 to 0.9860.986 overall, gaining +1.98+1.98 points on AIME25, +1.87+1.87 points on IFBench, and +1.60+1.60 points on IFEval over θ1\theta_1.
  3. Minimal forgetting on the un-rehearsed SWE domain: Even though Round 2 performs zero SWE rollouts or distillation updates, SWE-bench Verified barely moves (50.40%→50.20%50.40\% \to 50.20\%). Because the Round-2 math and IF specialists were branched directly from θ1\theta_1 (which already possessed SWE competence) and distilled back into θ1\theta_1 with small reverse-KL updates, their weight updates stay close to θ1\theta_1'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 NN 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 xx, the student policy πθ\pi_\theta samples a group of NN trajectories in parallel (with N=8N=8 in the paper's experiments):

Y(x)={y(1),…,y(N)},y(i)∼πθ(⋅∣x).Y(x)=\big\{y^{(1)},\ldots,y^{(N)}\big\},\qquad y^{(i)}\sim\pi_\theta(\cdot\mid x).

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 R(x,y(i))R(x, y^{(i)}). Comparing against a success threshold τ\tau partitions the group into a verified positive set Y+Y^+ and a failed negative set Y−Y^-:

Y+={y(i)∈Y(x):R(x,y(i))≥τ},Y−={y(i)∈Y(x):R(x,y(i))<τ}.Y^+=\big\{y^{(i)}\in Y(x):R(x,y^{(i)})\ge\tau\big\},\qquad Y^-=\big\{y^{(i)}\in Y(x):R(x,y^{(i)})<\tau\big\}.

In standard group-relative RL (GRPO), those scalar rewards R(x,y(i))R(x, y^{(i)}) are normalized across the group and broadcast directly to every token in y(i)y^{(i)}. MR-MOPD instead uses Y+Y^+ and Y−Y^- 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 y(i)y^{(i)}, the candidate peer pools must exclude y(i)y^{(i)} itself:

Y−i+=Y+∖{y(i)},Y−i−=Y−∖{y(i)}.Y^+_{-i}=Y^+\setminus\{y^{(i)}\},\qquad Y^-_{-i}=Y^-\setminus\{y^{(i)}\}.

Why is leave-one-out exclusion mandatory? In causal teacher forcing, the teacher predicts the distribution over token yt(i)y^{(i)}_t given only the prompt xx and the prefix y<t(i)y^{(i)}_{<t}. If the complete trajectory y(i)y^{(i)} were pasted into the teacher's conditioning context CiC_i 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 y(i)y^{(i)} in CiC_i—leaking the exact future tokens y≥t(i)y^{(i)}_{\ge t} and collapsing the teacher distribution onto a trivial copy operation.

Excluding y(i)y^{(i)} ensures that any positive or negative peer placed in CiC_i is an independent sample drawn from πθ(⋅∣x)\pi_\theta(\cdot\mid x).

Conditioning the teacher on verified peer rollouts

Given the leave-one-out pools Y−i+Y^+_{-i} and Y−i−Y^-_{-i}, a context-construction rule Cv\mathcal C_v selects and formats a small subset of peers into a privileged context block:

Ci=Cv(x,y(i),Y−i+,Y−i−),C_i=\mathcal C_v\big(x,y^{(i)},Y^+_{-i},Y^-_{-i}\big),

where v∈{pos,con}v \in \{\text{pos}, \text{con}\} denotes either the positive-only (MR-Pos) or contrastive (MR-Con) selection strategy. The teacher ϕ\phi then scores each prefix y<t(i)y^{(i)}_{<t} of the target rollout while conditioning on CiC_i:

qpeer(⋅∣x,y<t(i))=qϕ(⋅∣x,Ci,y<t(i)).q^{\mathrm{peer}}\big(\cdot\mid x,y^{(i)}_{<t}\big) =q_\phi\big(\cdot\mid x,C_i,y^{(i)}_{<t}\big).

Meanwhile, the student πθ(⋅∣x,y<t(i))\pi_\theta(\cdot\mid x, y^{(i)}_{<t}) sees only the original prompt xx and its own partial response y<t(i)y^{(i)}_{<t}, with no access to CiC_i.

This asymmetric conditioning turns the teacher into a privileged critic:

The group distillation objective

For each target rollout y(i)y^{(i)} in the group i∈{1,…,N}i \in \{1,\dots,N\}, MR-MOPD sums the token-level divergence between the unprivileged student and the peer-conditioned teacher:

LMR(i)(θ)=∑t=1∣y(i)∣D(πθ(⋅∣x,y<t(i)) ∥ qϕ(⋅∣x,Ci,y<t(i))),\mathcal L^{(i)}_{\mathrm{MR}}(\theta) =\sum_{t=1}^{|y^{(i)}|} D\Big(\pi_\theta\big(\cdot\mid x,y^{(i)}_{<t}\big)\,\Big\|\, q_\phi\big(\cdot\mid x,C_i,y^{(i)}_{<t}\big)\Big),

and averages LMR(i)(θ)\mathcal L^{(i)}_{\mathrm{MR}}(\theta) across the rollouts in the group. As noted in Chapter 5, MR-MOPD sets DD to the reverse KL divergence on competition math benchmarks and the symmetric Jensen–Shannon divergence on coding and question-answering benchmarks, evaluated via top-100100 logit truncation (top-k = 100).

Notice two structural differences from MT-MOPD's Equation 1:

  1. Sequence sum vs. length average: MR-MOPD's displayed equation writes an unnormalized sum over tt rather than dividing by 1/T1/T inside the expectation (though framework-level token averaging in verl may still normalize across active batch tokens).
  2. Hybrid RL/OPD mixing coefficient α\alpha: Algorithm 1 and the experimental setup introduce a weighting coefficient α=0.5\alpha = 0.5 when combining distillation gradients with group-relative reward updates; we examine the exact implementation details and open questions around α\alpha 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 CiC_i:

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 qϕ(⋅∣x,Ci,y<t(i))q_\phi(\cdot\mid x, C_i, y^{(i)}_{<t}).

Why self-distillation works when the teacher has privileged context

In every experiment in the MR-MOPD paper, the teacher weights ϕ\phi are initialized from the exact same base checkpoint as the student θ\theta (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:

  1. Through repeated sampling (N=8N=8) and ground-truth verification R(x,y)R(x, y), the rollout group surfaces rare correct solutions and exposes common failure modes.
  2. Conditioning the teacher on CiC_i reduces its task from solving xx cold to evaluating a partial continuation y<t(i)y^{(i)}_{<t} 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, qϕ(⋅∣x,Ci,y<t(i))q_\phi(\cdot\mid x, C_i, y^{(i)}_{<t}) is substantially more accurate than πθ(⋅∣x,y<t(i))\pi_\theta(\cdot\mid x, y^{(i)}_{<t})—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:

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 Y(x)Y(x) after excluding the target rollout y(i)y^{(i)}. Because the student's pass rate varies dramatically across prompts and across training epochs, the actual context CiC_i 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 N=8N=8 rollouts produces 1 success (y(1)∈Y+y^{(1)} \in Y^+) and 7 failures (y(2),…,y(8)∈Y−y^{(2)}, \dots, y^{(8)} \in Y^-):

Similarly, if a group contains 2 successes and 6 failures, the 6 failed targets each see 2 positive peers (∣Y−i+∣=2|Y^+_{-i}| = 2), whereas the 2 successful targets each see only 1 positive peer (∣Y−i+∣=1|Y^+_{-i}| = 1). Group-level success counts (∣Y+∣≥1|Y^+| \ge 1) therefore overestimate target-level peer availability (∣Y−i+∣≥1|Y^+_{-i}| \ge 1).

Binomial availability across difficulty regimes

To quantify how often a target rollout actually receives its requested peers, suppose each rollout on prompt xx succeeds independently with probability s∈(0,1)s \in (0,1). Across all NN rollouts, the group contains at least one success with probability 1−(1−s)N1 - (1-s)^N. For a specific target rollout y(i)y^{(i)}, however, the peer pool consists of the remaining N−1N-1 rollouts, where the number of positive peers K=∣Y−i+∣K = |Y^+_{-i}| follows Binomial⁡(N−1,s)\operatorname{Binomial}(N-1, s):

Evaluating these probabilities at N=8N = 8 (N−1=7N-1 = 7 peers) across three pass-rate regimes illustrates the curriculum shift during training:

Prompt Pass Rate ss Group Has ≥1\ge 1 Success Target Sees K≥1K \ge 1 Pos. Target Sees K≥2K \ge 2 Pos. (MR-Pos) Target Sees 2≤K≤62 \le K \le 6 (MR-Con)
s=0.01s = 0.01 (hard) 7.73%7.73\% 6.79%6.79\% 0.20%0.20\% 0.20%0.20\%
s=0.10s = 0.10 (low-mid) 56.95%56.95\% 52.17%52.17\% 14.97%14.97\% 14.97%14.97\%
s=0.50s = 0.50 (balanced) 99.61%99.61\% 99.22%99.22\% 93.75%93.75\% 92.97%92.97\%
s=0.90s = 0.90 (easy) 100.00%100.00\% 100.00%100.00\% 99.98%99.98\% 52.17%52.17\%

On hard prompts (s=0.10s = 0.10), barely 15%15\% of target rollouts receive two positive peers; on very easy prompts (s=0.90s = 0.90), nearly half of the targets have K=7K = 7 (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 (∣Y+∣=0|Y^+| = 0) under the base model. That statistic makes the fallback behavior on all-failure and single-success groups a primary determinant of training dynamics:

How MR-MOPD selects diverse positives and hard negatives

When multiple positive and negative peers are available in Y−i+Y^+_{-i} and Y−i−Y^-_{-i}, how should Cv\mathcal C_v pick the two positives and one negative?

  1. Primary positive anchor (yanchor+y^+_{\text{anchor}}): Chosen from Y−i+Y^+_{-i} as the highest-reward or canonical verified solution.
  2. Diversity-maximizing second positive (ydiversity+y^+_{\text{diversity}}): 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 yanchor+y^+_{\text{anchor}} broadens the teacher's support across multiple valid solution modes.
  3. Informative negative peer (yhard−y^-_{\text{hard}}): 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 yanchor+y^+_{\text{anchor}} (or with the target rollout y(i)y^{(i)}) 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 CiC_i expands the teacher's prefill sequence length. If a prompt is 1,0001{,}000 tokens and each rollout averages 2,0002{,}000 tokens, prepending three full peers adds 6,0006{,}000 tokens in front of the 2,0002{,}000-token target rollout—pushing the teacher prefill pass to 9,0009{,}000 tokens per target (or 72,00072{,}000 prefill tokens across an 8-rollout group).

Does cramming all N=8N=8 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:

  1. Negative peers only help when paired with positive anchors: Conditioning on 1 Negative alone hurts performance dramatically, whereas adding 1 Negative alongside 1 Positive or 2 Positives produces a large jump in mean@8 (52.62%→74.29%52.62\% \to 74.29\% on Chemistry; 55.62%→61.82%55.62\% \to 61.82\% on LCB).
  2. 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 (58.43%58.43\% vs. 61.82%61.82\%) even when given double the wall-clock training budget (4 h4\text{ h}, 58.95%58.95\%), both because extra redundant failures dilute attention and because longer teacher prefill contexts slow down each step.
  3. 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 22 or 33 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 (ϕ≠θ\phi \neq \theta), or the teacher is given privileged conditioning information (CiC_i) 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 tt of trajectory y(i)y^{(i)}:

Student:pθ(v∣x,y<t(i)),Teacher:qϕ(v∣x,Ci,y<t(i)).\text{Student:}\quad p_\theta\big(v\mid x,y^{(i)}_{<t}\big),\qquad\qquad \text{Teacher:}\quad q_\phi\big(v\mid x,C_i,y^{(i)}_{<t}\big).

Even when ϕ=θ\phi = \theta, these two distributions solve different inference tasks:

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 πθ\pi_\theta 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 qϕ(⋅∣x,Ci,y<t(i))q_\phi(\cdot\mid x, C_i, y^{(i)}_{<t}) immediately sees which indexing convention passed the test suite and assigns high probability to the correct index offset when scoring y<t(i)y^{(i)}_{<t}.

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:

  1. Exploration via group sampling (N=8N=8): Stochastic decoding searches the space of candidate trajectories around the current policy πθ\pi_\theta.
  2. Ground-truth selection via R(x,y)R(x, y): The external verifier injects bit-level truth by partitioning Y(x)Y(x) into Y+Y^+ and Y−Y^-.
  3. Credit assignment via in-context teacher scoring: The teacher qϕq_\phi uses its language modeling priors to compare the target prefix y<t(i)y^{(i)}_{<t} against the verified peers in CiC_i, translating a sequence-level pass/fail bit into token-level log-probability ratios across the trajectory.
  4. Amortization into student weights θ\theta: Minimizing D(pθ∥qϕ)D(p_\theta \| q_\phi) trains the unprivileged student to produce zero-shot what the teacher inferred with CiC_i 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 y+∈Y+y^+ \in Y^+, 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 qϕ(⋅∣x,Ci,y<t)q_\phi(\cdot\mid x, C_i, y_{<t}) and pθ(⋅∣x,y<t)p_\theta(\cdot\mid x, y_{<t}) can be internalized into the student's weights.

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:

  1. Strict leave-one-out exclusion (y(i)∉Ciy^{(i)} \notin C_i): As established in Chapter 15, the target trajectory y(i)y^{(i)} being scored must never appear inside its own conditioning context CiC_i. If a bug in the group indexer allows y(i)∈Ciy^{(i)} \in C_i, the teacher achieves near-zero perplexity by simply copying yt(i)y^{(i)}_t from earlier in its prompt, destroying the distillation signal.
  2. Zero privileged context at evaluation time: During benchmark evaluation, the student πθ(⋅∣x)\pi_\theta(\cdot\mid x) 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.
  3. 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 q14B(⋅∣x,y<t)q_{14\mathrm{B}}(\cdot\mid x, y_{<t}); it is matching the peer-conditioned 14B distribution q14B(⋅∣x,Ci,y<t)q_{14\mathrm{B}}(\cdot\mid x, C_i, y_{<t}), 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 ϕ\phi evolve as the student θ\theta updates:

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 n=8n = 8 independent responses from the trained student policy:

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:

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:

  1. SDPO collapses on AIME: Single-positive self-distillation (SDPO) drops far below even the untrained base model on AIME25 (7.81%7.81\% vs. 17.92%17.92\%) and AIME24 (7.29%7.29\% vs. 16.89%16.89\%). When math rewards are sparse binary answer checks and single successful peers are rare or noisy, uncontrasted self-distillation reinforces unproductive reasoning chains.
  2. 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@8 28.54%28.54\% vs. 17.09%17.09\%) and HMMT25 Nov (15.83%15.83\% vs. 13.16%13.16\%), while trailing GRPO slightly on AIME25 (25.41%25.41\% vs. 25.80%25.80\%) and HMMT25 Feb pass@8 (19.58%19.58\% vs. 20.94%20.94\%).

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 62.91%62.91\% for SDPO on Chemistry, the three-seed uncertainty table in the paper's appendix reports 73.22±2.5%73.22 \pm 2.5\% for SDPO against 74.29%74.29\% 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 33 to 99 points.

Distilling from a larger teacher (Qwen3-14B →\to Qwen3-4B)

In addition to pure self-distillation (ϕ=θ\phi = \theta), 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 →\to 4B offline 55.91 / 60.05 46.05 / 56.67
Standard OPD (no peer context) 14B →\to 4B on-policy 59.63 / 61.58 60.92 / 67.30
SDPO (single-pos self-teacher) 4B →\to 4B on-policy 62.04 / 65.97 48.84 / 63.23
MR-MOPD (self-teacher) 4B →\to 4B on-policy 64.61 / 66.81 57.01 / 65.48
MR-MOPD (14B teacher) 14B →\to 4B on-policy 66.44 / 68.61 61.92 / 67.35

Comparing the rows isolates two separate effects:

  1. Moving from offline distillation to standard on-policy distillation (OPD) with the 14B teacher lifts LCB mean@8 from 46.05%46.05\% to 60.92%60.92\% and ToolUse from 55.91%55.91\% to 59.63%59.63\%.
  2. Adding multi-rollout peer context (MR-MOPD) to the 14B teacher adds another +6.81+6.81 points on ToolUse (59.63%→66.44%59.63\% \to 66.44\%) and +1.00+1.00 point on LCB mean@8 (60.92%→61.92%60.92\% \to 61.92\%). Remarkably, even 4B self-distillation with MR-MOPD (64.61%64.61\% on ToolUse) beats unconditioned 14B-to-4B on-policy distillation (59.63%59.63\%), 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:

  1. Teacher signal quality: When holding a set of candidate student rollouts fixed, does prepending 2 Pos + 1 Neg peers make the teacher's sequence log-probabilities correlate better with ground-truth verifier rewards?
  2. 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 xx and a group of N=8N=8 candidate student responses y(1),…,y(8)y^{(1)}, \dots, y^{(8)} with binary verifier outcomes ri∈{0,1}r_i \in \{0, 1\}, MR-MOPD computes the teacher's length-averaged sequence log-probability on each candidate under a chosen peer context CiC_i:

si=1Ti∑t=1Tilog⁡qϕ(yt(i)∣x,Ci,y<t(i)).s_i=\frac1{T_i}\sum_{t=1}^{T_i}\log q_\phi\big(y_t^{(i)}\mid x,C_i,y^{(i)}_{<t}\big).

Holding the trajectories y(i)y^{(i)} and binary outcomes rir_i fixed while varying the context rule Cv\mathcal C_v isolates how peer conditioning reshapes the teacher's sequence rankings. The paper evaluates six correlation and calibration metrics between continuous teacher scores sis_i and binary rewards rir_i across LiveCodeBench rollouts:

Context Condition Spearman ρ\rho Kendall τ\tau Pairwise Acc. Success AUC Point-Biserial rpbr_{\mathrm{pb}} Sigmoid Brier ↓\downarrow
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 (ρ=−0.0024\rho = -0.0024), 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 0.47330.4733 (when random guessing on a valid binary classification problem has AUC=0.50\mathrm{AUC} = 0.50), and why does 1 Negative (the worst-performing ranking condition) achieve the "best" (lowest) Sigmoid Brier score of 0.17280.1728?

1. Undefined ranking metrics on all-failure prompts (the 57% zero-fill effect)

For any single prompt xx, let P={i:ri=1}\mathcal P = \{i : r_i = 1\} and N={j:rj=0}\mathcal N = \{j : r_j = 0\}. Both Pairwise Accuracy and Success AUC divide by the number of positive-negative pairs ∣P∣ ∣N∣|\mathcal P|\,|\mathcal N|:

AUC(x)=1∣P∣ ∣N∣∑i∈P∑j∈N(1[si>sj]+121[si=sj]).\mathrm{AUC}(x) = \frac{1}{|\mathcal P|\,|\mathcal N|}\sum_{i\in\mathcal P}\sum_{j\in\mathcal N}\Big(\mathbf 1[s_i > s_j] + \frac{1}{2}\mathbf 1[s_i = s_j]\Big).

When all 8 rollouts on a prompt fail (∣P∣=0|\mathcal P| = 0)—which happens on 57% of the LCB prompts in this dataset—or when all 8 succeed (∣N∣=0|\mathcal N| = 0), the denominator ∣P∣ ∣N∣|\mathcal P|\,|\mathcal N| 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 57%57\% of prompts have ∣P∣=0|\mathcal P| = 0 is bounded above by 1−0.57=0.431 - 0.57 = 0.43 (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 0.47330.4733 corresponds to a conditional within-prompt AUC well above 0.850.85 on prompts with non-trivial variance! Meanwhile, under No peers, the unconditional AUC of 0.12830.1283 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 (1≤∣P∣≤N−11 \le |\mathcal P| \le N-1) alongside the fraction of all-zero and all-one groups.

2. Why σ(si)\sigma(s_i) is bounded by 0.50.5 in the Sigmoid Brier column

The appendix defines the Sigmoid Brier score as 1N∑i=1N(σ(si)−ri)2\frac{1}{N}\sum_{i=1}^N (\sigma(s_i) - r_i)^2, where σ(u)=11+e−u\sigma(u) = \frac{1}{1 + e^{-u}} is applied directly to the average token log-probability si≤0s_i \le 0.

Because every normalized log-probability is nonpositive (log⁡qϕ≤0\log q_\phi \le 0), their average sis_i is always ≤0\le 0, which forces

0<σ(si)≤0.5for every rollout i.0 < \sigma(s_i) \le 0.5\qquad \text{for every rollout } i.

Furthermore, because 57%57\% of prompts have all ri=0r_i = 0 (and most rollouts overall fail), any condition that lowers the teacher's average log-probability si→−∞s_i \to -\infty pushes σ(si)→0\sigma(s_i) \to 0, shrinking (σ(si)−0)2(\sigma(s_i) - 0)^2 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 (0.17280.1728) despite having virtually zero discriminative power (ρ=0.0097\rho = 0.0097). Raw σ(si)\sigma(s_i) without an affine calibration temperature and bias (a⋅si+ba \cdot s_i + b) 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 nn-gram diversity (Distinct-1, Distinct-2) and Abstract Syntax Tree (AST) structural distance across the 8 generated code solutions per prompt:

Method Distinct-1 ↑\uparrow Distinct-2 ↑\uparrow AST Jaccard Distance ↑\uparrow
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 nn-grams divided by total nn-grams across the concatenated responses for a prompt, and AST Jaccard Distance parses the extracted Python code blocks into syntax trees and computes 1−∣A∩B∣∣A∪B∣1 - \frac{|A \cap B|}{|A \cup B|} 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 (0.0520.052 vs. 0.0270.027) and increases AST structural variation (0.1290.129 vs. 0.1100.110).

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 +11.38+11.38 main-table margin over SDPO shrinks to +1.07+1.07 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 N=8N=8 responses per prompt before dividing. Follow the explicit Appendix formula (cross-rollout concatenation) when reproducing the 0.025–0.052 scale.
Hybrid mixing weight α=0.5\alpha = 0.5 Algorithm 1 and setup list α=0.5\alpha = 0.5, without writing out the exact combined RL + OPD loss equation in the main text. Treat α\alpha 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 (11-indexed IDs i∈{1,2,3}i \in \{1, 2, 3\}) each wear a badge showing a displayed label Q[i]Q[i] and look at another person P[i]P[i]. For each badge label ℓ∈{1,2,3}\ell \in \{1, 2, 3\}, we must output the badge label worn by the person that ℓ\ell's wearer is looking at.

Take the input arrays:

P=[2,1,3],Q=[3,1,2].P=[2,1,3],\qquad Q=[3,1,2].

First invert QQ to map each displayed badge label to the person wearing it: badge 11 is worn by person 22, badge 22 by person 33, and badge 33 by person 11. Walking through the three steps for each badge label gives:

Badge Label ℓ\ell Wearer i=Q−1[ℓ]i = Q^{-1}[\ell] Target Person j=P[i]j = P[i] Target's Badge Q[j]Q[j]
1 2 P[2]=1P[2] = 1 Q[1]=3Q[1] = 3
2 3 P[3]=3P[3] = 3 Q[3]=2Q[3] = 2
3 1 P[1]=2P[1] = 2 Q[2]=1Q[2] = 1

The correct output is [3, 2, 1], corresponding to the three-step composition

badge label ℓ→Q−1wearer i→Ptarget person j→Qtarget badge Q[j].\text{badge label } \ell \xrightarrow{Q^{-1}} \text{wearer } i \xrightarrow{P} \text{target person } j \xrightarrow{Q} \text{target badge } Q[j].

Group rollout, verification, and leave-one-out peer selection

Suppose the student πθ\pi_\theta samples N=8N = 8 rollouts on this prompt:

The unit-test verifier labels Y+={y(1),y(2)}Y^+ = \{y^{(1)}, y^{(2)}\} and Y−={y(3),…,y(8)}Y^- = \{y^{(3)}, \dots, y^{(8)}\}. Look at how leave-one-out peer selection constructs CiC_i under MR-Con:

When the teacher scores prefix y<t(3)y^{(3)}_{<t} right at the return expression, having y(1),y(2)y^{(1)}, y^{(2)} (which wrap the result in Q[...]) contrasted against y(4)y^{(4)} (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 tt, compress the vocabulary at prefix ct=(x,y<t(3))c_t = (x, y^{(3)}_{<t}) down to three simplified next-token choices:

Suppose the unprivileged student distribution pθ(⋅∣ct)p_\theta(\cdot\mid c_t) and the peer-conditioned teacher distribution qϕ(⋅∣x,C3,y<t(3))q_\phi(\cdot\mid x, C_3, y^{(3)}_{<t}) are:

p=(0.5, 0.3, 0.2),q=(0.1, 0.7, 0.2).p=(0.5,\,0.3,\,0.2),\qquad q=(0.1,\,0.7,\,0.2).

1. Exact full-vocabulary reverse KL

The local reverse KL at this token position is

K(p∥q)=0.5log⁡0.50.1+0.3log⁡0.30.7+0.2log⁡0.20.2=0.5log⁡5+0.3log⁡37+0≈0.5505 nats.K(p\|q) = 0.5\log\frac{0.5}{0.1} + 0.3\log\frac{0.3}{0.7} + 0.2\log\frac{0.2}{0.2} = 0.5\log 5 + 0.3\log\frac{3}{7} + 0 \approx 0.5505\text{ nats}.

2. Sampled-token policy-gradient advantages

Under the sampled-token estimator, the advantage Av=log⁡qv−log⁡pvA_v = \log q_v - \log p_v for each possible draw is:

AA=log⁡0.10.5=−log⁡5≈−1.6094,AB=log⁡0.70.3=log⁡73≈+0.8473,AC=log⁡0.20.2=0.A_A = \log\frac{0.1}{0.5} = -\log 5 \approx -1.6094,\qquad A_B = \log\frac{0.7}{0.3} = \log\frac{7}{3} \approx +0.8473,\qquad A_C = \log\frac{0.2}{0.2} = 0.

Because rollout y(3)y^{(3)} sampled the buggy token yt(3)=Ay^{(3)}_t = A, the single-sample update observes AA≈−1.6094A_A \approx -1.6094 (well inside the [−5,5][-5, 5] clip range) and pushes down log⁡pθ(A∣ct)\log p_\theta(A \mid c_t).

3. Exact logit gradients

With p=softmax⁡(z)p = \operatorname{softmax}(z), the exact gradient of K(p∥q)K(p\|q) with respect to the student logits z=(zA,zB,zC)z = (z_A, z_B, z_C) is

∂K∂zj=pj(log⁡pjqj−K(p∥q)).\frac{\partial K}{\partial z_j} = p_j\left(\log\frac{p_j}{q_j} - K(p\|q)\right).

Plugging in K≈0.5505K \approx 0.5505 gives:

The three logit derivatives sum to 0.5295−0.4193−0.1101≈00.5295 - 0.4193 - 0.1101 \approx 0 (as required by shift invariance of softmax). A gradient descent step z←z−η∇zKz \leftarrow z - \eta \nabla_z K lowers zAz_A, strongly raises zBz_B, and slightly raises zCz_C through the shared normalizer even though pC=qC=0.2p_C = q_C = 0.2.

4. Tail-corrected top-kk loss (k=2k = 2)

If instead we use MT-MOPD's tail-corrected top-kk objective with k=2k = 2, the teacher's top-2 tokens are S={B,C}S = \{B, C\} (qB=0.7,qC=0.2q_B = 0.7, q_C = 0.2). Evaluating Equation 5 on SS gives

LS(p,q)=(0.3log⁡0.30.7−0.3+0.7)+(0.2log⁡0.20.2−0.2+0.2)≈0.1458.L_S(p,q) = \left(0.3\log\frac{0.3}{0.7} - 0.3 + 0.7\right) + \left(0.2\log\frac{0.2}{0.2} - 0.2 + 0.2\right) \approx 0.1458.

Notice that LS≈0.1458L_S \approx 0.1458 is smaller than the full reverse KL (0.55050.5505) because the third coordinate AA is outside SS, yet its logit gradient ∂LS∂zj=pj(aj−∑v∈Spvav)\frac{\partial L_S}{\partial z_j} = p_j(a_j - \sum_{v \in S} p_v a_v) still pulls mass into BB and out of the unscored tail token AA.

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:

  1. In Multi-Teacher MOPD (MT-MOPD): The student generates a single rollout y∼πθ(⋅∣x)y \sim \pi_\theta(\cdot\mid x) (G=1G = 1, no unit-test verification required during integration). Because the prompt comes from the coding/SWE dataset, the router sends (x,y)(x, y) to the frozen coding RL specialist ϕcode\phi_{\text{code}}. That specialist already learned how to compose index arrays during its Stage-2 RL training, so its unconditioned prefill pass qϕcode(⋅∣x,y<t)q_{\phi_{\text{code}}}(\cdot\mid x, y_{<t}) directly assigns high probability to token BB (Q[...]) and low probability to token AA.
  2. In a combined Multi-Teacher + Multi-Rollout pipeline: If you have both domain specialists ϕd(x)\phi_{d(x)} and an online verifier Rd(x)R_{d(x)} during integration, you can sample a group of rollouts, build the verified peer context CiC_i, and route (x,Ci,y(i))(x, C_i, y^{(i)}) to the domain specialist: qtcombined(v)=πϕd(x)(v∣x,Ci,y<t(i)).q^{\mathrm{combined}}_t(v) = \pi_{\phi_{d(x)}}\big(v \mid x, C_i, y^{(i)}_{<t}\big). This hybrid target gives a domain-specialized teacher in-context verification from peer rollouts, at the cost of increasing the integration rollout budget from G=1G=1 to N=8N=8 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-kk 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:

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 tt in the student forward pass matches token index tt in the teacher prefill pass.

In MR-MOPD, the teacher input prepends the peer context block CiC_i between the prompt xx and the target rollout y(i)y^{(i)}:

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 T=∣y(i)∣T = |y^{(i)}|, the teacher service must:

  1. Concatenate the token IDs of x, C_i, and y^{(i)} without re-tokenizing the boundary between C_i and y^{(i)} in a way that merges BPE tokens across the boundary.
  2. Run a causal forward pass over the full sequence of length Lx+LCi+TL_x + L_{C_i} + T.
  3. Slice out the last TT logit positions (remembering that in standard next-token prediction, the logit at index m−1m-1 predicts the token at index mm) so the returned tensor has shape [T, k] (or [T]), matching the TT 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:

  1. Zero-loss identity check (p=qp = q): Load the exact same checkpoint into both the student trainer and the teacher prefill service (with no peer context Ci=∅C_i = \emptyset). Verify that the sampled-token advantage At=log⁡q(yt∣ct)−log⁡pθ(yt∣ct)A_t = \log q(y_t\mid c_t) - \log p_\theta(y_t\mid c_t) and the corrected top-kk loss LS(pθ,q)L_S(p_\theta, q) evaluate to 0.00.0 within bf16 tolerance (<10−3< 10^{-3}) across every token of a multi-turn trajectory. Any spike reveals an off-by-one logit shift, chat-template discrepancy, or RoPE position mismatch.
  2. Coordinate minimum of corrected top-kk: On a synthetic 5-token vocabulary with fixed qq and k=2k=2, optimize a free logit vector zz using compute_topk_corrected_loss and assert that at convergence pv=qvp_v = q_v for all v∈Sv \in S and LS(p,q)≥0L_S(p, q) \ge 0 throughout optimization (catching a missing −pv+qv-p_v + q_v term immediately).
  3. 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 ∣Y+∣=1|Y^+| = 1, the single passing rollout receives 0 positive peers while the 7 failing rollouts each receive 1 positive peer.
  4. 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 that actor_loss_mask is True strictly on assistant-generated tokens and False on all prompt and tool-return spans.
  5. 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

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 (θ0\theta_0)
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 32,76832{,}768 tokens (Math & IF); 65,53665{,}536 tokens and up to 5050 turns (SWE)
Stage-2 Specialist RL On-policy GRPO with Dynamic Sampling; LR 3×10−63\times 10^{-6}; G=8G=8 rollouts/prompt
Specialist RL batch & volume Batch size 144144 prompts (Math/IF, ∼175K\sim 175\text{K} sequences) and 8080 prompts (SWE, ∼150K\sim 150\text{K} sequences)
Mix-RL baseline GRPO with Dynamic Sampling; LR 4×10−64\times 10^{-6}; batch size 256256 prompts; G=8G=8 rollouts
Cascade-RL baseline Sequential RL order: IF→Math→SWE\text{IF} \to \text{Math} \to \text{SWE}
Stage-3 MT-MOPD integration Batch size 2,0482{,}048 prompts; G=1G=1 rollout/prompt; Dynamic Sampling disabled
Integration domain mixture Math:IF:SWE=0.35:0.35:0.30\text{Math} : \text{IF} : \text{SWE} = 0.35 : 0.35 : 0.30
Loss configurations Sampled-token PG with advantage clip Amax⁡=5.0A_{\max} = 5.0; or Corrected Top-kk with k=64k = 64
Evaluation decoding Temperature 1.01.0, no top-pp or top-kk 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 3×10−63\times 10^{-6} is optimal for batch-2,048 distillation), nor does it release the proprietary SFT checkpoint θ0\theta_0 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 3232 prompts per step ×\times N=8N = 8 rollouts per prompt (256256 trajectories/step)
Optimizer & learning rate AdamW, actor LR 1×10−51\times 10^{-5}, 1010 warmup steps
Default peer context (MR-Con) 22 verified positive peers (yanchor+,ydiversity+y^+_{\text{anchor}}, y^+_{\text{diversity}}) + 11 failed peer (yhard−y^-_{\text{hard}})
Divergence & truncation Reverse KL (Math); Jensen–Shannon divergence (Code, QA, ToolUse); distillation_topk = 100
Hybrid mixing weight α=0.5\alpha = 0.5
Math training dataset 57K57\text{K} filtered DeepMath problems with difficulty ≥6\ge 6
Sequence length limits Max prompt 2,0482{,}048; max response 4,0964{,}096 (8,1928{,}192 for math), plus teacher context headroom
Evaluation protocol n=8n = 8 samples per test prompt (mean@8 and pass@8)
Compute cluster 8×H1008\times\text{H100} or 8×A1008\times\text{A100} per self-distillation run; 2×8 H1002\times 8\text{ H100} nodes for 14B→\to4B

Details to verify against the verl codebase: When replicating MR-MOPD, document (1) the exact fallback rule when ∣Y−i+∣=0|Y^+_{-i}| = 0 (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 ϕ\phi synchronize with the actor θ\theta, and (4) the exact formula combining the α=0.5\alpha = 0.5 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:

  1. Equal student rollout trajectories: Compares how much value each method extracts per generated trajectory (and per unit-test sandbox execution). Because MT-MOPD uses G=1G=1 rollout per prompt without Dynamic Sampling discards while GRPO uses G=8G=8 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.
  2. Equal student generated tokens: Normalizes for verbosity drift, ensuring a baseline that inflates chain-of-thought length by 2×2\times is charged for generating twice as many tokens.
  3. Equal total FLOPs (student rollout + teacher prefill + student backward): Charges MR-MOPD for the 3×3\times–4×4\times longer teacher prefill sequences created by prepending peer rollouts CiC_i.
  4. 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:

Statistical rigor and compositional evaluation

Small benchmarks like AIME24 and AIME25 contain only 30 problems each—a single problem is worth 3.333.33 percentage points! Even when averaging 8 or 32 samples per problem to reduce decoding variance, the questions themselves are fixed. When reporting results:

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 ct=(x,y<t)c_t = (x, y_{<t}), Pinsker's inequality bounds the total variation distance between the student's next-token distribution ptp_t and the teacher's distribution qtq_t in terms of the reverse KL divergence:

TV⁡(pt,qt)=12∑v∈V∣pt(v)−qt(v)∣≤12DKL(pt∥qt).\operatorname{TV}(p_t,q_t) = \frac12\sum_{v\in V}|p_t(v) - q_t(v)| \le \sqrt{\frac12 D_{\mathrm{KL}}(p_t\|q_t)}.

Driving DKL(pt∥qt)≤ϵD_{\mathrm{KL}}(p_t\|q_t) \le \epsilon therefore guarantees that the student and teacher assign similar probabilities to any next-token event at context ctc_t.

What happens when we chain those local decisions across a full TT-token trajectory Y=(Y1,…,YT)Y = (Y_1, \dots, Y_T)? By the chain rule of KL divergence, the sequence-level reverse KL between the student trajectory distribution Pθ(Y∣x)P_\theta(Y\mid x) and a fixed teacher trajectory distribution Q(Y∣x)Q(Y\mid x) equals the sum of expected step-wise conditional KLs along student-visited prefixes:

DKL(Pθ(Y∣x) ∥ Q(Y∣x))=∑t=1TEct∼Pθ[DKL(pt∥qt)].D_{\mathrm{KL}}\big(P_\theta(Y\mid x)\,\big\|\,Q(Y\mid x)\big) =\sum_{t=1}^{T}\mathbb E_{c_t\sim P_\theta} \big[D_{\mathrm{KL}}(p_t\|q_t)\big].

If the expected per-token reverse KL is bounded by ϵ\epsilon at every step t∈{1,…,T}t \in \{1,\dots,T\}, then the sequence-level KL is at most TϵT\epsilon. Applying Pinsker's inequality to the full trajectory distributions PθP_\theta and QQ bounds the gap in expected reward for any binary verifier R(x,Y)∈{0,1}R(x, Y) \in \{0, 1\}:

∣EY∼Pθ[R(x,Y)]−EY∼Q[R(x,Y)]∣≤TV⁡(Pθ,Q)≤min⁡ ⁣(1, Tϵ2).\big|\mathbb E_{Y\sim P_\theta}[R(x,Y)] - \mathbb E_{Y\sim Q}[R(x,Y)]\big| \le \operatorname{TV}(P_\theta, Q) \le \min\!\left(1,\, \sqrt{\frac{T\epsilon}{2}}\right).

Plug in concrete numbers to see how quickly sequence length loosens this worst-case guarantee: at an average token-level reverse KL of ϵ=0.001\epsilon = 0.001 nats over a T=1,000T = 1{,}000-token reasoning chain, the Pinsker upper bound is 1,000×0.001/2=0.5≈0.707\sqrt{1{,}000 \times 0.001 / 2} = \sqrt{0.5} \approx 0.707 (70.770.7 percentage points of pass-rate gap!).

Even more importantly, a low sequence-averaged KL can hide concentrated errors:

Representational capacity and multi-domain interference

In MT-MOPD, the student and all DD specialist teachers have the exact same parameter count (30B-A3B in the controlled study, 309B in MiMo-V2-Flash). Consolidating DD specialists into one weight vector θ\theta relies on the assumption that a single model has enough spare representational capacity to realize πϕd(⋅∣x,y<t)\pi_{\phi_d}(\cdot\mid x, y_{<t}) across all domains d∈{1,…,D}d \in \{1,\dots,D\} simultaneously.

Two factors make this consolidation work well in MT-MOPD's regime—and define where it will eventually strain:

  1. 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.
  2. Same-origin basin sharing: Because every ϕd\phi_d was trained via a bounded number of RL steps from the same SFT checkpoint θ0\theta_0, the specialists agree on most general language tokens and differ primarily on task-specific action transitions.

As the number of domains DD scales from 33–55 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 DD, and headroom recovery s~total\widetilde s_{\mathrm{total}} remains an important empirical question.

Verifier false positives and reward hacking amplification

Both MOPD pipelines ultimately depend on the integrity of the task verifiers Rd(x,y)R_d(x, y):

Privileged peer conditioning amplifies the quality of the verifier: when the verifier is exact, CiC_i sharpens credit assignment; when the verifier is noisy, CiC_i injects mislabeled in-context demonstrations into the teacher's prompt.

The test-time information gap in privileged distillation

In MR-MOPD, the teacher qϕ(⋅∣x,Ci,y<t)q_\phi(\cdot\mid x, C_i, y_{<t}) conditions on verified peer attempts CiC_i, whereas at deployment the student πθ(⋅∣x,y<t)\pi_\theta(\cdot\mid x, y_{<t}) must act without CiC_i. As discussed in Chapter 17, any decision that depends solely on carefully reading xx and avoiding common pitfalls can be internalized into θ\theta. 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 πθ(⋅∣x)\pi_\theta(\cdot\mid x) 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:

  1. 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 πϕd(x)(⋅∣x,Ci,y<t(i))\pi_{\phi_{d(x)}}(\cdot\mid x, C_i, y^{(i)}_{<t}) combines specialist parameters with privileged in-context verification.
  2. 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-235B teacher in Table 4) without triggering entropy collapse?
  3. Decision-token weighted divergences: Instead of weighting every boilerplate syntax token equally with 1T\frac{1}{T}, weighting token positions by teacher-student entropy differences or critic value changes could focus capacity on the critical branching tokens that determine trajectory outcomes.
  4. Full trajectory-occupancy corrections: Incorporating lightweight reward-to-go KL terms alongside the local myopic token advantage At=log⁡qt−log⁡ptA_t = \log q_t - \log p_t 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:

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 ϕd(x)\phi_{d(x)}, whereas MR-MOPD conditions a single teacher weight set ϕ\phi (often the student's own base checkpoint) on multiple verified peer rollouts CiC_i.

Does "Multi-Teacher" mean averaging logits across all teachers on every token?

No. In MT-MOPD, each training prompt xx carries a domain label d(x)d(x) and is scored by one specialist teacher ϕd(x)\phi_{d(x)}. Averaging teacher distributions across domains on the same token would multiply prefill compute by DD and force the student toward the weighted geometric mean ∏dqd(v)wd\prod_d q_d(v)^{w_d}, 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 πθ\pi_\theta 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 (ϕ\phi and θ\theta 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 y<ty_{<t} that contains an awkward variable name or sub-optimal intermediate step, the teacher's forward pass still computes a normalized distribution q(⋅∣x,y<t)q(\cdot\mid x, y_{<t}) over how best to continue or recover from step tt onward.

Objectives, gradients, and sparse losses

Does on-policy distillation eliminate every distribution shift?

Training on student-generated prefixes y∼πθy \sim \pi_\theta eliminates the training-time exposure bias between teacher prefixes dqd_q and student prefixes dπθd_{\pi_\theta}. 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 At=log⁡q(yt∣ct)−log⁡p(yt∣ct)A_t = \log q(y_t\mid c_t) - \log p(y_t\mid c_t) a true RL return-to-go?

No. AtA_t is an immediate conditional log-likelihood ratio at step tt. It tells the optimizer whether the teacher assigns higher or lower probability to the sampled token yty_t at prefix ctc_t, without summing future log-ratios over steps t′>tt' > t.

Why can the logged policy-gradient surrogate loss be negative?

Because the surrogate loss LPG=−1T∑tsg⁡[Aˉt]log⁡pθ(yt∣ct)\mathcal L_{\mathrm{PG}} = -\frac{1}{T}\sum_t \operatorname{sg}[\bar A_t]\log p_\theta(y_t\mid c_t) detaches Aˉt\bar A_t. Its gradient matches the local reverse-KL score function, but its scalar value is a signed product of Aˉt\bar A_t and log⁡pθ\log p_\theta, not a nonnegative divergence. To monitor reverse KL in nats, log the batch average of log⁡pθ(yt∣ct)−log⁡q(yt∣ct)\log p_\theta(y_t\mid c_t) - \log q(y_t\mid c_t) separately.

Why is the sampled-token update called a local semi-gradient?

In the full trajectory objective Ey∼πθ[1T∑tK(θ;ct(y))]\mathbb E_{y\sim\pi_\theta}[\frac{1}{T}\sum_t K(\theta; c_t(y))], the parameters θ\theta control both the local KL K(θ;ct)K(\theta; c_t) at each visited prefix and the probability of visiting trajectory yy in the first place. Differentiating K(θ;ct)K(\theta; c_t) while holding the sampled prefixes ctc_t fixed computes the local step-wise gradient and omits the trajectory-occupancy score-function term.

Why does top-kk reverse KL need the −pv+qv-p_v + q_v correction term?

In a naive partial sum ∑v∈Spvlog⁡(pv/qv)\sum_{v\in S} p_v \log(p_v/q_v) over a proper subset S⊂VS \subset V, the derivative with respect to pvp_v is log⁡(pv/qv)+1\log(p_v/q_v) + 1, which sets the coordinate minimum at pv=qv/e≈0.368 qvp_v = q_v / e \approx 0.368\,q_v and pushes student probability mass out of the top-kk set into the unscored tail. Adding −pv+qv-p_v + q_v turns each summand into the nonnegative Bregman divergence pvlog⁡(pv/qv)−pv+qvp_v\log(p_v/q_v) - p_v + q_v, whose derivative is log⁡(pv/qv)\log(p_v/q_v) and whose unique minimum is at pv=qvp_v = q_v.

Does zero corrected top-kk loss imply p=qp = q across the full vocabulary?

Only if S=VS = V. When k<∣V∣k < |V|, LS(p,q)=0L_S(p, q) = 0 guarantees that pv=qvp_v = q_v for every v∈Sv \in S and that the total remaining tail mass ∑u∉Spu=∑u∉Squ\sum_{u \notin S} p_u = \sum_{u \notin S} q_u matches, but it leaves how the student distributes mass among the unscored tail tokens V∖SV \setminus S completely unconstrained.

Is top-kk distillation the same thing as top-kk decoding?

No. Top-kk distillation selects which kk teacher vocabulary coordinates enter the training loss at each prefix; top-kk decoding truncates the sampling distribution during text generation. MT-MOPD uses full-vocabulary sampling (temperature 1.01.0, no top-kk or top-pp cutoff) during rollout and evaluation even when training with the top-6464 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 (0.04→0.190.04 \to 0.19). Under reverse KL, large mismatches on the student's natural phrasing generate predominantly negative advantages that suppress student entropy (0.30→0.210.30 \to 0.21) under policy-gradient training and trigger step-18 gradient oscillations under unclipped top-6464 training.

What does MT-MOPD's headline 0.93730.9373 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: s~d=(sd−sds)/(sdt−sds)\widetilde s_d = (s_d - s_d^s)/(s_d^t - s_d^s). It means the single integrated model recovers 93.73%93.73\% 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 46.72%46.72\% (and Chemistry to 35.67%35.67\%), whereas pairing that same negative peer with two positive anchors (2 Pos + 1 Neg) lifts LCB to 61.82%61.82\% and Chemistry to 74.29%74.29\%.

What happens in MR-MOPD when all N=8N=8 rollouts fail (or only one succeeds)?

Under leave-one-out exclusion (Y−i+=Y+∖{y(i)}Y^+_{-i} = Y^+ \setminus \{y^{(i)}\}), an all-failure group (∣Y+∣=0|Y^+| = 0) leaves every target with zero positive peers, and a single-success group (∣Y+∣=1|Y^+| = 1) leaves the single passing target with zero positive peers while giving the 7 failing targets one positive peer. Because 57%57\% of base-model LCB prompts have ∣Y+∣=0|Y^+| = 0, a production implementation must define an explicit fallback rule (such as dropping back to unconditioned OPD or GRPO when Y−i+=∅Y^+_{-i} = \emptyset).

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 Rd(x)R_{d(x)} to construct the contrastive peer context CiC_i, and route (x,Ci,y(i))(x, C_i, y^{(i)}) to the domain specialist ϕd(x)\phi_{d(x)} to evaluate qd(x)(⋅∣x,Ci,y<t(i))q_{d(x)}(\cdot\mid x, C_i, y^{(i)}_{<t}). 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

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
xx Task prompt (including system instructions and initial problem state)
y=(y1,…,yT)y=(y_1,\ldots,y_T) Autoregressively generated trajectory of length TT
y<ty_{<t} Trajectory prefix (y1,…,yt−1)(y_1, \dots, y_{t-1}) prior to step tt
ct=(x,y<t)c_t = (x, y_{<t}) Complete conditioning context at decision step tt
VV Shared token vocabulary
θ\theta Trainable student policy parameters (πθ\pi_\theta)
θ0\theta_0 Shared broad SFT starting checkpoint in MT-MOPD
ϕd\phi_d Frozen domain-specialist teacher parameters for domain dd in MT-MOPD
ϕ\phi Teacher parameters in MR-MOPD (either shared self-teacher or external teacher)
pt(v)=πθ(v∣ct)p_t(v) = \pi_\theta(v\mid c_t) Student next-token probability distribution at context ctc_t
qt(v)q_t(v) Teacher next-token probability distribution at context ctc_t
d(x)∈{1,…,D}d(x) \in \{1,\dots,D\} Domain routing label for prompt xx in MT-MOPD
wdw_d Training mixture sampling weight for domain dd
NN Number of student rollouts sampled per prompt in a rollout group (N=8N=8 in MR-MOPD)
R(x,y)R(x,y) Ground-truth environment verifier or reward function
τ\tau Reward threshold partitioning rollouts into passing (Y+Y^+) and failing (Y−Y^-) sets
Y−i+, Y−i−Y^+_{-i},\, Y^-_{-i} Leave-one-out passing and failing peer sets with target rollout y(i)y^{(i)} excluded
Ci=Cv(x,y(i),Y−i+,Y−i−)C_i = \mathcal C_v(x, y^{(i)}, Y^+_{-i}, Y^-_{-i}) Privileged peer context prepended to the teacher prompt for target ii
sg⁡[⋅]\operatorname{sg}[\cdot] Stop-gradient operator (detaches expression from automatic differentiation)
At=sg⁡[log⁡qt(yt)−log⁡pt(yt)]A_t = \operatorname{sg}[\log q_t(y_t) - \log p_t(y_t)] Sampled-token reverse-KL log-probability ratio advantage
Amax⁡A_{\max} Symmetric clipping bound on AtA_t (Amax⁡=5.0A_{\max} = 5.0 in MT-MOPD)
S=TopK⁡k(qt)S = \operatorname{TopK}_k(q_t) Set of kk highest-probability vocabulary tokens under the teacher at step tt
LS(pt,qt)L_S(p_t, q_t) Tail-corrected top-kk reverse-KL loss ∑v∈S[pvlog⁡(pv/qv)−pv+qv]\sum_{v\in S}[p_v\log(p_v/q_v) - p_v + q_v]
dπ,t(c)d_{\pi,t}(c) Marginal distribution over contexts ctc_t visited by policy π\pi at step tt
s~d=sd−sdssdt−sds\widetilde s_d = \frac{s_d - s_d^s}{s_d^t - s_d^s} Normalized specialist headroom recovery in domain dd

Glossary of key terms

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-kk 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-kk & 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 →\to 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

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-kk 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 cc, a two-token student distribution is p=(0.99,0.01)p = (0.99, 0.01) while the teacher distribution is q=(0.50,0.50)q = (0.50, 0.50). What sampled-token advantage A2=log⁡(q2/p2)A_2 = \log(q_2 / p_2) 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 22 is sampled, its unclipped log-ratio advantage is

A2=log⁡0.500.01=log⁡50≈+3.9120.A_2 = \log\frac{0.50}{0.01} = \log 50 \approx +3.9120.

Even though the gradient multiplier +3.9120+3.9120 is large and positive, the student only samples token 22 on p2=1%p_2 = 1\% of visits to context cc. On the other 99%99\% of visits, the student samples token 11 and observes A1=log⁡(0.50/0.99)≈−0.6831A_1 = \log(0.50/0.99) \approx -0.6831. In expectation over v∼pv \sim p, the single-sample estimator is unbiased for ∇θDKL(p∥q)\nabla_\theta D_{\mathrm{KL}}(p\|q), but its Monte Carlo variance is high whenever teacher-favored modes have tiny student probability pv≪qvp_v \ll q_v.

2. Stationary point of naive vs. corrected top-11 reverse KL

Suppose a teacher's largest token probability at context cc is q1=0.60q_1 = 0.60, and we score only S={1}S = \{1\} (k=1k = 1) while allowing the remaining student mass 1−p11 - p_1 to move freely into unscored tail tokens. Find the coordinate-wise minimum of the naive partial loss Lnaive(p1)=p1log⁡(p1/0.60)L_{\mathrm{naive}}(p_1) = p_1\log(p_1/0.60) and compare it to the corrected loss LS(p1)=p1log⁡(p1/0.60)−p1+0.60L_S(p_1) = p_1\log(p_1/0.60) - p_1 + 0.60.

Worked solution. Differentiating the naive partial loss with respect to p1p_1 gives

∂Lnaive∂p1=log⁡p10.60+1=0  ⟹  p1∗=0.60e≈0.2207,\frac{\partial L_{\mathrm{naive}}}{\partial p_1} = \log\frac{p_1}{0.60} + 1 = 0 \implies p_1^* = \frac{0.60}{e} \approx 0.2207,

where Lnaive(0.2207)≈−0.2207<0=Lnaive(0.60)L_{\mathrm{naive}}(0.2207) \approx -0.2207 < 0 = L_{\mathrm{naive}}(0.60). The naive truncated objective pushes nearly two-thirds of the teacher's top-token mass out into the unscored tail! Adding the linear correction −p1+0.60-p_1 + 0.60 changes the derivative to

∂LS∂p1=log⁡p10.60=0  ⟹  p1∗=0.60,\frac{\partial L_S}{\partial p_1} = \log\frac{p_1}{0.60} = 0 \implies p_1^* = 0.60,

with LS(0.60)=0L_S(0.60) = 0 and LS(p1)>0L_S(p_1) > 0 for all p1≠0.60p_1 \neq 0.60.

3. Zero corrected top-kk loss with nonzero full-vocabulary KL

Construct a three-token example where the corrected top-11 loss L{1}(p,q)L_{\{1\}}(p, q) is exactly zero, yet the full-vocabulary reverse KL DKL(p∥q)D_{\mathrm{KL}}(p\|q) is strictly positive.

Worked solution. Set q=(0.7,0.2,0.1)q = (0.7, 0.2, 0.1) and p=(0.7,0.1,0.2)p = (0.7, 0.1, 0.2) with k=1k = 1 (S={1}S = \{1\}). On the scored coordinate v=1v = 1, p1=q1=0.7p_1 = q_1 = 0.7, so

L{1}(p,q)=0.7log⁡0.70.7−0.7+0.7=0.L_{\{1\}}(p,q) = 0.7\log\frac{0.7}{0.7} - 0.7 + 0.7 = 0.

Across the full vocabulary, however, the swapped tail probabilities on tokens 22 and 33 yield

DKL(p∥q)=0+0.1log⁡0.10.2+0.2log⁡0.20.1=0.1log⁡2≈0.0693>0.D_{\mathrm{KL}}(p\|q) = 0 + 0.1\log\frac{0.1}{0.2} + 0.2\log\frac{0.2}{0.1} = 0.1\log 2 \approx 0.0693 > 0.

Matching pv=qvp_v = q_v for all v∈Sv \in S pins down the total tail mass 1−∑v∈Spv1 - \sum_{v\in S} p_v, but cannot observe how the student allocates that mass among individual tail tokens in V∖SV \setminus S.

4. Computing normalized headroom recovery

In a single domain dd, the SFT student scores sds=40.0s_d^s = 40.0, the domain RL specialist teacher scores sdt=60.0s_d^t = 60.0, and an integrated student scores sd=55.0s_d = 55.0. What is the normalized headroom score s~d\widetilde s_d? What if the integrated student scores 62.062.0, or if sdt=sds=40.0s_d^t = s_d^s = 40.0?

Worked solution. Using s~d=sd−sdssdt−sds\widetilde s_d = \frac{s_d - s_d^s}{s_d^t - s_d^s}:

5. Non-commutativity of benchmark averaging vs. headroom normalization

Suppose the Mathematics domain has two benchmarks (AIME25 and AIME26) where the SFT student scores (40,80)(40, 80), the math teacher scores (60,90)(60, 90), and the distilled student scores (50,90)(50, 90). 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.

Because ratios of sums do not equal averages of ratios when denominators (sd,bt−sd,bs)(s_{d,b}^t - s_{d,b}^s) differ across benchmarks, reproducing MT-MOPD's Table 2 headline (0.93730.9373) requires averaging within-domain benchmarks before dividing by domain headroom.

6. Leave-one-out peer availability within a single rollout group

A group of N=8N = 8 rollouts on prompt xx produces 11 passing trajectory (y(1)y^{(1)}) and 77 failing trajectories (y(2),…,y(8)y^{(2)}, \dots, y^{(8)}). Under leave-one-out peer selection (Y−i+=Y+∖{y(i)}Y^+_{-i} = Y^+ \setminus \{y^{(i)}\}), how many positive peers are available when scoring y(2)y^{(2)}, and how many are available when scoring y(1)y^{(1)}?

Worked solution.

Pasting y(1)y^{(1)} into its own teacher context C1C_1 to fake a positive peer would leak the entire target answer y≥t(1)y^{(1)}_{\ge t} 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 s=0.05s = 0.05 on a hard prompt, what is the probability that a group of N=8N = 8 rollouts contains at least one passing solution, and what is the probability that a specific target rollout y(i)y^{(i)} has at least one passing peer among the remaining N−1=7N-1 = 7 rollouts?

Worked solution.

8. Comparing mean@8 and pass@8 on a single prompt

On a single test problem, an evaluator samples n=8n = 8 responses from the model and exactly c=1c = 1 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 100100 prompts, 5757 prompts have zero passing rollouts (∣P∣=0,∣N∣=8|\mathcal P| = 0, |\mathcal N| = 8), and on the remaining 4343 mixed-outcome prompts the teacher achieves a strong within-prompt Success AUC of 0.900.90. If an evaluation script replaces undefined 0/0 prompt AUCs with 0.0 before averaging over all 100100 prompts, what dataset-averaged AUC does it report?

Worked solution. The script computes

AUCzero-filled=57×0.0+43×0.90100=0.3870,\mathrm{AUC}_{\text{zero-filled}} = \frac{57 \times 0.0 + 43 \times 0.90}{100} = 0.3870,

making a strong 0.900.90 discriminator look worse than a 0.500.50 coin flip! Always filter to prompts with 1≤∣P∣≤N−11 \le |\mathcal P| \le N-1 (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 si=−2.0s_i = -2.0 nats to candidate trajectory y(i)y^{(i)}. What pseudo-probability does σ(si)=11+e−si\sigma(s_i) = \frac{1}{1+e^{-s_i}} assign, and why can σ(si)\sigma(s_i) never exceed 0.50.5?

Worked solution. At si=−2.0s_i = -2.0,

σ(−2.0)=11+e2≈0.1192.\sigma(-2.0) = \frac{1}{1 + e^{2}} \approx 0.1192.

Because qϕ(⋅∣ct)q_\phi(\cdot\mid c_t) is a normalized categorical distribution, every token probability satisfies qϕ(yt∣ct)≤1q_\phi(y_t\mid c_t) \le 1, so every log-probability is nonpositive (log⁡qϕ≤0\log q_\phi \le 0) and their average satisfies si≤0s_i \le 0. Since σ(u)\sigma(u) is strictly increasing with σ(0)=0.5\sigma(0) = 0.5, σ(si)∈(0,0.5]\sigma(s_i) \in (0, 0.5] for every possible trajectory. On datasets where most rollouts fail (ri=0r_i = 0), models with lower log-probabilities (si≪0s_i \ll 0) push σ(si)→0\sigma(s_i) \to 0 and achieve artificially low Brier scores (σ(si)−0)2(\sigma(s_i) - 0)^2 regardless of whether they rank passing rollouts above failing ones.

11. Network bandwidth for top-kk teacher prefill payloads

A student trajectory has T=4,096T = 4{,}096 active response tokens. If the teacher prefill service returns its top-6464 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 64×(4 bytes+4 bytes)=512 bytes64 \times (4\text{ bytes} + 4\text{ bytes}) = 512\text{ bytes}. Across 4,0964{,}096 positions:

4,096×512 bytes=2,097,152 bytes=2.0 MiB(≈2.10 MB).4{,}096 \times 512\text{ bytes} = 2{,}097{,}152\text{ bytes} = 2.0\text{ MiB}\quad (\approx 2.10\text{ MB}).

By comparison, returning only the single sampled-token log-probability (k=1k=1 known ID) requires 4,096×4=16,384 bytes4{,}096 \times 4 = 16{,}384\text{ bytes} (16 KiB16\text{ KiB}), while returning a full 150,000150{,}000-token fp32 distribution requires 4,096×150,000×4≈2.46 GB4{,}096 \times 150{,}000 \times 4 \approx 2.46\text{ GB}.

12. Asynchronous teacher queue stability

During MT-MOPD integration, student rollout workers generate completed math trajectories at an average rate of λmath=15,000\lambda_{\text{math}} = 15{,}000 tokens/s, while the dedicated math teacher prefill service has a maximum sustainable throughput of μmath=10,000\mu_{\text{math}} = 10{,}000 tokens/s. Does asynchronous overlap hide the teacher latency over a 100-step run?

Worked solution. No. Because λmath>μmath\lambda_{\text{math}} > \mu_{\text{math}}, the math scoring queue grows without bound at a net rate of λmath−μmath=5,000\lambda_{\text{math}} - \mu_{\text{math}} = 5{,}000 tokens/s. Asynchronous RPC calls only hide teacher latency when λd<μd\lambda_d < \mu_d for every domain dd; 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 y∼πθ(⋅∣x)y \sim \pi_\theta(\cdot\mid x) at every step and updates θ\theta using the token-wise score function −1T∑t=1Tsg⁡[log⁡qt(yt)−log⁡pt(yt)] ∇θlog⁡pθ(yt∣ct)-\frac{1}{T}\sum_{t=1}^T \operatorname{sg}[\log q_t(y_t) - \log p_t(y_t)]\,\nabla_\theta \log p_\theta(y_t\mid c_t), what exact derivative term from ∇θEy∼πθ[fθ(y)]\nabla_\theta \mathbb E_{y\sim\pi_\theta}[f_\theta(y)] is omitted?

Worked solution. Writing fθ(y)=1T∑t=1TDKL(pθ,t∥qt)f_\theta(y) = \frac{1}{T}\sum_{t=1}^T D_{\mathrm{KL}}(p_{\theta,t}\|q_t), the exact gradient of the trajectory expectation is

∇θEy∼πθ[fθ(y)]=Ey∼πθ[∇θfθ(y)]+Ey∼πθ[fθ(y) ∇θlog⁡πθ(y∣x)].\nabla_\theta \mathbb E_{y\sim\pi_\theta}[f_\theta(y)] = \mathbb E_{y\sim\pi_\theta}\big[\nabla_\theta f_\theta(y)\big] + \mathbb E_{y\sim\pi_\theta}\big[f_\theta(y)\,\nabla_\theta\log\pi_\theta(y\mid x)\big].

The token-wise update estimates the first term Ey[∇θfθ(y)]\mathbb E_y[\nabla_\theta f_\theta(y)] (differentiating the local divergence at each visited state ctc_t), and omits the second term Ey[fθ(y) ∇θlog⁡πθ(y∣x)]\mathbb E_y[f_\theta(y)\,\nabla_\theta\log\pi_\theta(y\mid x)], 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 ϕd(x)\phi_{d(x)} and conditions that specialist on verified peer rollouts CiC_i. What four experimental arms are required to test whether the two mechanisms are complementary?

Worked solution. Run a 2×22\times 2 factorial grid under matched rollout and prefill budgets starting from the same SFT checkpoint θ0\theta_0:

  1. Single generalist teacher + no peer context: standard single-teacher OPD baseline.
  2. Domain-routed specialist teachers + no peer context: pure MT-MOPD (qd(x)(⋅∣x,y<t)q_{d(x)}(\cdot\mid x, y_{<t})).
  3. Single generalist teacher + 2 Pos + 1 Neg peer context: pure MR-MOPD (qϕ(⋅∣x,Ci,y<t(i))q_\phi(\cdot\mid x, C_i, y^{(i)}_{<t})).
  4. Domain-routed specialist teachers + 2 Pos + 1 Neg peer context: combined MT-MR-MOPD (qd(x)(⋅∣x,Ci,y<t(i))q_{d(x)}(\cdot\mid x, C_i, y^{(i)}_{<t})).

Comparing (4−2)(4 - 2) against (3−1)(3 - 1) 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