SWE-Trail Uses History to Collect Better Coding-Agent Trajectories
Introduction
Coding agents rarely solve repository issues in a single step. They inspect files, trace behavior, edit code, run tests, interpret failures, and revise their approach. These long interaction histories are becoming an important source of post-training data. As a result, the way trajectories are collected can shape what a coding model learns just as much as the final filtering process.
The problem with independent sampling
A common pipeline runs an agent several times on the same issue and then selects or curates the resulting trajectories. This is simple, but repeated independent rollouts tend to become redundant. Later runs may revisit the same files, make similar edits, and follow the same dead ends, while other potentially useful states receive little attention.
One obvious solution is to show the agent previous trajectories and ask it to use them as advice. SWE-Trail argues that this creates a hidden risk: a model trained with such advice may learn to rely on information that will not be available during deployment. The training data would then reflect a richer context than the agent normally receives at test time.
How SWE-Trail works
SWE-Trail separates collection guidance from agent generation. During a new rollout, the collector uses earlier trajectories to identify a state or checkpoint where further exploration may be valuable. The coding agent is not shown that history. Instead, it proposes candidate next actions using only its ordinary context—the same information it would have during a normal run.
The collector briefly executes those candidate actions from the same checkpoint and uses the resulting evidence to decide which route should continue. In this design, history determines where to spend exploration budget, while the agent still determines what code operation or reasoning step to produce.
Key points
- Previous rollouts guide the collector, not the agent’s prompt.
- Candidate actions are compared from a shared checkpoint.
- The method targets useful diversity rather than simply increasing trajectory count.
- The final evaluation trains a student model on the collected data, measuring whether collection choices transfer to downstream performance.
Results and implications
The authors evaluate the data by training a 124B student initialized from Ling-3.0-flash-base. Compared with independent sampling, SWE-Trail increases mean resolution by 2.33 percentage points on SWE-bench Multilingual and 1.60 points on SWE-bench Pro.
The control result is particularly informative. When the same general pipeline is used without history, it produces more resolved trajectories than independent sampling, but improves performance on Multilingual by only 0.11 points. This suggests that the main benefit comes from history-guided allocation of collection effort, rather than from the pipeline structure alone.
The broader lesson is that coding-agent data generation is an exploration problem. Once easy or familiar paths have been sampled, additional compute may be more valuable when directed toward underexplored checkpoints. SWE-Trail also preserves a cleaner train-test boundary: historical information changes how examples are gathered, but does not become an extra capability the agent must depend on. The paper does not establish that the method is optimal for every repository task, yet it offers a practical way to balance trajectory diversity, collection cost, and deployment consistency.
Source: Hugging Face Daily Papers
Comments
Checking sign-in status...
Loading comments...