代码智能体轨迹数据筛选对LoRA微调的效果:系统评估

A Systematic Evaluation of Trajectory Data Curation for LoRA Fine-Tuning of Code Agents

精选理由

这篇论文系统测试了用SWE-trajectory数据微调Qwen2.5-Coder时,不同轨迹筛选方法的效果,发现数据质量和数量在不同规模下影响不同,值得参考。

AI 摘要

研究者对Qwen2.5-Coder-7B-Instruct模型在SWE-trajectory数据集(67,074条轨迹,32,161条已解决)上进行LoRA微调,提出效率和风格两维度质量评分框架,并通过16组对照实验分析策略、规模与消融。在7B模型SWE-bench解决率近零的情况下,采用交叉熵损失替代评估,发现其与ROUGE-L完全秩相关(Spearman ρ=-1.00)。结果揭示规模依赖的质量-数量权衡:500到1000条时数据翻倍降低约12.7%损失,但TopQ与随机差距小于1%;2000条时差距扩大到3.6%(p=0.016)。消融实验确认错误重试率是主导子维度,表现与完整复合指标相当(Δ<0.2%)。

原文 · arXiv cs.AI

A Systematic Evaluation of Trajectory Data Curation for LoRA Fine-Tuning of Code Agents

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.