What Makes Interaction Trajectories Effective for Training Terminal Agents?

Sidi Yang, Chaofan Tao, Jierun Chen, Tiezheng Yu, Ruoyu Wang, Yuxin Jiang, Yiming Du, Wendong Xu, Jing Xiong, Taiqiang Wu, Lifeng Shang, Xiaohui Li, Ngai Wong, Haoli Bai

TL;DR

The strongest AI models aren't always the best teachers. This paper uncovers a "pedagogical paradox" in training terminal agents, demonstrating that a model's standalone performance matters less than its tendency to explicitly inspect and verify the environment. By prioritizing these environment-grounded trajectories, the authors achieve state-of-the-art training efficiency, matching top-tier performance using up to 30× less data.

What Problem Does This Paper Address?

AI code agents are shifting from static code generation to autonomous, closed-loop interaction with terminal environments (e.g., installing dependencies, editing files, and debugging via test execution). To train smaller open-source models to perform these complex tasks, researchers typically use knowledge distillation—fine-tuning student models on interaction trajectories generated by a powerful "teacher" model like Claude or GPT-4.

The underlying assumption has always been "stronger is better": the higher a teacher model scores on a benchmark, the better its trajectories must be for training students. This paper challenges that assumption. The authors investigate whether a teacher's raw problem-solving efficiency actually translates to good pedagogy, or if highly capable models take cognitive "shortcuts" that leave student models under-supervised.

Methods

To rigorously isolate what makes a trajectory "teachable," the authors introduced several novel methodologies:

  1. Matched-Task Teacher Distillation: They held the evaluation benchmark, agent harness (Terminus-2), student backbones (Qwen3-8B and 32B), and training recipes completely fixed. They then curated a dataset where four different teacher models (Claude Opus 4.6, DeepSeek-V3.2, Qwen3.5-Plus, and GLM-5) successfully solved the exact same tasks, isolating trajectory quality from task difficulty.
  2. Targeted Observation Ratio (TOR): A new metric designed to quantify Environment-Grounded Supervision (EGS). TOR measures the fraction of an agent's actions that are explicitly preceded by a path-aligned observation command (for example, running cat src/utils.py before executing an edit on that exact file).
Figure 1: The Pedagogical Paradox: Discrepancy between standalone performance and teaching efficacy. While Claude Opus 4.6 achieves the highest standalone score on Terminal-Bench 2.0, its tra- jectories produce significantly weaker students compared to those from DeepSeek-V3.2. We attribute this gap to the alignment between actions and environmental feedback: teachers that prioritize actions rigorously supported by prior observations, a core property of Environment-Grounded Supervision, provide robust, generalizable problem-solving routines that are more effective for student imitation learning.

Datasets

The authors introduced TERMINAL-LEGO, a scalable data generation pipeline that extracts real-world technical questions from StackOverflow across 90+ domains and converts them into Docker-verified terminal tasks.

Unlike purely synthetic datasets, TERMINAL-LEGO tasks incorporate real failure modes like dependency conflicts, networking misconfigurations, and library-specific bugs. The pipeline filters tasks through a strict "generate-then-review" loop and a final Docker round-trip verification to ensure every task is executable and automatically checkable.

Figure 2: Terminal-Lego construction pipeline. StackOverflow issues are filtered into realistic sources, converted through cascaded task construction, and retained after Docker round-trip verification.

The final evaluation was conducted on Terminal-Bench 2.0, a canonical testbed for terminal-based agentic reasoning.

Key Insights and Ideas

  • The Pedagogical Paradox: Standalone mastery does not guarantee teaching success. Claude Opus 4.6 achieved the highest standalone score on Terminal-Bench 2.0 (69.4%) but produced the weakest student models. Conversely, DeepSeek-V3.2 scored the lowest standalone (39.3%) but emerged as a vastly superior teacher.
  • The Danger of "Shortcuts": Highly capable models like Claude Opus often solve tasks in very few turns without explicitly inspecting the environment. While efficient, these trajectories lack visibility into why an action was taken. Students trained on them simply memorize fragile action sequences rather than robust problem-solving routines.
  • Structured Failures Still Teach: In a striking experiment, students trained on failed DeepSeek-V3.2 trajectories outperformed students trained on successful Claude Opus trajectories. This proves that the procedural "inspect-act-verify" loop (EGS) is far more valuable to a student than merely seeing a successful final outcome.
  • Prompting for Better Pedagogy: By simply modifying Claude Opus's system prompt to force it to inspect files before editing them, its TOR increased from 2.5% to 6.6%, which subsequently boosted its student's downstream performance from 15.4% to 19.5%.

Key Results

When evaluating the matched-task setup (8.1k trajectories), students trained on DeepSeek-V3.2 consistently outperformed all others. For instance, a Qwen3-32B student trained on DeepSeek data achieved a 20.6% pass rate on Terminal-Bench 2.0, compared to just 15.5% when trained on Claude Opus data.

Table 1: Performance of Qwen3-8B and Qwen3-32B across teacher-distilled trajectories. Although Claude Opus 4.6 has the highest standalone TB 2.0 score, DeepSeek-V3.2 produces the strongest student models.

When scaling up to the full TERMINAL-LEGO dataset (15.3k trajectories), data efficiency gains were massive:

  • Qwen3-32B achieved a 24.3% score on Terminal-Bench 2.0—a 7× improvement over its base performance.
  • This performance rivals previous state-of-the-art methods while using over 30× less data volume than competing post-training corpora like Nemotron-Terminal.

Limitations and Future Work

While the findings are compelling, the authors note a few limitations:

  • The study focused primarily on 8B and 32B student models. How these pedagogical dynamics scale to much larger or much smaller student architectures remains an open question.
  • The TOR metric acts as a practical proxy for trajectory grounding, but it does not formally validate whether a specific observation was logically sufficient or strictly necessary to justify the subsequent action.

The authors suggest that the future of agent post-training will rely heavily on "Harness Engineering"—systematically designing interaction environments that force models to expose their internal reasoning loops.

Summary updated

BibTeX
@misc{yang2026what,
  author = {Sidi Yang and Chaofan Tao and Jierun Chen and Tiezheng Yu and Ruoyu Wang and Yuxin Jiang and Yiming Du and Wendong Xu and Jing Xiong and Taiqiang Wu and Lifeng Shang and Xiaohui Li and Ngai Wong and Haoli Bai},
  title = {{What Makes Interaction Trajectories Effective for Training Terminal Agents?}},
  year = {2026},
  eprint = {2606.03461},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.03461},
}

Loading related content...

Figure