Paper 2602.07274
TermiGen: High-Fidelity Environment and Robust Trajectory Synthesis for Terminal Agents
- Published
- Feb 2026
- Research lab
- Independent
- Citations
- 13
- GitHub
- 73 stars
01 In brief
Summary
TermiGen is an end-to-end pipeline for synthesizing verifiable terminal environments and robust expert trajectories to train open-weight LLMs for terminal tasks.
It addresses two key challenges: scarcity of high-fidelity executable environments and exposure bias from standard expert trajectories.
Phase I uses a multi-agent system to generate diverse tasks across 11 categories, create Docker containers, and validate them via iterative build and unit test loops.
Phase II employs a Generator-Critic framework that stochastically injects errors (20% probability) into trajectories, teaching models to diagnose and recover from failures.
Fine-tuned on this data, TermiGen-Qwen2.5-Coder-32B achieves a 31.3% pass rate on TerminalBench, outperforming existing open-weights baselines and proprietary models like o4-mini.
Ablations show that verifiable environments outperform simulation, error-correction trajectories improve performance over standard ones, and including negative trajectories (with lower test pass rates) is beneficial.
The dataset includes over 3,500 environments and 3,291 trajectories, with an average of 25.5 turns and 8,722 tokens, covering 420 command-line tools across 16 domains.
Limitations include reliance on SFT, lack of memory in the agent, and synthetic environments not fully replicating real-world stochasticity.
02 From the paper
Abstract
Executing complex terminal tasks remains a significant challenge for open-weight LLMs, constrained by two fundamental limitations. First, high-fidelity, executable training environments are scarce: environments synthesized from real-world repositories are not diverse and scalable, while trajectories synthesized by LLMs suffer from hallucinations. Second, standard instruction tuning uses expert trajectories that rarely exhibit simple mistakes common to smaller models. This creates a distributional mismatch, leaving student models ill-equipped to recover from their own runtime failures. To bridge these gaps, we introduce TermiGen, an end-to-end pipeline for synthesizing verifiable environments and resilient expert trajectories. Termi-Gen first generates functionally valid tasks and Docker containers via an iterative multi-agent refinement loop. Subsequently, we employ a Generator-Critic protocol that actively injects errors during trajectory collection, synthesizing data rich in error-correction cycles. Fine-tuned on this TermiGen-generated dataset, our TermiGen-Qwen2.5-Coder-32B achieves a 31.3% pass rate on TerminalBench. This establishes a new open-weights state-of-the-art, outperforming existing baselines and notably surpassing capable proprietary models such as o4-mini. Dataset is avaiable at https://github.com/ucsb-mlsec/terminal-bench-env.