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

DevFeed: [SWE-Trail: History-Guided Trajectory Collection for Coding Agent Training](<https://devfeed.tech/articles/swe-trail-history-guided-trajectory-collection-for-coding-agent-training-113517.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.02074>)

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

Published: 2026-11-03T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [post-training](<https://devfeed.tech/topics/post-training.md>), [agentic-coding](<https://devfeed.tech/topics/agentic-coding.md>), [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>)

Tags: [actions](<https://devfeed.tech/tags/actions.md>), [advice](<https://devfeed.tech/tags/advice.md>), [agent](<https://devfeed.tech/tags/agent.md>), [agent-training](<https://devfeed.tech/tags/agent-training.md>), [agents](<https://devfeed.tech/tags/agents.md>), [checkpoint](<https://devfeed.tech/tags/checkpoint.md>), [coding](<https://devfeed.tech/tags/coding.md>), [coding-agent](<https://devfeed.tech/tags/coding-agent.md>), [coding-agents](<https://devfeed.tech/tags/coding-agents.md>), [collection](<https://devfeed.tech/tags/collection.md>), [collector](<https://devfeed.tech/tags/collector.md>), [context](<https://devfeed.tech/tags/context.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [data](<https://devfeed.tech/tags/data.md>), [exploration](<https://devfeed.tech/tags/exploration.md>), [history](<https://devfeed.tech/tags/history.md>), [model](<https://devfeed.tech/tags/model.md>), [models](<https://devfeed.tech/tags/models.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [post-training](<https://devfeed.tech/tags/post-training.md>), [training](<https://devfeed.tech/tags/training.md>)

## AI overview

SWE-Trail uses earlier coding trajectories to direct where later collection effort is spent, while keeping that history out of the coding agent's context to avoid training it to rely on unavailable advice. At a promising state, the agent proposes next actions using its ordinary context; the collector briefly runs candidates from the same checkpoint and chooses a route to continue. In training a 124B student initialized from Ling-3.0-flash-base, this history-guided collection improved mean resolution over independent sampling by 2.33 percentage points on SWE-bench Multilingual and 1.60 on SWE-bench Pro. The same pipeline without history produced more resolved trajectories than independent sampling but improved Multilingual resolution by only 0.11 points.

## Source excerpt

arXiv:2611.02074v1 Announce Type: cross 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.