Supervised fine-tuning on agent trajectories is an effective way to improve coding agents, but selecting useful training examples requires more than identifying successful runs. A resolved patch may follow inefficient reasoning or unnecessary tool use, while a failed run may still contain useful intermediate steps. Training pipelines therefore rely on rules and qualitative assessments to filter trajectories, yet designing these filters typically requires substantial human expertise, and validating improvements through repeated training and evaluation is expensive. We introduce MetaCurate, a training-free framework that evolves executable trajectory curation filters using pairwise LLM judgments. Disagreements between the filter's rankings and the judge's preferences provide targeted feedback for jointly revising its rules, rubric, and aggregation policy. The resulting filter scores trajectories independently, so pairwise comparisons are required only during search. Starting from a blank filter, MetaCurate autonomously discovers a curation strategy that achieves competitive downstream performance without task-specific handwritten criteria. We validate downstream utility through controlled SFT experiments on our uncurated trajectory pool and the Nemotron v3 SWE dataset, with random selection and hand-authored filtering as baselines. In our experiments, MetaCurate achieves the highest mean SWE-Verified score among the compared methods, including hand-authored rule-based filtering and a training-loop baseline whose search costs 3.5x as much.
Figures & tables
Figure 1: Comparison of four approaches to selecting agent trajectories for SFT. Outcome-only filtering can retain poor reasoning that leads to a correct patch and discard useful reasoning that ends in failure. No-Loop curation applies a fixed rule-based or LLM-based filter without feedback on the selected data. Train-and-Validate uses downstream training and evaluation to revise the selection, requiring a training run for each candidate. MetaCurate iteratively revises the curation filter using pairwise judge feedback, without model training during search.
Figure 2: Training feedback costs 3.5 times as much and evaluates only 3 candidates against 45.
Figure 3: One iteration of MetaCurate . The proposer edits the current filter and submits candidate filters (i.e., rules, rubric, and policy). The solver applies each candidate to the pool and gives every trajectory a score, which orders the pool. The candidate whose ordering agrees most with these verdicts is kept (see Section 4.3 for the promotion rule), and all scores, verdicts, and rationales are written to the file system for the next proposer.
Method
Task-specific Hand-authored or Oracle Information
DSv4Pro
Nemotron v3
Base model
—
53.9 ± 2.0
53.9 ± 2.0
Full pool (volume anchor)
N/A
63.1 ± 1.2
54.0 ± 1.6
Random
N/A
61.7 ± 1.6
52.9 ± 1.3
Resolved ( Yuan et al., 2023 )
Execution labels
61.9 ± 0.7
54.4 ± 0.2
Gold-patch recall ( Shen et al., 2026 )
Reference patches
61.7 ± 2.4
53.9 ± 0.5
Rule filter ( Blakeman et al., 2026 )
7 signals, 6 thresholds
63.1 ± 1.4
54.4 ± 0.5
Table 1: Downstream performance of Qwen 3.5 9B across curation methods on two pools, with a default training budget of 1,000 trajectories. Scores are SWE-bench Verified resolved rates (%). The second column lists hand-authored guidance or oracle information strictly required for curation.
Figure 4: Curation-loop ablations. ( 4(a) ) A blank seed achieves concordance comparable to a handwritten filter, without task-specific handwritten initialization. ( 4(b) ) Sol Pro achieves higher concordance than Luna as proposer with the same solver and judge. ( 4(c) , 4(d) ) Judge preferences and solver rankings largely agree across models. Both matrices follow the model order shown in ( 4(d) ). ( 4(e) ) Presentation-order flips are more frequent for closely ranked trajectories.
128,000 tokens, no packing, loss on assistant turns only
Gradient clipping
1.0
Appendix
Table 6: Training and evaluation settings. Shared settings are listed separately from each model’s fine-tuning method and learning rate.
Figure 5: A plausible hand-written filter need not behave as intended. (a) Two of six criteria scarcely vary over 200 trajectories. (b) Dropping each criterion changes pairwise orderings (bars) and rank distance 1−ρ (dots); the nearly constant criteria change almost nothing. (c,d) The same criterion scores for trajectories A–C yield different rankings under five aggregation policies. Shading marks the top 50; filled markers mean selection probability at least one half. In (d), gated denotes gated mean and lex denotes verif-lex.
Figure 6: Top-50 policy overlap with shared scores.
Figure 7: Search history from a blank seed over twelve iterations. Each row shows the current filter on the left and proposed candidates on the right; C and R denote the numbers of criteria and rules. Empty slots indicate candidates that did not pass precheck (Algorithm 1 ). Red and blue indicate positive and negative concordance differences from the current filter, with darker colors indicating larger differences. Green outlines mark promoted candidates. Orange dashed outlines mark eligible candidates in iterations where the provisionally selected candidate failed re-evaluation, leaving the current filter unchanged.
Figure 8: Search history from a handwritten seed over twenty iterations. Notation and color scale match Fig. 7 . Mostly pale cells indicate few large departures from the current filter, consistent with greater inertia than in the blank-seed run.
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.
Large language model (LLM) agents require post-training methods that can improve long-horizon decision making from environment feedback. However, existing agentic post-training pipelines often treat data curation as a fixed preprocessing step, focusing mainly on data augmentation while neglecting filtering, refinement, and adaptation to downstream failures. We propose CurateEvo, a failure-driven dynamic evolution framework for agentic post-training data curation. CurateEvo represents the curation strategy as executable code and iteratively rewrites it using failed trajectories from a held-out development set. At each epoch, the evolved strategy transforms a fixed raw corpus into supervised fine-tuning data, reinforcement learning data, and an inference-time memory bank. The evolution process first improves effectiveness by diagnosing recurring failure modes and augmenting, filtering, or refining data accordingly, and then improves efficiency by pruning redundant or low-utility training turns under a cost-aware objective. Experiments on ACEBench-Agent, BFCL-V4, and τ^2-Bench under both labeled and wild-data settings show that CurateEvo consistently outperforms prior curation methods, improving average scores by 3.2 and 2.7 points, respectively. Further analyses demonstrate that CurateEvo is compatible with different post-training recipes and substantially reduces curation overhead.
Open coding agents are commonly trained through supervised fine-tuning on interaction trajectories whose final patches pass the benchmark test suite. However, this outcome-level filtering criterion ignores process quality: trajectories that eventually succeed may still contain inefficient interaction patterns such as repetitive file inspection, unstable tool usage, or delayed modification behavior, all of which become part of the imitation target. We propose TQS (Trajectory Quality Score), a structural scoring framework for coding-agent trajectories that operates directly on trajectory structure, requires no LLM judge, and runs in linear time. TQS characterizes trajectory quality through structural signals organized around structured convergence: information focus, intent--action alignment, and policy dynamics. Using 155,144 successful trajectories from a public open-license corpus, we rank trajectories by TQS and fine-tune coding agents on filtered subsets. Models trained on top-ranked trajectories consistently outperform those trained on random or bottom-ranked subsets on SWE-Bench-Verified. Our results suggest that process-level trajectory quality is an important factor in coding-agent supervision and that structural trajectory filtering provides an effective and scalable alternative to LLM-based data selection.
Sida Li, Yuanxin Liu, Shicheng Li +4
National Key Laboratory for Multimedia Information Processing, Peking University · Huawei Technologies Co., Ltd.