Agent SFT: From Trajectory Imitation to Pedagogical Data Synthesis
Successful task trajectories are a common source of supervised fine-tuning data for AI agents, but they often provide limited coverage of difficult decisions and error recovery. This article explains how pedagogical data synthesis combines curriculum design, decision explanations, and targeted recovery examples. It reviews a controlled comparison using 512 trajectories, reported gains across terminal, search, and software engineering benchmarks, and practical steps for building and evaluating the approach.
Agent SFT: From Trajectory Imitation to Pedagogical Data Synthesis
1. Why Successful Trajectories Are Not Enough
In AI agent training, supervised fine-tuning (SFT) commonly relies on successful trajectories: complete interaction sequences from tasks in which a model ultimately achieves its objective. This approach is straightforward and relatively affordable, but it has several often-overlooked limitations.
Survivorship bias. Successful trajectories retain examples that worked, but offer little instruction on where an agent might go wrong or how to recover. It is similar to giving students model answers without explaining common mistakes.
High redundancy. Many successful trajectories share nearly identical opening steps, such as initializing an environment, reading files, or making routine tool calls. The segments that involve difficult decisions may account for only a small fraction of the data. A dataset of 512 trajectories can therefore contain much less useful information than its size suggests.
Limited strategy diversity. Repeated sampling from the same teacher model often converges on a few types of successful solutions. The student may learn familiar patterns rather than how to choose an appropriate strategy.
These limitations raise a more fundamental question: Can SFT outperform trajectory imitation when its training data is deliberately designed to teach—by organizing a curriculum, breaking down decision points, and targeting weaknesses?
2. The Core Idea: Make the Data Synthesizer a Curriculum Designer
Pedagogical data synthesis assigns three instructional responsibilities to a teacher model with strong reasoning capabilities.
Curriculum Design: Select Tasks That Expose Capability Gaps
Rather than simply executing randomly selected tasks, the teacher first profiles the task pool. Which tasks does the base model frequently fail? Are failures concentrated around tool selection, state assessment, or multistep planning?
Tasks that expose these weaknesses receive priority. This helps prevent easy tasks from diluting the training dataset.
Explanation Generation: Turn Actions into Instruction
For each trajectory, the teacher provides not only what the agent did, but also why it did it. This includes the observed state, alternative actions and their risks, and the basis for choosing the next step.
The goal is for SFT to teach a decision policy, rather than only a surface-level mapping from observations to actions.
Targeted Practice: Include Mistakes and Recovery
Pedagogical synthesis deliberately creates examples around difficult decision points that follow a sequence of incorrect attempt, error recognition, and rollback or correction.
The source describes failure-and-recovery trajectories as a way to improve robustness in real environments. They teach agents to handle imperfect states instead of assuming that every step proceeds as planned.
3. Controlled Comparison with Conventional SFT
To test the approach, the described experiment held the main training variables constant and changed only the data synthesis strategy:
- The same teacher model throughout.
- The same task pool.
- Exactly 512 trajectories in each training dataset.
- The same full-parameter SFT recipe, including optimizer, learning rate, training epochs, and context length.
The baseline used conventional SFT on successful trajectories. Evaluation covered six test settings across three benchmark categories:
| Benchmark Category | Capabilities Evaluated |
|---|---|
| Terminal | Multistep tool use and state management in command-line environments |
| Search | Multiround retrieval, information aggregation, and answer synthesis |
| Software engineering (SWE) | Code understanding, bug localization, and repair |
The model trained on pedagogically synthesized data outperformed conventional SFT in all six evaluation settings, with reported average score improvements ranging from 1.42 to 8.99 percentage points.
Crucially, these gains came without increasing the number of training trajectories. The comparison points to data quality and instructional structure, rather than additional trajectory volume, as the source of the improvement.
4. How to Apply the Approach
Establish a Reproducible Baseline
Before optimizing a data strategy, fix the teacher model, task pool, sample count, and training hyperparameters. A controlled A/B comparison is essential: otherwise, apparent gains may come from hyperparameter variation or differences in task distribution.
# Pseudocode: controlled experiment with fixed variablesexp_config = {"teacher": TEACHER_MODEL, # Fixed teacher model"task_pool": POOL_V1, # Fixed task pool"num_trajectories": 512, # Fixed trajectory count"sft_recipe": SFT_RECIPE_STABLE, # Fixed training recipe}run_baseline(exp_config, data_source="success_trajectories")run_treatment(exp_config, data_source="pedagogical_synthesis")
Build the Data Synthesis Pipeline
A practical pedagogical synthesis pipeline typically has four stages:
- Task profiling. Use the teacher model to annotate task difficulty and failure modes.
- Trajectory execution and selection. Retain trajectories that cover important decision points, rather than filtering only for successful outcomes.
- Instructional rewriting. Add decision rationales, comparisons of alternative actions, and explanations of error correction.
- Quality filtering. Combine rule-based and model-based checks to validate factual consistency, tool-call validity, and formatting.
Keep Training and Evaluation Controlled
- Balance the curriculum. Cover terminal, search, and software engineering capabilities in a balanced way to reduce overfitting to a single category.
- Report results separately. Publish scores for each evaluation setting rather than relying only on an aggregate score.
- Control dataset size. Keep trajectory counts fixed across experimental conditions. Allowing this variable to change can easily confound the comparison.
5. Limitations and Scope
Pedagogical synthesis is not a universal solution.
- Teacher quality limits instructional quality. The teacher’s reasoning ability and domain knowledge directly influence what the student can learn from the generated data.
- Instructional metadata may be ignored. If explanations are loosely connected to the action sequence, SFT may teach superficial formatting rather than better decisions.
- Synthesis costs increase. Additional teacher inference calls are required, so teams need to weigh capability gains against compute costs.
- Long-horizon tasks remain challenging. Maintaining consistent instruction across very long interactions still requires further research.
6. Conclusion
The central finding is clear: with the number of training trajectories held constant, changing the instructional structure of the data can produce meaningful capability gains.
Moving from collecting successful trajectories to designing curricula, explaining decisions, and reinforcing difficult cases helped open-source base models outperform conventional SFT across terminal, search, and software engineering evaluations. The described experiment reported average improvements of 1.42 to 8.99 percentage points.
For teams working with limited compute, improving data quality and instructional structure is a promising way to strengthen agent capabilities without simply collecting more trajectories.
