Rust in Everything
← Papers

SWE-Trail: History-Guided Trajectory Collection for Coding Agent Training

Ziming Li, Lu Yu, Jiatan Huang, Qing Cui, Jun Zhou, Chuxu Zhang

2026-11-03▲ 34arXiv 2611.02074v1Hugging Face

AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.

TL;DR

SWE-Trail uses prior attempts as collector-side history to choose where to compare candidate actions during coding-agent rollouts, then trains students on the resulting trajectories.

Problem

Independent sampling of coding-agent trajectories per issue becomes redundant: later attempts add less coverage and revisit repair targets. Existing collection methods generate trajectories independently or put prior experience into the agent's context, which can make training records depend on advice unavailable at test time. The paper asks how history can guide where collection effort is spent while the coding agent still generates actions from its ordinary context.

Method

SWE-Trail compiles each issue's history and read-only repository checks into a private acquisition record with detector rules, local comparison objectives, and a sampling-temperature schedule. During a new rollout, the detector matches states where additional collection effort may be useful; the coding agent then proposes candidate next actions from its ordinary context, without the history or record. SWE-Trail groups equivalent proposals, keeps a default and at most one executable alternative, and restores two isolated workspaces from the same checkpoint to execute short suffixes. An identity-blind selector compares the shuffled suffixes under the local objective and retains the default unless executed evidence clearly favors the alternative. The rollout continues only from the selected route, and export keeps one continuous coding-agent trajectory while removing the unselected suffix and private collector events.

Results

  • H5 improves mean resolution over SeedBank by 2.33 and 1.60 points, whereas H0 improves it by 0.11 and 0.73 points. §4.2
  • The Qwen3-14B-Base student also improves over SeedBank and H0 under H5. §4.2
  • Randomizing the comparison location or the retained route lowers mean resolution relative to H5. §4.2
  • Increasing history from five to ten attempts gives only small gains at higher token cost. §4.3
  • Verifier selection from ten independent rollouts remains below H5, while selection over combined SeedBank and H5 trajectories exceeds H5. §4.3
  • H0 produces more resolved trajectories than SeedBank but adds little Multilingual student gain; H5 adds more resolved trajectories and a larger student gain over H0. §4.4

Limitations

  • Stated in §6: experiments use two student models but only one collection model and one agent scaffold.
  • Stated in §6: history is fixed during each collection round, and the same collection budget is used for every issue.
  • Stated in §6: extending SWE-Trail beyond coding would require environments that support state restoration and feedback for comparing alternatives.
  • Left open by §4.2 and E.2: the H5-H0 task-paired 95% intervals include zero on both benchmarks, so the downstream advantage of history over the no-history pipeline is not resolved by that contrast.

Key points

  • Independent attempts show diminishing coverage: expected solved issues rise from 58.4 at k=1 by 13.1, then 8.0, 5.1, and 3.4 for later attempts. §2.1
  • The mixed-history audit uses 43 primary pairs; GPT-5.6-Sol identifies decision points in 26 issues and GLM-5.1 in 31, with 20 identified by both. §2.2
  • The compiler extracts history evidence, runs bounded read-only repository checks, and freezes detector rules, comparison objectives, and sampling schedules before collection. §3.1
  • At a matched detector state, the coding agent proposes candidates from its ordinary context; SWE-Trail keeps the default and at most one executable alternative and executes both from the same checkpoint. §3.2
  • The selector sees shuffled suffixes with hidden identities, uses the private record only as background, and keeps the default unless executed evidence clearly favors an alternative. §3.3
  • H5 candidate sampling occurs in 1,147 of 1,500 rollouts versus 664 under H0; both suffixes execute in 968 versus 560 rollouts. §4.5
  • Mixed histories account for 13 of H5's 16 additional resolved trajectories and five of its six additional solved issues relative to H0. §4.4
  • H5 compiles 687 candidate detector rules; 569 match a source trajectory and 397 pass admission. §B.4

Mind map

SWE-Trail
Motivation
Diminishing coverage
History allocation signals
Mixed-history audit
Method
Compile history into detectors
Sample alternatives from agent context
Execute and blind select
Export continuous trajectory
Experiments
300 SWE-rebench V2 issues
SeedBank baseline
H0 no-history control
H5 and H10 history
Randomized controls
Two student models
Results
H5 gains over SeedBank
H0 small Multilingual gain
Randomization lowers resolution
Mixed histories drive gains
Selection complements collection
H10 small gain high cost
Limitations
One collection model and scaffold
Fixed history and uniform budget
Coding-specific state restoration