FC-SWE:面向长周期软件工程智能体的故障条件强化学习

·

研究论文 · 2026/10/19

FC-SWE 是一个面向长时程软件工程智能体的失败条件强化学习框架。现有 GRPO 方法在训练时独立采样多条轨迹并比较终端奖励,但不复用失败补丁的验证反馈作为后续尝试的上下文。FC-SWE 在补丁验证失败后,将仓库恢复到原始任务状态,并以失败补丁和验证反馈为上下文生成恢复轨迹。它通过轨迹局部奖励保留每次尝试的验证结果,并通过活跃集优势估计将同一问题实际执行的所有初始和恢复轨迹组成比较组。在 SWE-bench Verified 的 500 个任务上,使用 Qwen3.5-4B 和 SWE-agent,FC-SWE 达到 41.7% Resolved@1 和 52.8% Resolved@2,优于 GRPO 的 38.9% 和 48.5%;尽管训练时每条链最多两次尝试,在十一次尝试的测试预算下达到 70.7% Resolved@11。

该工作针对 SWE 智能体训练中失败反馈未被利用的问题,提出了可复用的失败条件 RL 框架,并在标准基准上验证了其有效性,对长时程智能体训练有参考价值。

Repository-level software engineering (SWE) is a challenging long-horizon setting: agents must reason over extended interactions, use tools, and adapt to stateful environments. Recent work trains SWE agents with reinforcement learning methods such as Group Relative Policy Optimization (GRPO), which independently sample multiple trajectories per issue, test the resulting patches, and compare terminal rewards within a fixed group. However, this training setup does not reuse verifier feedback from failed patches as context for subsequent attempts, even though this feedback contains valuable diagnostic information about what went wrong. Training on recovery trajectories is challenging because the preceding outcome determines whether the next trajectory is generated, while the failed execution determines its conditioning context. We introduce FC-SWE, a failure-conditioned RL framework that incorporates recovery attempts into policy training. After a patch fails verification, FC-SWE restores the repository to its original task state and uses the failed patch and verifier feedback as context for a recovery trajectory. FC-SWE adapts GRPO to these chains of complete, multi-turn tool-use trajectories through two mechanisms. Trajectory-local rewards preserve each attempt's verifier outcome, preventing recovery success from rewarding an earlier failed patch. Active-set advantage estimation forms a comparison group from all initial and recovery trajectories actually executed for the same issue, so failed attempts remain in the group while unexecuted attempts are excluded. On all 500 SWE-bench Verified tasks under a verifier-assisted protocol, FC-SWE with Qwen3.5-4B and SWE-agent achieves 41.7% Resolved@1 and 52.8% Resolved@2, compared with 38.9% and 48.5% for GRPO. Although trained with at most two attempts per chain, FC-SWE reaches 70.7% Resolved@11 under an eleven-attempt test-time budget.

阅读原文

参与讨论