研究代码智能体训练中轨迹数据的质量与数量如何影响效果。
A Systematic Evaluation of Trajectory Data Curation for LoRA Fine-Tuning of Code Agents
- 提出效率与风格双维度评分框架,系统评估轨迹质量。
- 小样本时数据量更重要,大样本下高质量轨迹价值更显著。
- 发现错误重试率是影响性能的关键因素,适合做数据筛选参考。
在开源大模型上基于专家代理轨迹进行监督微调,已成为构建强大代码智能体的重要路径。然而,轨迹质量与数量如何共同影响模型表现仍缺乏系统研究。本文针对Qwen2.5-Coder-7B-Instruct模型,在包含67,074条轨迹(其中32,161条成功解决)的SWE-trajectory数据集上开展系统实验。提出基于效率与风格的双轴质量评分框架,通过16组受控实验分析策略、规模与消融效果。由于7B模型在端到端求解率接近零,采用保留轨迹上的交叉熵损失作为主指标,并通过首步生成验证其有效性:该指标与ROUGE-L完全负相关(Spearman ρ = -1.00),且小样本证据支持但未确认此代理指标的可靠性。结果表明存在依赖规模的质量-数量权衡:在500至1,000条时,数据量翻倍可降低约12.7%的CE损失,而优质随机轨迹差距不足1%(p > 0.10);但在2,000条时,该差距扩大至3.6%(p = 0.016)。消融分析显示错误重试率是主导子维度,其表现接近完整评分(Δ < 0.2%)。研究证实轨迹级质量评分在特定场景下可行,为无法使用完整求解率的训练阶段提供验证方法。
原文摘要 · Abstract (English)
Supervised fine-tuning (SFT) of open-weight LLMs on expert agent trajectories has emerged as a prominent approach to building capable code agents without reliance on proprietary models. A central yet underexplored question is how trajectory quality and quantity jointly shape model performance. We present a systematic empirical study of trajectory data filtering for LoRA fine-tuning of Qwen2.5-Coder-7B-Instruct on the SWE-trajectory dataset (67,074 trajectories, of which 32,161 are resolved). We propose a two-axis quality scoring framework -- Efficiency and Style -- and evaluate it through 16 controlled experiments spanning strategy, scale, and ablation analyses. Since 7B-scale models attain near-zero SWE-bench resolve rates, we adopt cross-entropy (CE) loss on held-out trajectories as the primary metric, validated via first-action generation: CE loss and ROUGE-L are perfectly rank-correlated (Spearman $ρ$ = -1.00), with limited-sample evidence supporting but not conclusively establishing this proxy. Our results reveal a scale-dependent quality-quantity trade-off: at small scales, doubling the dataset (500 to 1,000) yields ~12.7% CE-loss reduction whereas the TopQ-Random gap stays <1% (Mann-Whitney p > 0.10); at 2,000 trajectories this same gap widens to 3.6% (p = 0.016). Ablation further identifies error-retry rate as the dominant sub-dimension, performing comparably to the full composite ($Δ$ < 0.2%). Together, these findings establish trajectory-level quality scoring as a viable but scale-sensitive lever for code-agent SFT and offer a proxy-validated evaluation protocol for the regime where end-to-end resolve rate is statistically infeasible.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。