From Trajectories to Prefixes: Reusing Teacher Trajectories via Replayed Prefixes and Online Continuation

Yihan Wang, Zhong Guan, Haoran Sun, Jiale Huang, Likang Wu +1 more
7/3/2026
2 citations
cs.LGcs.AI
rlrlhf-rlvr-dpodistillation

Official code: HappynessI/Prefix_GRPO (123 stars, Python, Apache-2.0, last commit 2026-10-04).

Abstract

Small language models are attractive backbones for interactive agents, but direct distillation from strong teacher trajectories often turns rich multi-turn behavior into one-shot imitation targets. This is inefficient in long-horizon environments, where early decisions shape later states and rewards.

Show full abstract

We propose Prefix-GRPO, a reinforcement learning framework that decomposes teacher trajectories into replay-aligned prefix queries and online continuations. Each prefix is replayed in the environment to recover a valid intermediate state, after which the student continues online interaction and receives task reward. Unlike response-only GRPO, Prefix-GRPO also applies clipped policy updates to historical assistant tokens inside the replayed prefix, using a policy-distilled SFT checkpoint to estimate their old log-probabilities. This unifies prefix learning and continuation learning within the same policy-optimization form. Experiments on TextCraft, BabyAI, and ALFWorld show that Prefix-GRPO improves small-model agents over distillation and standard RL baselines, while ablations show that replay alone is insufficient without explicit prefix-token optimization. The implementation and reproduction scripts are available at https://github.com/HappynessI/Prefix_GRPO.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

This repository contains experimental reports and training results for my research

1232Python, ShellDec 12, 20251 months agoApache-2.0

Similar Papers

Cite this paper

@article{wang2026from,
  title  = {From Trajectories to Prefixes: Reusing Teacher Trajectories via Replayed Prefixes and Online Continuation},
  author = {Yihan Wang and Zhong Guan and Haoran Sun and Jiale Huang and Likang Wu and Hongke Zhao},
  year   = {2026},
  eprint = {2607.19395},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.19395v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.19395.svg)](https://codeofpaper.com/paper/2607.19395)

Discussion