arXiv(opens in a new tab)cs.LGSep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.38025

Dr. OPD: Learning What to Follow for Optimal On-Policy Distillation of Large Language Models

Zhenyu Wang, Tianze Wang, Linjun Zhang, Yifan Hu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

On-policy distillation (OPD) trains a student on its own generated responses using dense, token-level supervision from a stronger teacher. Vanilla OPD treats all teacher signals equally, assuming that the teacher's supervision is equally important for every token. However, teacher signals at different tokens may have very different effects on the student's performance: some correct important reasoning errors, while others have little effect on the final answer. Motivated by this observation, we introduce Dr. OPD (OPD Done Right), which defines the optimal weighted OPD to maximize the student's performance. We formulate Dr. OPD as a bilevel optimization problem in which the student learns from weighted teacher supervision, while the weights are selected to maximize the expected reward of the resulting student. To solve Dr. OPD, we develop an efficient iterative solver that updates the token weights and student policy alternatively. At each round, it updates weights in closed form and then takes one gradient step on the resulting weighted OPD objective. Under regularity conditions, we show that this weighted update achieves a higher expected reward than a vanilla OPD update. Empirically, across strong-to-weak and same-size distillation on math and code, Dr. OPD consistently outperforms all evaluated baselines. In particular, in the strong-to-weak distillation setting, Dr. OPD improves average math performance by 9.7 points over vanilla OPD, and enables the smaller student to surpass its larger teacher.

1 INTRODUCTION

On-policy distillation (OPD) has become an important post-training approach for transferring capabilities from a stronger teacher to a student model that is cheaper to deploy or has undergone less training (Agarwal et al., 2024; Xu et al., 2026; Team et al., 2026). Unlike outcome-reward reinforcement learning methods like RLOO and GRPO (Ahmadian et al., 2024; Shao et al., 2024), which update the model based on a scalar reward for an entire generated trajectory, OPD leverages the teacher model to provide dense, token-level supervision along with the student's generated responses (Gu et al., 2024). Specifically, OPD trains the student by minimizing the divergence between the next-token distributions of the student and the teacher at each token visited by the student. Therefore, it provides a learning signal at every generated token rather than only at the end of a response.

Vanilla OPD assigns equal importance to the teacher's supervisions across tokens. However, given a long response generated by the student, should every teacher signal be treated equally? Consider a student solving a math problem. The teacher could either correct a crucial reasoning step or simply prefer different wording under the same mathematical meaning. These two signals are supposed to enter the distillation loss with different weights, as their effects on the final answer can be very different. Indeed, recent work has likewise shown that not every signal from the teacher across each token is equally useful to the student (Armandpour et al., 2026; Xie et al., 2026; Xing et al., 2026).

∗^{*}Equal contribution.

†^{\dagger}Co-corresponding authors.

Code: https://github.com/zywang0701/Dr-OPD.

OPD: teacher provides token-level supervision on the student

Vanilla OPD: all teacher signals are trusted equally (wt=1)(w_t = 1)

Figure

Dr. OPD: trusting the teacher according to the student's needs.

Figure

Solver of Dr. OPD

  1. Student rollouts

  2. Teacher signal & Outcome reward

  3. Token credit

  4. Trust weight

  5. OPD update with wtw_t

Student (pw)(p_w)

Teacher (p∗)(p^*)

Student (pw)(p_w)

Teacher signal

gtg_t

y(1)y^{(1)}: ...

y(2)y^{(2)}: ...

⋮\vdots

y(K)y^{(K)}: ...

Outcome reward

Reward signal

r^t\hat{r}_t

How helpful is the teacher's suggestion at token t?

Trust the teacher more when it helps the student.

Update the student with context-aware (token-level) weights.

Next iteration

Figure 1: Illustration of Dr. OPD. Left: vanilla OPD assigns the same weight to every teacher signal, while Dr. OPD adapts the weights according to their benefit to the student. Right: student rollouts receive teacher and outcome-reward signals, whose gradient alignment determines token credits. These credits are converted into weights for distillation, where λ\lambda controls the weighting strength.

