TL;DR
When we train AI agents to use a command-line terminal via reinforcement learning, we usually only reward them if they pass a final test—ignoring all the rich error messages, stack traces, and outputs they see along the way. ECHO fixes this wastefulness by training the model to predict the terminal's text responses at the exact same time it learns which actions to take. Without needing a single extra simulation or forward pass, the agent builds an implicit "world model" of how terminals work, nearly doubling its task success rate and learning even from total failures.
What Problem Does This Paper Address?
Imagine trying to learn Linux by typing random commands in a pitch-black room, only hearing a buzzer at the end of the hour telling you whether you succeeded or failed. That is essentially how standard agent Reinforcement Learning (RL) works.
When a language model acts as a command-line interface (CLI) agent, it loops through actions (bash commands) and observations (stdout, stderr, file contents). Standard RL algorithms—like GRPO (Group-Relative Policy Optimization, which compares groups of attempts to reinforce the winners)—only apply learning updates to the action tokens based on a sparse, binary reward at the very end.
If an agent tries 16 times to fix a bug and fails all 16 times, standard GRPO learns nothing—zero gradient signal. Yet those failed transcripts are packed with ground-truth physics of the digital world: missing files, syntax errors, and stack traces. Currently, models treat this feedback purely as passive reading context rather than something to actively learn from.
Methods
The authors introduce ECHO (Environment Cross-entropy Hybrid Objective), a clever tweak to how we calculate the loss during RL training.
In a standard multi-turn training pass, the model already processes the entire sequence—actions and terminal outputs alike—to compute probabilities. Standard GRPO masks out the environment tokens during the loss calculation. ECHO simply unmasks them and adds a standard next-token prediction loss (cross-entropy), scaled by a small weight ($\lambda$, typically $0.05$):
$$\mathcal{L}_{\text{ECHO}} = \mathcal{L}_{\text{GRPO}}(\text{actions}) + \lambda \mathcal{L}_{\text{Env}}(\text{observations})$$
What’s new vs. standard: Instead of building a separate, offline "world model" before RL, ECHO learns online for free. It requires no teacher model, no extra rollouts, and no extra forward passes. The authors also carefully filter out boilerplate harness warnings so the model focuses its predictive power on genuine terminal outputs.
Datasets
- Training Corpora: An 8,770-task corpus curated from Endless Terminals and OpenThoughts-Agent-v1-RL, supplemented with 6,170 newly generated synthetic tasks verified by GPT-5. For scaling experiments on Qwen3.5-9B, they train on the 14,551-task Tmax dataset.
- Evaluation Benchmarks:
- val100: 100 held-out tasks from the training set (in-distribution).
- internal-dev (ITD): 71 out-of-distribution tasks sampled from TerminalBench 1.0 and OpenThoughts-TB-dev.
- OpenThoughts-TBLite (TBLite): 100 terminal tasks calibrated for smaller models.
- TerminalBench-2.0 (TB2): A rigorous 89-task benchmark for CLI agents.
- PyTerm: A newly introduced held-out set of 928 synthetic Python-focused terminal tasks used to test verifier-free learning.
Key Insights and Ideas
- Predicting the world helps you act in it: By forcing the same neural network to both anticipate terminal outputs and choose bash commands, ECHO shapes internal representations that implicitly track hidden container states (like which files exist or why a test broke).
- Cause-and-effect is what matters: Could the model just be benefiting from reading more terminal-style text? To check, the authors ran a "shuffled-outcome" control—swapping terminal outputs between different attempts at the same task. Performance tanked, actually doing worse than baseline GRPO. The magic lies strictly in predicting the exact consequence of a specific action.
- Exploration can replace imitation: Usually, weak models need Supervised Fine-Tuning (SFT) on thousands of expert demonstrations before RL works—teaching them how to look around a directory or read a traceback. ECHO recovers almost all of this "interaction prior" just by letting a base model poke around the terminal and predict what happens next.
- Self-improvement without rewards: Even if you turn off the unit-test verifier and drop the RL loss entirely—updating only by predicting terminal outputs on clean trajectories—an already-competent agent can still improve its pass rate on tasks with rich feedback (like Python tracebacks).
Key Results
- Nearly doubling TB2 accuracy: On TerminalBench-2.0, ECHO boosts pass@1 over standard GRPO from 2.70% to 5.17% on Qwen3-8B, and from 5.17% to 10.79% on Qwen3-14B. It also improves the much stronger Qwen3.5-9B model (lifting TB2 pass@5 from 38.20% to 42.70% at matched steps).
- True dynamics learning: When tested on off-policy trajectories generated by a stronger Qwen3-32B model, baseline GRPO barely changes observation prediction error, whereas ECHO slashes cross-entropy across the board (e.g., from 0.24 down to 0.07 nats/token on val100 for 14B).
- Replacing expert data: Starting from a raw Qwen3-8B base model, ECHO recovers 89% to 104% of the benefit of initializing with ~15k expert SFT demonstrations on internal/TBLite benchmarks, and 50% of the gap on the harder TB2.
- Faster training & cleaner inference: Qwen3-8B reaches GRPO's peak validation performance in 1.9× fewer training steps, and cuts TB2 execution timeouts in half (from 19.8% down to 9.0%).
- Verifier-free gains: Training purely on environment prediction (zero task rewards) boosts pass rates by +10.0 percentage points on PyTerm and +5.2 pp on ITD.
Limitations and Future Work
- Domain scope: Experiments are restricted to CLI/terminal environments; testing ECHO in other interactive settings (like web browsers or robotics) is left for future work.
- Partial world models: Predicting text streams doesn't mean the agent learns a complete, airtight simulation of the underlying operating system.
- Sensitivity to feedback quality and $\lambda$: If the auxiliary weight $\lambda$ is too high, predicting text competes with choosing good actions. Furthermore, verifier-free adaptation fails when terminal outputs aren't tightly linked to actions (for instance, performance dropped by 3.9 pp on TBLite without a verifier) or when malformed commands cause the model to reinforce its own failure loops.
Summary updated