OPID:基于策略的技能蒸馏在代理式强化学习中的应用
OPID: On-Policy Skill Distillation for Agentic Reinforcement Learning
摘要
基于结果的强化学习为语言代理提供了稳定的优化框架,但其稀疏的轨迹级奖励难以指导应强化或抑制哪些中间决策。在线策略自我蒸馏则能提供丰富的令牌级监督信息,不过现有的技能条件化变体往往依赖外部技能记忆或被检索到的特殊上下文,这些都需要大量资源来维护,且可能与当前策略在多轮交互中产生的状态分布不匹配。我们提出了OPID(在线策略技能蒸馏)框架,该框架能够直接从完成的在线策略轨迹中提取技能监督信息。OPID将轨迹的“后见之明”视为分层技能: episode级技能反映全局工作流程或避免失败的规则,而step级技能则反映关键时刻的局部决策知识。当识别出关键决策时,系统会采用step级技能作为指导方式;否则则默认使用episode级技能进行指导。被选中的技能会被纳入交互历史中,使得旧策略能够在原始环境和技能增强的环境中重新评估相同的响应结果。由此产生的对数概率变化带来了令牌级的自我蒸馏优势,这一优势与结果相关的优势相结合,从而有助于策略优化。OPID既保留了强化学习作为主要训练目标,又引入了丰富且符合分布特性的后见之明监督机制。在ALFWorld、WebShop以及基于搜索的QA任务上的实验表明,OPID通常能提升代理的性能、样本利用效率以及鲁棒性,优于仅基于结果的强化学习和现有的技能蒸馏方法。我们的代码可在https://github.com/jinyangwu/OPID/tree/main获取。
English Abstract
Outcome-based reinforcement learning provides a stable optimization backbone for language agents, but its sparse trajectory-level rewards provide little guidance on which intermediate decisions should be reinforced or suppressed. On-policy self-distillation offers dense token-level supervision, yet existing skill-conditioned variants often rely on external skill memories or retrieved privileged context, which are costly to maintain and can be mismatched with the state distribution induced by the current policy in multi-turn interaction. We propose OPID (On-Policy Skill Distillation), a framework that extracts skill supervision directly from completed on-policy trajectories. OPID represents trajectory hindsight as hierarchical skills: episode-level skills capture global workflows or failure-avoidance rules, while step-level skills capture local decision knowledge at critical timesteps. A critical-first routing mechanism uses step-level skills when critical decisions are identified and falls back to episode-level skills as default guidance otherwise. The selected skill is injected into the interaction history, allowing the old policy to re-score the same sampled response under both original and skill-augmented contexts. The resulting log-probability shift yields a token-level self-distillation advantage, which is combined with the outcome advantage for policy optimization. OPID thus preserves RL as the primary training objective while introducing dense, distribution-matched hindsight supervision. Experiments on ALFWorld, WebShop and Search-based QA demonstrate that OPID generally improves agent performance, sample efficiency, and robustness over outcome-only RL and existing skill-distillation baselines. Our code is available at https://github.com/jinyangwu/OPID/tree/main.