To study how the student should trust teacher signals across tokens, we revisit the goal of OPD. In particular, note that the purpose of distillation is ultimately to improve the student's task performance. Minimizing the divergence towards the stronger teacher policy is only an approach used to achieve this goal. Indeed, the teacher signal only tells us what the teacher prefers at each token, but not whether following the preference improves the student's performance. This motivates us to adaptively choose the weight of each teacher signal according to its usefulness for the student. In this paper, we therefore study how to weight token-level teacher signals so that the student achieves the best performance.

Following this principle, we introduce Dr. OPD (OPD Done Right), which assigns weights w(s,v)w(s, v) to each teacher signal on the tokens vv and context s=(x,y)s = (x, y) according to its usefulness for improving the student, as illustrated in Figure 1. A weight wt>1w_t > 1 places more trust in the teacher at token tt, while 0<wt<10 < w_t < 1 places less trust. Vanilla OPD sets equal weights of wt≡1w_t \equiv 1 across all tokens. We note that for any positive weight ww, the corresponding ww-weighted OPD remains a valid distillation objective that pushes the student toward the teacher policy, just as vanilla OPD does. Dr. OPD then selects, among these valid weights, the one that gives the best resulting student:

max⁡w{Student′sperformanceaftertrainingwithw−weightedOPD}.(1)\max_{w}\Big\{Student^{\prime}s performance after training with w-weighted OPD\Big\}. \tag{1}

The performance is measured by an outcome reward based on its generated responses (Ouyang et al., 2022; Shao et al., 2024). We formally formulate Dr. OPD as a bilevel optimization in Section 3.

Solving (1) exactly would require repeatedly training the student under different weight functions and then selecting the best weight, which is computationally infeasible. We therefore develop an iterative solver, illustrated in Figure 1. At each round, we build a surrogate objective of (1) to update the weights, leading to a simple closed-form update instead of learning a complex weight function. Then the student performs a weighted OPD update. Specifically, the student generates its own responses, from which we obtain the teacher's token-level supervision and the outcome reward signal. We use these two signals to assess whether following the teacher more closely at each token would improve the student's performance. Under regularity conditions, we show that the student, after the weighted update, achieves a higher reward than the corresponding vanilla OPD update.

To summarize, we make the following contributions:

• Bilevel Formulation of Distillation. We introduce the concept of learning useful signals from the teacher via weighted OPD and propose Dr. OPD, a bilevel optimization formulation that defines the optimal weighted OPD to maximize the student's performance. The lower-level problem trains the student under a given weight function, while the upper-level problem selects the weights according to the performance of the resulting student.

• Efficient Algorithm. Despite the challenge of solving Dr. OPD directly, we develop an efficient iterative solver with a closed-form weight update followed by a gradient update of the weighted OPD. To incorporate outcome rewards into the weight updates, it requires computing an inner product between two parameter-dimensional gradients for every token, which is prohibitively expensive for large models. We instead express each inner product as the product of two scalars, and then these products for all tokens can be computed altogether using a single Jacobian–vector product (JVP); see Section 4 for details.

• Significant Empirical Gains. We evaluate Dr. OPD across strong-to-weak and same-size distillation on math and code tasks, where it achieves the best performance across all evaluated settings and consistently outperforms all baselines. As shown in Figure 2, Dr. OPD improves Qwen3-1.7B over vanilla OPD by +9.7 points on math and even surpasses the larger Qwen3-4B teacher (35.0 vs. 34.1). In same-size distillation, it also surpasses both RL-trained teachers.

(a) Strong-to-weak distillation

Qwen3-1.7B student, Qwen3-4B teacher

Figure

(b) Same-size distillation

Qwen3-4B student, Qwen3-4B-RL teacher

Figure 2: Empirical gains. Across both distillation setups, Dr. OPD consistently outperforms existing baselines and even produces a student that surpasses its teacher (Full results in Section 5.2).

References (71)