SWE-Trail:面向编码智能体训练的历史引导轨迹收集
研究论文 · 2026/11/03
SWE-Trail 是一种用于编码智能体训练的历史引导轨迹收集方法。传统独立采样轨迹会导致后续轨迹冗余,而将历史作为建议暴露给智能体会造成训练-测试不匹配。SWE-Trail 利用历史指导收集方向,但保持历史在智能体上下文之外:在 rollout 中,历史用于识别需要额外收集努力的状态,智能体从常规上下文提出候选动作,SWE-Trail 从同一检查点短暂执行以决定继续路线。在 124B 学生模型上,SWE-Trail 在 SWE-bench Multilingual 和 SWE-bench Pro 上分别比独立采样提升 2.33 和 1.60 个百分点;无历史时仅提升 0.11 个百分点。
该研究解决了编码智能体训练中轨迹收集的关键问题:如何利用历史轨迹提高收集效率而不引入训练-测试不匹配。SWE-Trail 提供了一种简单有效的方案,并在大规模模型上验证了显著性能提升,对智能体训练数据收集具有实践指导意义。
Coding agents solve repository issues through long sequences of exploration, editing, and validation. These trajectories are increasingly used as post-training data, so how they are collected shapes what the trained model learns. A common approach is to sample multiple trajectories independently for each issue and then select or curate them. However, as more trajectories are sampled independently, later trajectories become increasingly redundant, even though earlier trajectories could guide where subsequent collection effort should be spent. A natural way to use this history is to expose it to the coding agent as advice. But training on such trajectories can make the model rely on advice that is unavailable at test time, creating a train-test mismatch. Instead, we argue that history should guide where collection effort is spent, while the coding agent decides what to generate. We introduce SWE-Trail, a trajectory collector that uses earlier trajectories to guide subsequent collection while keeping that history outside the coding agent's context. During a new rollout, SWE-Trail uses history to identify a state where additional collection effort may be useful. There, the coding agent proposes candidate next actions from its ordinary context, and SWE-Trail briefly executes them from the same checkpoint to decide which route continues. We evaluate collection approaches by training student models on the trajectories they produce. For a 124B student initialized from Ling-3.0-flash-base, SWE-Trail improves mean resolution over independent sampling by 2.33 and 1.60 percentage points on SWE-bench Multilingual and SWE-bench Pro, respectively. Without history, the same pipeline produces more resolved trajectories than independent sampling, but improves by only 0.11 points on Multilingual. These results show the value of using history to guide collection without exposing it to the coding agent.