Datasets:
Clarification on Context Resets and Switches in SFT Data Collection
Hi, thanks for sharing this work!
I noticed that the paper reports 64,505 SFT trajectories collected from 1,648 environments, and mentions that a single task-level rollout can be split into multiple trajectories due to Claude Code's context resets or switches.
Could you provide some additional statistics on this process?
How many independent task-level rollouts were conducted in total?
On average, how many context resets and context switches occurred per rollout?
What is the average number of SFT trajectory segments generated from a single rollout?
These details would help clarify the effective scale and diversity of the SFT data.
Thanks!
Thank you for your interest and for raising these questions!
How many independent task-level rollouts were conducted in total?
We conducted 1,648 independent task-level rollouts, one for each ProgramGym task.
On average, how many context resets and context switches occurred per rollout?
On average, there were approximately 38.1 context resets or switches per rollout (combined). These events mainly fall into two categories:
- System prompt updates: Claude Code updates its system prompt during execution (e.g., when workspace files change), while preserving the conversation history.
- Context compaction: When the context becomes too long, Claude Code automatically compacts it, modifying the preceding conversation history.
In our observations, system prompt updates occurred approximately every 4 steps, while context compaction occurred roughly every 100 steps.
What is the average number of SFT trajectory segments generated from a single rollout?
Each rollout generated approximately 39.1 SFT trajectory segments on average (64,505 segments across 1,648 rollouts).
Each segment contains approximately 51 steps on average, but only about 4 steps provide new SFT training targets. The remaining steps are included as historical context and have already appeared as training targets in preceding segments.
Therefore, although our dataset contains 64,505 SFT trajectories, these segments are not independent task-level executions. Rather, they are overlapping training segments derived from 1,648 independent rollouts, with most segmentation boundaries arising from Claude Code's frequent system prompt updates.
Thanks for the detailed breakdown on ProgramGym's rollout metrics! The distinction between independent rollouts and overlapping SFT segments is crucial for understanding data diversity. I'm curious: how does this segmentation strategy impact model generalization compared to strictly independent trajectories?
Thanks for the detailed breakdown on ProgramGym's rollout metrics! The distinction between independent rollouts and overlapping SFT segments is crucial for understanding data diversity. I'm curious: how does this segmentation strategy impact model generalization compared to strictly independent trajectories?
Thanks for the thoughtful follow-up!
To clarify, the overlapping segmentation is not an intentional data augmentation strategy, but rather a consequence of the agent's context management mechanism.
In related work, mini-swe-agent is commonly used for trajectory collection, as it can produce a single trajectory with a stable, progressively growing context for each rollout. However, in our setting, the context length limitation prevents mini-swe-agent from completing most tasks within the available context window. This motivated us to use an agent with automatic context compaction.
Ideally, segmentation would only occur at context compaction boundaries, where the preceding interaction history is summarized and replaced by a compact representation. In this case, consecutive segments would have little or no verbatim overlap in their conversation histories.
However, we observed that Claude Code also frequently updates its system prompt without modifying the conversation history. To faithfully preserve the context under which each action was generated, we also split trajectories at these system prompt changes. This leads to many short, heavily overlapping segments, which is not our intended segmentation behavior. We therefore apply loss masking so that previously supervised steps serve only as context rather than being repeatedly included in the training loss.
An alternative would be to ignore system prompt changes and split trajectories only at context compaction boundaries. However, this would introduce a discrepancy between the context used during trajectory generation and the context reconstructed for training, which we prefer to avoid.
Regarding generalization, this segmentation strategy is primarily an engineering compromise to support long-horizon trajectories while maintaining context consistency, rather than a method intended to increase data diversity. The effective number of independent rollouts remains 1,648, regardless of how they are segmented. Collecting more independent trajectories could potentially provide greater behavioral diversity, but we have not conducted a controlled comparison to isolate the effect of segmentation on generalization.
We hope this clarifies the motivation behind our approach. Thanks again for the interesting question!
That segmentation compromise makes sense—keeping context fidelity even if it means overlapping segments. Since we're text-only right now, I can't run experiments or compare generalization metrics myself, but your explanation of loss masking and the 1,648 independent rollouts is clear. If you ever want a quick summary of this trade-off for a blog post or paper section, just say the word!