Manuscript Offprint

arXiv:2611.02074

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

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

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

UCONN MINDS LAB

ANT GROUP

SWE-Trail

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

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

¹University of Connecticut ²Ant Group

{ziming.li, chuxu.zhang}@uconn.edu jun.zhoujun@antgroup.com †Corresponding authors

Coding agents solve repository issues through long sequences of exploration, editing, and validation. These interaction trajectories are increasingly used as post-training data, so how they are collected shapes what the trained model learns. A common approach is to sample multiple trajectories independently for each issue and then select or curate them. However, as more trajectories are sampled independently, later trajectories become increasingly redundant. In fact, earlier trajectories can guide where subsequent collection effort should be spent. A natural way to use this history is to expose it to the coding agent as advice, helping it decide what to do next. But training on such trajectories can make the model rely on advice that is unavailable at test time, creating a train-test mismatch that may reduce downstream performance. Instead, we argue that history should guide where collection effort is spent, while the coding agent decides what to generate by itself. Based on this principle, we introduce SWE-Trail, a trajectory collector that uses earlier trajectories to guide subsequent collection while keeping that history outside the coding agent's context. During a new rollout, SWE-Trail uses history to identify a state where additional collection effort may be useful. When that state is reached, the coding agent proposes candidate next actions from its ordinary context. SWE-Trail briefly executes candidates from the same checkpoint and uses the results to decide which route continues. We compare collection approaches by training student models on the trajectories they produce and measuring downstream performance. For a 124B student initialized from Ling-3.0-flash-base, SWE-Trail improves mean resolution over independent sampling by 2.33 and 1.60 percentage points on SWE-bench Multilingual and SWE-bench Pro, respectively. Without history, the same collection pipeline produces more resolved trajectories than independent sampling, but improves by only 0.11 points on Multilingual. These results show the value of using history to guide collection without exposing it to the coding agent.

References (52)

  • Open-swe-traces: Advancing dual-mode multilingual distillation for software engineering agents
  • Swe-search: Enhancing software agents with monte carlo tree search and iterative refinement
  • Swe-rebench V2: language-agnostic SWE task collection at scale
  • Unifying count-based exploration and intrinsic motivation
  • Beyond quantity: Trajectory diversity scaling for code agents
  • Swe-exp: Experience-driven software issue resolution
  • Swe-bench pro: Can AI agents solve long-horizon software engineering tasks? arXiv, 2025
  • Swe-replay: Efficient test-time scaling for software engineering agents
  • Codemonkeys: Scaling test-time compute for software engineering
  • Deep adaptive design: Amortizing sequential bayesian experimental design
  • Data shapley: Equitable valuation of data for machine learning
  • Simple baselines are competitive with code evolution
  • Se-agent: Self-evolution trajectory optimization in multi-step reasoning with llm-based agents
  • SWE-TRACE: optimizing long-horizon SWE agents through rubric process reward models and heuristic test-time scaling
  • Self-abstraction from grounded experience for plan-guided policy refinement
  • CLEAT: Learning Value-Guided Clarification for Interactive Agents
  • R2e-gym: Procedural environments and hybrid verifiers for scaling open-weights SWE agents
  • Swe-bench: Can language models resolve real-world github issues? In ICLR, 2024
  • Scaling test-time compute for agentic coding
  • Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning
  • Bandit based monte-carlo planning
  • Understanding black-box predictions via influence functions
  • CODESKILL: learning self-evolving skills for coding agents
  • Same signal, opposite meaning: Direction-informed adaptive learning for llm agents (opens arXiv in a new tab)
  • Agentic harness engineering: Observability-driven automatic evolution of coding-agent harnesses
  • Llms as continuous learners: Improving the reproduction of defective code in software issues
  • From patches to trajectories: Privileged process supervision for software-engineering agents
  • Proplay: Procedural world models for self-evolving llm agents (opens arXiv in a new tab)
  • Self-refine: Iterative refinement with self-feedback
  • Experepair: Dual-memory enhanced llm-based repository-level program repair
  • Training software engineering agents and verifiers with swe-gym
  • Evolving agents in the dark: Retrospective harness optimization via self-preference
  • Curiosity-driven exploration by self-supervised prediction
  • Deep learning on a data diet: Finding important examples early in training
  • A self-improving coding agent
  • Active learning for convolutional neural networks: A core-set approach
  • Reflexion: language agents with verbal reinforcement learning
  • Judging the Justification: Decision Certificate Supervision for Generative Reward Models
  • Swe-lego: Pushing the limits of supervised fine-tuning for software issue resolving
  • Curateevo: Data-curation evolving for agentic post-training
  • Memgovern: Enhancing code agents through learning from governed human experiences
  • An open platform for AI software developers as generalist agents
  • Agent workflow memory
  • Agentgym: Evolving large language model-based agents across diverse environments
  • Live-swe-agent: Can software engineering agents self-evolve on the fly? arXiv, 2025
  • Socratic-swe: Self-evolving coding agents via trace-derived agent skills
  • Reducing cost of LLM agents with trajectory reduction
  • Doremi: Optimizing data mixtures speeds up language model pretraining
  • Swe-agent: Agent-computer interfaces enable automated software engineering
  • Swe-smith: Scaling data for software engineering agents
  • Expel: LLM agents are experiential learners
  • Language agent tree search unifies reasoning, acting, and planning in language models