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
Published November 1, 2026 · on the feed November 3, 2026 · ▲ 40 · arXiv 2611.02074
The abstract
Coding agents solve repository issues through long sequences of exploration, editing, and validation. These 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, even though earlier trajectories could 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. But training on such trajectories can make the model rely on advice that is unavailable at test time, creating a train-test mismatch. Instead, we argue that history should guide where collection effort is spent, while the coding agent decides what to generate. 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. There, the coding agent proposes candidate next actions from its ordinary context, and SWE-Trail briefly executes them from the same checkpoint to decide which route continues. We evaluate collection approaches by training student models on the trajectories they produce. 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 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.
The Brief
2:52A short podcast summary of the paper. Written and voiced by AI.
Transcript
SWE-Trail. History-Guided Trajectory Collection for Coding Agent Training. By Ziming Li and five others, from the University of Connecticut and Ant Group. Published on the first of November.
Coding agents solve repository issues through long sequences of exploration, editing, and validation. Those trajectories are increasingly used as post-training data, which means the way they are collected shapes what the trained model learns. A common approach samples multiple trajectories independently for each issue, then selects or curates them. The trouble is diminishing returns. As more trajectories are sampled independently, the later ones become increasingly redundant, even though the earlier ones could have guided where further collection effort should be spent. Each new sample starts fresh, as if nothing had been learned about that issue so far.
The natural fix is to show that history to the coding agent as advice. The authors explain why that backfires. Training on trajectories produced with advice can make the model rely on advice, and at test time there is none to rely on. That is a train-test mismatch, built into the data.
Their alternative splits the job in two. History should guide where collection effort is spent, while the coding agent decides what to generate. SWE-Trail is a trajectory collector built on that division. It uses earlier trajectories to guide subsequent collection, while keeping that history outside the coding agent's context altogether.
During a new rollout, SWE-Trail uses the history to identify a state where additional collection effort may be useful. At that state, the coding agent proposes candidate next actions from its ordinary context, the same context it would have with no history at all. SWE-Trail then briefly executes those candidates from the same checkpoint, and uses what happens to decide which route continues. The history steers where the branching happens, and the agent's own proposals supply what happens there. Nothing the agent sees refers to earlier attempts, which is what keeps the resulting data free of advice the model would never get at test time.
Collection approaches are judged by their downstream effect: student models are trained on the trajectories each approach produces, and the students are compared. For a one hundred and twenty-four billion parameter student initialized from Ling-3.0-flash-base, SWE-Trail improves mean resolution over independent sampling by two point three three percentage points on SWE-bench Multilingual. On SWE-bench Pro, the gain is one point six zero percentage points.
A further comparison isolates the role of history. Without it, the same pipeline still produces more resolved trajectories than independent sampling does. But the student trained on them improves by only zero point one one points on Multilingual. More solved trajectories alone bought very little; the history-guided choice of where to spend effort is what moved the result.
The design rests on one separation. Information that helps gather data does not have to be information the model sees. Keeping history on the collector's side lets earlier attempts shape later ones, without teaching the model to expect help it will not have when it is actually deployed on new issues.
Paper Quest · 7 chapters · about 41 min
Play this paper
Learn it by doing: make the calls the authors made, guess the result before you see it, and defend it in a viva graded on your own words. Chapter 1 is right here.
Chapter 1 🧩 · The problem
More samples, less news. Every new try repeats the last ones, and the obvious fix hides a trap.
You collect coding agents' trajectories on repository issues to use as training data. The usual way samples several tries per issue independently and keeps the good ones.
The road ahead
- 1 · The problem ~7 min Sampling many independent tries per coding issue wastes effort on repeats, and showing the agent its earlier tries as hints spoils the training data.
- 2 · What came before ~3 min
- 3 · The key idea ~9 min Earlier tries decide where extra collection effort goes, while the agent, which never sees them, decides what to try there.
- 4 · Choose your own research ~3 min
- 5 · Build the method ~8 min The collector uses history to spot a state, lets the agent propose actions, runs them briefly from one checkpoint, and keeps the better route.
- 6 · The experiment ~6 min You’ll guess: Run without any history, the same collection pipeline resolves more trajectories than independent sampling. How much does its student improve on SWE-bench Multilingual?
- 7 · The viva ~5 min Three questions from the examiners, answered in your own words. Win it for the paper’s trophy.
Free, with Google or an email address. Your stars and progress are kept.