Synthetic Data for Agents: Trajectory Synthesis & Distillation
Real human agent trajectories are scarce, costly, and riddled with privacy risks. Learn how frontier labs use teacher models to synthesize millions of multi-turn tool calling traces with Evol-Instruct and rejection sampling.
Scenario Seed Gen
Generate diverse seed scenarios across 50+ enterprise tool schemas (Git operations, SQL queries, payment processing, Kubernetes clusters).
Evol-Instruct Stress
Mutate simple tasks into complex multi-hop challenges by injecting network failures, corrupted API responses, ambiguous parameters, and permission errors.
Execution Filter
Discard hallucinated runs: only trajectories where code executes successfully inside isolated microVM sandboxes pass into the training corpus.
1. Multi-Turn Trajectory Synthesis Loop
Python 3.11+This pipeline orchestrates a frontier Teacher model (Claude 3.7 or GPT-4o) running inside a mock execution environment to generate validated Thought-Action-Observation trajectories:
2. Evol-Instruct Mutation Operators for Agents
In-Depth Evolution (Deepening Complexity)
- Add Constraints: "Ensure database migration completes in under 2 seconds without locking the table."
- Simulate Partial Outages: Inject HTTP 429 Rate Limit responses to train the agent on exponential backoff tool re-calls.
- Multi-Tool Dependencies: Force the agent to chain 4 distinct tools (Fetch credentials -> Decrypt -> Query DB -> Generate PDF).
In-Breadth Evolution (Domain Expansion)
- Cross-Domain Transfer: Convert DevOps container debugging scripts into AWS IAM permission auditing scripts.
- Negative & Adversarial Scenarios: Inject indirect prompt injections into mock documents to train the model to safely reject malicious tool calls.
- Non-Tool Plain Text Turns: Ensure model knows when NOT to call tools when simple conversational clarifications suffice.
3. Rejection Sampling & Sandbox Verification
The single most critical failure in synthetic data generation is unverified hallucinations: if a Teacher LLM hallucinates a fictitious CLI flag or invalid JSON syntax, your Student model will learn to reproduce those exact hallucinations.
Frequently Asked Questions
Does training on synthetic data lead to model collapse? →
Model collapse only occurs with unverified, recursive plain-text generation. In AI agent trajectories, execution verification (unit tests, compilers, sandboxes, and database assertions) acts as an external ground-truth anchor, preventing degradation and frequently outperforming human annotator consistency.
How can I format synthetic trajectories for Direct Preference Optimization (DPO)? →
Pair successful sandbox-verified trajectories as the chosen response, and failed trajectories (those that hallucinated parameters or failed tests) as the rejected response. This teaches the student model both how to succeed and what common tool-calling pitfalls to avoid.