筛选高质量代码求解轨迹,用10%数据实现更好模型性能
SWE-Prime: Fewer Trajectories, Better Performance

- 分两阶段筛选:先挑优质轨迹,再评估每段解题步骤
- 仅用10%精选轨迹训练,性能反超完整数据集12.2%~24.2%
- 适合想提升代码生成模型质量的研究者与开发者
为提升大语言模型解决真实软件问题的能力,现有工作多依赖大规模代理轨迹数据集并进行监督微调(SFT)。但任务成功不等于高质量监督:成功轨迹仍可能包含低效、冗余或危险步骤。直接使用此类轨迹进行SFT会引入噪声,导致模型模仿不良解题行为。为此,我们提出SWE-Prime,一种多粒度、两阶段的SFT数据选择方法,在轨迹和片段层面逐步过滤训练数据。第一阶段基于过程质量、结果质量和数据代表性筛选出高质量且具代表性的成功轨迹子集;第二阶段将连续步骤分组为语义片段,依据其对最终解决方案的贡献、可学习性及潜在风险评估每个片段。微调时所有片段保留在序列中以维持上下文,仅被选片段参与损失计算。在SWE-Bench Pro和SWE-Bench Verified上的实验表明,使用SWE-Prime筛选出的10%轨迹子集进行训练,性能优于全量已解决数据集,相对提升达12.2%和24.2%。
原文摘要 · Abstract (English)
To improve large language models' ability to resolve real-world software issues, prior work has focused on constructing large-scale agent trajectory datasets and performing supervised fine-tuning (SFT) on successful trajectories. However, task success does not guarantee high-quality supervision: successful trajectories may still contain ineffective, redundant, or risky steps. Directly using such trajectories for SFT can introduce noisy supervision and encourage models to imitate undesirable problem-solving behaviors. Therefore, we propose SWE-Prime, a multi-granularity, two-stage SFT data selection method that progressively filters training data at the trajectory and segment levels. Specifically, the first stage performs trajectory-level screening based on process quality, result quality, and data representativeness, selecting a high-quality and representative subset of successful trajectories. The second stage performs segment-level selection by grouping consecutive steps into semantic segments and assessing each segment based on its contribution to the final solution, learnability, and potential risks. During SFT, all segments remain in the sequence to preserve context, while only selected segments contribute to the loss computation. Experiments on SWE-Bench Pro and SWE-Bench Verified show that training on the 10% trajectory subset selected by SWE-Prime outperforms training on the full resolved dataset, yielding relative performance gains of up to 12.2% and 24.2%, respectively.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。