HyperAIHyperAI

Command Palette

Search for a command to run...

궤적 기반 정제蒸馏

Li Jiang Haoran Xu Yichuan Ding Amy Zhang

초록

온-폴리시 디스틸레이션(On-policy Distillation, OPD)은 대규모 언어 모델(Large Language Models, LLMs)의 사후 학습(Post-training) 단계에서 핵심적인 도구로 자리 잡았으며, 이는 학생 모델(Student)의 롤아웃(Rollout) 경로 전반에 걸쳐 희박하지 않은(Dense) 토큰별 교사(Teacher)의 감독을 제공한다. 본 연구에서는 OPD 하에서 발견되는 공통된 구조적 원인을 규명하였으며, 이를 ‘접두사 실패(Prefix Failure)’라고 명명한다. 접두사 실패가 발생하는 상황에서는 희박하지 않은 토큰별 감독이 이봉분포(Bimodal)를 띤 교사의 혼합 분포를 유발하고, 파편화된 그라디언트(Gradients)를 생성하는데, 이는 토큰 수준의 손실 함수(Tokenizer-level loss) 절단이나 재가중화(Reweighting) 기법으로는 해결할 수 없는 문제이다. 이러한 관찰을 바탕으로 본 연구에서는 토큰 수준의 손실 함수 개입을 넘어, 트레젝토리(Trailjectory) 수준의 출력 보정(Output Correction) 방향으로 접근 방식을 전환한다. 이에 따라 우리는 교사의 감독 하에 학생 모델의 롤아웃이 온-폴리시 지원 범위(On-policy support) 내에 있도록 수정하는 트레젝토리 수준 보정 기법인 ‘트레젝토리 정제 디스틸레이션(Trajectory-Refined Distillation, TRD)’을 제안한다. TRD는 디스틸레이션 이전에 문제 있는 접두사 부분을 보정함으로써 접두사 실패의 근본 원인을 제거한다. 또한, 원래의 롤아웃이 이미 정확하더라도 교사의 감독 하에 학생 모델에게 대안적인 유효한 유도(Valid derivations)를 노출시킴으로써 탐색(Exploration) 능력을 향상시킨다. TRD는 특권 정보(Privileged informations)에 조건화된 학생 모델을 교사로 사용하는 파라미터 공유 변형인 ‘온-폴리시 자기 디스틸레이션(On-policy Self-distillation, OPSD)’에도 적용될 수 있다.

One-sentence Summary

This work proposes Trajectory-Refined Distillation (TRD), a trajectory-level correction method for large language models that mitigates prefix failure by revising student rollouts under teacher guidance to address fragmented gradients and improve exploration beyond token-level interventions, applicable to both on-policy distillation and on-policy self-distillation settings.

Key Contributions

  • The work identifies and formalizes prefix failure as a structural cause in on-policy distillation where dense supervision creates bimodal teacher mixtures that token-level loss interventions fail to address. This diagnostic insight establishes the need for trajectory-level corrections over per-token loss reweighting.
  • The paper introduces Trajectory-Refined Distillation (TRD), a trajectory-level correction method that revises student rollouts under teacher guidance while retaining on-policy support. TRD mitigates the identified failure mode at its source and enhances exploration by exposing the student to alternative valid derivations during the refinement process.
  • Experiments on five competition-math benchmarks and code generation tasks demonstrate that TRD achieves the best average performance against baselines using Qwen3 models. The method shows pronounced gains on the AMOBench dataset, delivering approximately 50% relative Pass@16 improvements for Qwen3-8B under an on-policy self-distillation setup.

Introduction

On-policy distillation serves as a critical post-training mechanism for large language models by delivering dense per-token teacher supervision during student rollouts. Despite its widespread adoption, vanilla approaches often encounter prefix failure where incorrect reasoning paths create fragmented gradients that token-level loss reweighting cannot resolve. The authors propose Trajectory-Refined Distillation (TRD) to address this structural limitation by shifting from per-token adjustments to trajectory-level output corrections. TRD revises the student rollout under teacher guidance to mitigate prefix failure at its source while enhancing exploration across various math and code benchmarks in both standard and self-distillation settings.

Method

Standard on-policy distillation (OPD) and on-policy self-distillation (OPSD) suffer from a structural limitation known as prefix failure. When a student model generates an incorrect reasoning path, the teacher distribution becomes a mixture of modes: one that continues the error for consistency and another that pivots toward the correct solution. This creates a noisy supervisory signal. As shown in the figure below, the choice of KL divergence interacts with this mixture asymmetrically. Forward KL, being mode-covering, dominates the correction region which is out-of-distribution for the student, potentially causing instability. In contrast, Reverse KL, being mode-seeking, focuses on the wrong continuation region where the student already places high probability mass, effectively ignoring the correction signal. Furthermore, standard distillation generates a fragmented gradient because the teacher conditions on the frozen failed prefix at every step rather than the unfolding correction path.

To overcome these issues, the authors introduce Trajectory-Refined Distillation (TRD). This method operates at the trajectory level to optimize the expected verifier pass rate while respecting the on-policy support constraint. Refer to the framework diagram to visualize the refinement process where the teacher constructs a corrected trajectory yry_ryr starting from the student's initial rollout yoy_oyo. The training procedure involves three main steps. First, the student samples a raw rollout yoπθ(x)y_o \sim \pi_\theta(\cdot \mid x)yoπθ(x). Second, the teacher generates a refined trajectory yrπT(x,yo)y_r \sim \pi_T(\cdot \mid x, y_o)yrπT(x,yo). In the OPSD setting, the teacher shares the student's parameters but is conditioned on privileged information such as the reference solution yy^*y. Third, the student is updated to match the distribution of the refined trajectory yry_ryr.

