arXiv:2610.13481cs.AIOct 2026

Manuscript Offprint

arXiv:2610.13481

Branching On-Policy Distillation

Dongyang Chen, Shudong Liu, Shubo Li, Duoxun Tang, Jinwei Liang, Zehuan Wu, Lewei Lu

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

ABSTRACT

On-policy distillation (OPD) provides teacher supervision on student-generated trajectories, but a single trajectory realizes only one continuation at each decision, limiting supervision coverage under a finite sampling budget. We propose BranchOPD (Branching On-Policy Distillation), which selects informative decision points using student uncertainty and teacher–student disagreement, resamples student-policy continuations from shared prefixes, and applies token-level teacher supervision to both main trajectories and branches. BranchOPD operates at token-level decisions in mathematics and within-turn decisions in agent tasks. Shared-prefix reuse reduces student-generated token costs by approximately 19% on ALFWorld and 31% on WebShop relative to seven independent trajectories. We also introduce protocol-boundary repair (PBR), which uses targeted supervision under protocol constraints to mitigate repetition and wasted generation. BranchOPD outperforms Vanilla OPD and Multi-Rollout OPD (n = 7) across all evaluated benchmarks, with gains over Vanilla OPD of 18.55 percentage points in mean mathematics accuracy over 16 sampled answers (avg@16) and 13.8 points in mean ALFWorld ID/OOD success. Mechanistic analyses and selection ablations show that branching at uncertain decisions expands subsequent behavior coverage and outperforms random selection and turn-initial branching.

1 INTRODUCTION

Distillation is a standard way to transfer the reasoning and interaction abilities of a large language model to a smaller one. Training on fixed teacher outputs (Hinton et al., 2015; Kim & Rush, 2016) exposes the student only to prefixes the teacher would write, whereas at inference the student must continue from its own. On-policy distillation (OPD) closes this gap: the student generates trajectories and the teacher scores every generated token (Agarwal et al., 2023; Ross et al., 2010; Bengio et al., 2015; Gu et al., 2023; Ko et al., 2024).

Each trajectory, however, follows only one of the continuations available at every decision. Even with the teacher's full next-token distribution at a prefix, the student receives no supervision on the multi-step histories that the unchosen tokens would have led to. This matters in mathematical reasoning, where an early step constrains the rest of the derivation, and in agent tasks, where an action changes all later observations (Yao et al., 2022b; Schick et al., 2023; Wang et al., 2022b; Wei et al., 2022; Qin et al., 2023). Sampling more independent trajectories widens coverage, but most of the extra tokens regenerate identical or near-identical prefixes. As Figure 1 shows, resampling from a single prefix can reach quite different paths, sometimes even when the first resampled token matches the original.

Recent OPD methods decide where to spend supervision on trajectories that have already been sampled: they reweight tokens, reasoning steps, or turns (Xu et al., 2026; Zhong et al., 2026; Tan et al., 2026; Sheng et al., 2026), order trajectories by difficulty (Wang et al., 2026b), or reuse teacher-scored samples (Zheng et al., 2026). We ask instead which additional trajectories to sample. Tree search and branching reinforcement learning already share prefixes to explore locally (Li et al., 2025; Dong et al., 2025; Zong et al., 2026; Ji et al., 2025; Yao et al., 2023; Zhou et al., 2023a; Hao et al., 2023b).

∗^{*}Corresponding author.

A. Mathematics

Figure

Solve 3(x+2)−5=163(x + 2) - 5 = 16.

Prefix

"Adding 5 to both sides gives 3(x+2)=213(x + 2) = 21. The next step is to ..."

Token scores

Figure

Resampling

Main

q=0.41

divide

x+2=7→x=5x + 2 = 7 \rightarrow x = 5

Correct

Branch 1

q=0.23

expand

3x+6=21→x=53x + 6 = 21 \rightarrow x = 5

Correct

Branch 2

q=0.13

subtract

x+2=18→x=16x + 2 = 18 \rightarrow x = 16

Wrong

B. Multi-turn agent

Figure

Heat a mug and put it in the coffeemachine.

Turn uncertainty

Figure

Token scores

"... Since mugs are often stored in cabinets or drawers, the best ..."

Figure

Resampling

Main

q=0.027

next

"step is to go to one of the cabinets."

Fail

Branch 1

q=0.377

approach

"check the available storage locations."

Success

Branch 2

q=0.377

approach

"is to check the cabinets first."

Fail

Figure 1: Resampling from one prefix on a mathematics problem and a logged ALFWorld trajectory. Scores mark the fork; q is the student probability of each continuation’s first token.

et al., 2023; Khomich et al., 2026; Yu et al., 2026c; He et al., 2026); we bring this idea to distillation, where every branch token receives dense teacher supervision and no task reward is needed.

We propose BranchOPD. For each input, the student first generates a main trajectory. We then pick a few fork points using student uncertainty and teacher–student disagreement, and sample new continuations from the frozen student policy at each fork. In mathematics tasks, we select token positions directly; in agent tasks we first select turns and then positions within them. The teacher scores all generated tokens on the main trajectory and the branches, and a shared prefix enters the loss only once. Because branches come from the student rather than from the teacher or a refined trajectory (Jiang et al., 2026; Zhou et al., 2026), they stay on the student's own distribution.

A commonly encountered failure mode in OPD is improper termination: the student may continue generating after producing the final answer, often emitting redundant content or stray formatting tokens (Yang et al., 2026b; Luo et al., 2026). We handle this problem by protocol-boundary repair (PBR), an auxiliary loss on detected protocol events, and apply PBR to the baselines so that comparisons isolate the effect of branching.

Our contributions are:

• Branching on-policy distillation. A shared-prefix sampling scheme that selects informative decisions and resamples student continuations from them for token-level teacher supervision, in both mathematical reasoning and multi-turn agent tasks.

• Protocol-boundary repair. An auxiliary loss that reinforces beneficial and suppresses harmful protocol events in student outputs, reducing repetition and wasted generation.

• Experiments and analysis. BranchOPD outperforms Vanilla OPD and Multi-Rollout OPD on all evaluated benchmarks, including when every method uses PBR, while generating about 19% and 31% fewer student tokens than seven independent trajectories on ALFWorld and WebShop. Ablations and diagnostics show that the choice of fork points matters.