ReTerm:自我改进终端代理的恢复训练

·

研究论文 · 2026/10/14

终端智能体在复杂编码任务中表现出较强能力,但在长时间执行中往往难以从错误(如命令错误、错误实现)中恢复,最终导致任务失败。为此,作者提出 ReTerm,一种通过从自身失败的终端任务中学习恢复来实现自我提升的终端智能体。为支持训练,他们构建了定制数据流水线并产出 ReTerm-10K,一个为 SFT 冷启动提供有效恢复演示的高质量数据集。此外,他们提出 ReTerm-GRPO,一种在线强化学习算法,从智能体自身的失败状态分叉,生成多个独立的自我恢复尝试,并通过这些尝试是否成功完成任务来学习,使智能体从自身恢复经验中自我提升。基于 Qwen3.5-9B 的 ReTerm-9B 在 Terminal-Bench 2.0 上达到 34.8% Pass@1,较基座模型提升 14.6 个百分点。进一步分析表明,与标准 GRPO 训练相比,该方法在多种错误类别上取得了一致更高的恢复率。所有代码、数据和模型已在 https://github.com/twothsnd/ReTerm 发布。

该工作针对终端智能体在长时执行中难以从错误恢复的关键问题,提出基于自身失败经验的自提升训练方法与在线强化学习算法,并在 Terminal-Bench 2.0 上取得显著提升,同时开源代码、数据和模型,对提升终端智能体的鲁棒性与自主恢复能力具有参考价值。

Terminal agents have shown strong abilities in complex coding tasks. However, they often struggle to recover from errors during long-running execution (e.g., command errors, faulty implementations), eventually leading to task failures. To this end, we present ReTerm, a self-improving terminal agent trained by learning how to recover from its own failed terminal tasks. To support its training, we construct a customized data pipeline and produce ReTerm-10K, a high-quality dataset that provides effective recovery demonstrations for SFT cold start. Furthermore, we propose ReTerm-GRPO, an online RL algorithm that forks from the agent's own failure states to generate multiple independent self-recovery attempts. By learning from whether these attempts successfully complete the task, the agent self-improves through its own recovery experience. Built on Qwen3.5-9B, our ReTerm-9B achieves 34.8% Pass@1 on Terminal-Bench 2.0, improving over the base model by 14.6 points. Further analysis shows that our method achieves consistently higher recovery rates across diverse error categories compared with standard GRPO training. All code, data and model are released at https://github.com/twothsnd/ReTerm.

阅读原文

参与讨论