The distillation objective uses forward KL divergence with full vocabulary matching to provide stable mode-covering supervision. The loss function is defined as:

L(θ)=ExDyoπθ(x)yrπT(x,yo)[1yrt=1yrD(sg[πT(x,yo,yr,<t)]πθ(x,yr,<t))]\mathcal { L } ( \theta ) = \mathbb { E } _ { \begin{array} { c } { x \sim \mathcal { D } } \\ { y _ { o } \sim \pi _ { \theta } ( \cdot \mid x ) } \\ { y _ { r } \sim \pi _ { T } ( \cdot \mid x , y _ { o } ) } \end{array} } \left[ \frac { 1 } { | y _ { r } | } \sum _ { t = 1 } ^ { | y _ { r } | } D \big ( \mathrm { s g } [ \pi _ { T } ( \cdot \mid x , y _ { o } , y _ { r } , < t ) ] \, \, \big \Vert \pi _ { \theta } ( \cdot \mid x , y _ { r } , < t ) \big ) \right]L(θ)=ExDyoπθ(x)yrπT(x,yo)yr1t=1yrD(sg[πT(x,yo,yr,<t)]πθ(x,yr,<t))

By supervising along the refined trajectory yry_ryr instead of the raw rollout yoy_oyo, TRD recovers the ideal gradient structure. The supervision contexts grow along the correction path itself rather than being anchored to the failed prefix. This allows the student to learn the multi-step unfolding of the correction rather than receiving fragmented signals. Additionally, this approach boosts exploration by surfacing alternative valid derivations suggested by the teacher that the student might not sample independently.

Experiment

The study evaluates the proposed TRD method against standard dense-KL baselines across math and code benchmarks using Qwen3 models in both OPD and OPSD settings. Experiments validate the prefix failure mechanism by demonstrating that standard KL supervision provides diminishing signals on incorrect rollouts, whereas TRD successfully refines trajectories to correct dead-end prefixes without destabilizing existing capabilities. Qualitative analysis reveals that TRD produces significantly shorter and more accurate reasoning paths, consistently outperforming baselines by expanding the reachable solution space on hard problems while maintaining training stability.

The authors evaluate TRD against four dense-KL baselines using Qwen3 models on math and code benchmarks. Results show that TRD consistently outperforms the base model and other methods across most metrics, whereas standard baselines often degrade performance relative to the base. TRD achieves the top performance on the majority of math and code benchmarks for both model scales. Baseline methods frequently show negative improvements compared to the base model, particularly on math tasks. TRD successfully improves performance on HumanEval+ and MBPP+ code benchmarks where other methods struggle.

The the the table details the hyperparameter configurations for the proposed TRD method and four dense-KL baselines evaluated in the study. The baselines are set up to train on raw student rollouts with vanilla prompts and shorter sequence limits, whereas the proposed method uses refined trajectories with a refinement prompt and longer context windows. This setup supports the experimental findings that the proposed method outperforms the baselines by avoiding prefix failure and providing better supervision signals. Baselines utilize raw on-policy rollouts for training while the proposed method employs refined trajectories. The proposed method is configured with a refinement teacher prompt unlike the vanilla prompts used by baselines. The proposed method supports longer maximum training sequence lengths compared to the baseline configurations.

The the the table compares the performance of OPD and OPSD training settings against a Teacher model across five math benchmarks using Avg@16 and Pass@16 metrics. Results indicate that while the Teacher model generally maintains the highest performance, the OPSD setting tends to achieve higher Pass@16 scores on most benchmarks, whereas OPD shows stronger Avg@16 performance on specific datasets. OPSD achieves higher Pass@16 scores than OPD on the majority of benchmarks. OPD records better Avg@16 results than OPSD on AIME24 and HMMT25. The Teacher model consistently outperforms both student settings across all reported metrics.

The authors evaluate the TRD method under the OPSD setting by comparing the full refined training corpus against ablated subsets filtered by trajectory outcomes. Results show that the complete dataset consistently outperforms restricted subsets and the base model across multiple math benchmarks. This indicates that leveraging the full breadth of refined trajectories is essential for maximizing performance, particularly in Pass@16 metrics. The full TRD method achieves the highest performance across all benchmarks, outperforming both the base model and filtered variants. Restricting the training corpus to specific trajectory outcomes leads to significant performance degradation compared to using the full refined dataset. The experiments confirm that diverse training signals from the complete corpus are more effective than privileged subsets for improving model capabilities.

The authors evaluate TRD against four dense-KL baselines in an OPSD setting using Qwen3 models. Results indicate that TRD consistently matches or exceeds the base model's performance across all math benchmarks, whereas standard KL baselines often degrade performance or show mixed results. Specifically, TRD delivers significant gains on harder benchmarks for the larger model without sacrificing performance on saturated tasks. TRD preserves the base model's performance on saturated benchmarks while achieving consistent improvements on more difficult tasks across both model scales. Standard dense-KL baselines frequently regress below the base model performance, particularly on the smaller student, whereas TRD preserves base capabilities. The larger model with TRD shows notable gains on difficult benchmarks compared to both the base and other refinement methods.

The authors evaluate TRD against dense-KL baselines and a Teacher model using Qwen3 models on math and code benchmarks within an OPSD setting, employing refined trajectories and longer context windows. Results demonstrate that TRD consistently outperforms the base model and other methods, whereas baseline approaches often degrade performance, particularly on math tasks. Additionally, ablation studies validate that the full refined training corpus is essential for maximizing capabilities, allowing TRD to improve on difficult benchmarks without sacrificing performance on saturated tasks.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp