ECHO: terminal agents that learn from what the terminal says

ECHO: terminal agents that learn from what the terminal says
ECHO: your agent learns from what the terminal says back (almost for free)
I also explain it in this video, on my Articulator EN channel.

What ECHO islink

ECHO is a hybrid training objective for agents that work on the command line. It trains on both sides of the interaction: what the agent writes (its commands) and what the terminal writes back. If you're in a hurry, these are the article's five findings:

  1. Standard agent reinforcement learning throws away the environment's response, even though it's already in the context.
  2. ECHO puts it to use with an extra loss that costs almost nothing: a few lines on top of any GRPO trainer.
  3. Agents get better; on Terminal Bench 2, the hardest benchmark, the first-try success rate nearly doubles compared to GRPO.
  4. ECHO recovers a good part of what fine-tuning on an expert's demonstrations gives you.
  5. With no reward at all, the agent can keep improving just by acting and predicting what happens (on some task sets).

How a terminal agent is trainedlink

A terminal agent works in a loop: it writes a command, the terminal responds, and with that response it picks the next one. The example in the article's animation: the agent tries to connect to port 8080 and the connection is refused; it checks open ports with ss -tln and sees 3000; it tries there and gets back not_found. In the end the task fails: reward zero.

These agents are trained with reinforcement learning, for example with GRPO. The agent makes several attempts at each task, and a verifier (the task's tests) says whether each attempt solved it: a 1 or a 0. GRPO reinforces the commands from attempts that did better than the group average and penalizes the rest. If all attempts get the same score (for example, they all fail), there's nothing to compare and the signal is zero.

What GRPO throws awaylink

Each attempt mixes two kinds of tokens: actions (what the agent writes) and observations (what the terminal says back). GRPO only learns from the actions. The observations are in the context, the model reads them and even computes their probabilities in the forward pass, but training covers them with a mask and learns nothing from them.

One attempt as a row of tokens: with GRPO the terminal responses are masked; with ECHO they count too.
With GRPO only the actions count; ECHO removes the mask from the observations.

That's wasteful, especially because the reward is sparse, delayed and binary. In their Qwen3-8B setting, on many tasks fewer than 15% of attempts succeed. But a failed attempt isn't garbage: it's full of file listings, errors, logs, stack traces and grep outputs. Those are the consequences of each command.

The world as a loss functionlink

The idea came from a question about continual learning: how does an agent get better just by acting in the world, even without a verifier? The usual problem with verifier-free learning is where supervision comes from when there's no reward. Dimitris's hunch: maybe continual learning is training on whatever the environment gives you back when you act.

His analogy is a light switch. You flip it and the light comes on, or it doesn't. If it doesn't, that's information too: something's up with the bulb, the wiring or the breaker. You don't see how electricity works, only the outcome, and that's enough to start building a mental model of how switches turn lights on.

The terminal works the same way. After a command you see stdout, stderr, the exit code or a file listing; you don't see the kernel state or the process tree. It's a small projection of how the machine changed, and it's exactly what the agent uses to choose its next step. The best part: that output is a supervision signal that comes already computed, on every turn, for free. To predict it, the agent has to keep track of which files it just created and what lives where.

Predicting the next token well means that you understand the underlying reality that led to the creation of that token. — Ilya Sutskever, quoted in the article

The ECHO losslink

ECHO keeps the GRPO loss on the actions and adds a length-normalized cross-entropy loss on the observations: the classic language model loss, predicting every token of the terminal's response. A weight, λ, decides how much the second one counts. The authors call it the most embarrassingly simple way to learn from consequences.

The ECHO loss: the GRPO loss on the actions plus lambda times the cross-entropy on the observations.
The ECHO loss: GRPO on the actions, plus λ times predicting the terminal.

In code it's a few lines: same attempts, same forward pass and a different mask over the logits. And there's an important difference between the two terms: the GRPO loss goes silent when all of a task's attempts get the same score, while the terminal loss is active on every one. Three technical details:

  • It learns on-policy. It doesn't train on frozen transcripts from a teacher, but on the responses the model itself triggers while it learns. If it improves, it explores new corners and gets fresh supervision; if it predicts better, it picks better actions. A loop.
  • λ matters. Too small and the terminal barely teaches anything. Too large and the agent can end up chasing outputs that are easy to predict instead of making progress on the task.
  • What gets predicted matters. The real terminal output, not harness warnings: warnings are memorized right away; the useful part is file names, stack traces and error messages.

What it costslink

The obvious question: isn't the backward pass more expensive if you push gradients through more positions? According to the authors, barely. The expensive part is the matrix multiplications in attention and the MLP layers, which run over the same sequence whether or not a position contributes to the loss. The logits at every position were already computed for GRPO; the two masks just pick different subsets. No extra attempts, no teacher model and no extra forward pass: a cost that is, in their words, basically zero.

The resultslink

The comparison is as clean as it gets: same models, same GRPO recipe, same tasks, the same attempt and turn budget and the same number of steps. The reward is 1 if the agent passes the tests at the end and 0 if not. The only difference is whether the terminal output also goes into the loss. They tried it with Qwen3-8B, Qwen3-14B and a model already fine-tuned on an expert's demonstrations (OpenThoughts-Agent-v1-SFT).

In the training curves, the ECHO curve pulls away from GRPO early and usually stays above it on all three validation sets (with the 14B model on ITD, the two cross). And it learns faster: with Qwen3-8B, ECHO reaches on Terminal Bench Lite what GRPO gets in 500 steps 280 steps sooner, about 2.3 times faster, and it keeps climbing.

Training curves from the article: ECHO in pink and GRPO in teal, on val100, ITD and TBLite, with Qwen3-8B and Qwen3-14B.
The original figure from the article: ECHO in pink, GRPO in teal.

In the table, the story is the same. On Terminal Bench 2, the hardest benchmark, the first-try success rate nearly doubles compared to GRPO: from 2.70% to 5.17% with Qwen3-8B and from 5.17% to 10.79% with Qwen3-14B. It doesn't come from more data, more attempts or a teacher: the terminal's response was already in the attempt. One caveat: ECHO wins almost every cell of the table, but not all of them; with the OT-SFT model, on TB2 pass@3 it lands slightly below GRPO (13.82 vs 14.38), and on pass@5 they tie.

Terminal Bench 2, first-try success: with Qwen3-8B, 2.70% with GRPO and 5.17% with ECHO; with Qwen3-14B, 5.17% and 10.79%.
Terminal Bench 2, first-try success: nearly double that of GRPO.

Why does it work? GRPO only learns from a sparse, binary reward, and on hard terminal tasks a small model almost never succeeds, so many tasks give no signal at all. ECHO turns failures into supervision: even when a command doesn't solve the task, the terminal teaches it what that command caused.

Does it learn how the terminal behaves?link

The title talks about "world models", and the authors hedge: they don't claim ECHO learns a world model in the strong sense. They claim something testable, by flipping Sutskever's quote around: if the model has learned how the terminal behaves, it has to be good at predicting its output. And a better predictor is, in information-theoretic terms, a better compressor of what it predicts.

To measure it cleanly, they generated attempts with a stronger model, Qwen3-32B, which wasn't used in any training run, and measured how surprised each model was by the terminal output (cross-entropy per token: the lower, the less surprise). On val100, with Qwen3-8B, the starting policy scores 0.29; after GRPO, 0.27; after ECHO, 0.07. The pattern repeats with the other models.

Cross-entropy on the terminal output: 0.29, 0.27 and 0.07 for 8B base; 0.26, 0.27 and 0.09 for 8B SFT; 0.24, 0.22 and 0.07 for 14B.
GRPO barely changes the surprise at the terminal; ECHO cuts it sharply.

So they won't say world model with a capital W. What they do claim is that ECHO produces policies that compress terminal dynamics much better, on attempts they didn't even generate. And the same checkpoints that best predict the terminal are the ones that solve more tasks.

Surprise 1: less reliance on the expertlink

The usual recipe for terminal agents is to first copy a stronger model's demonstrations (supervised fine-tuning, SFT) and then run reinforcement learning. Here the reference is OpenThoughts-Agent-v1-SFT: Qwen3-8B fine-tuned on demonstrations generated by GLM-4.6. The question: how much of the advantage of starting from the expert can ECHO recover without copying anyone?

They compared three runs: GRPO on the base model, ECHO on the base model, and GRPO on the fine-tuned model (SFT + GRPO). Of the advantage the expert gives, ECHO recovers 104% on ITD, 89% on Terminal Bench Lite and 50% on Terminal Bench 2 (pass@1).

Pass rate with GRPO, ECHO and SFT + GRPO on ITD, TBLite and TB2: ECHO recovers 104%, 89% and 50% of the expert's advantage.
ECHO, with no demonstrations, versus GRPO on the model fine-tuned on an expert.

The authors' reading: much of the value of demonstrations may not lie in the expert's strategy, but in teaching what it's like to interact with a terminal (inspect files, run tests, follow a traceback). ECHO doesn't imitate the expert: it learns to predict the consequences of its own commands, and with that, which commands expose useful state, which errors are diagnostic and which outputs signal progress. On TB2 half the gap remains, consistent with it being harder and further from the training tasks; they don't see it as a fixed ceiling. The takeaway isn't that expert SFT is obsolete, but that part of what it buys can be learned directly from the environment: the terminal teaches too.

Surprise 2: improving without rewardslink

If ECHO really teaches how the terminal behaves, do we even need the verifier? They turned it off: no GRPO, only the terminal loss. The agent acts, observes and learns only to predict what comes back; no label says which action was good. If it still improves, it's because predicting the terminal changes how it picks its actions.

They took their best Qwen3-8B trained with ECHO and trained for 100 more steps on tasks it had never seen, with that loss alone. The result, in their words, "kinda" worked: +3.8 points on val100 (tasks similar to the training ones), +5.2 on ITD and +10.0 on PyTerm, a set of Python-heavy terminal tasks; on the last two, keeping only the clean attempts.

No verifier, 100 more steps: +3.8 points on val100, +5.2 on ITD and +10.0 on PyTerm.
With the verifier off, only predicting the terminal.

But it doesn't always work. On val100 the gain is small because the agent had already learned almost everything. On ITD, noisy attempts (invalid commands, parse errors, dead-end loops) had to be filtered out. And on Terminal Bench Lite the same filtering didn't improve consistently. The key, according to the authors, is how informative the output is: in Python, code, traceback and fix sit right next to the action; in other tasks the state shows up more indirectly, through files, configs and multi-step setup.

The surprising part isn't that the agent improves itself perfectly, but that it improves at all, from nothing but acting and predicting what comes back. But only when reinforcement learning has already produced a model that explores reasonably well, its attempts are clean and the terminal gives useful clues.

Where this leaves uslink

The core lesson: an agent's attempts contain much more supervision than the final reward. The authors don't say rewards or demonstrations are obsolete: the expert teaches strategy and the verifier gives the cleanest signal. But between "imitate the expert" and "wait for a sparse reward" there's a dense, underused source of supervision: the consequences of the agent's own actions.

It's not an idea out of nowhere, either. Predicting the environment as an auxiliary task has a long history in reinforcement learning, and recent work like Agent Learning via Early Experience, VAGEN, RWML or CWM has already brought it to language model agents in different ways. ECHO is the online version, inside the training loop and for the terminal.

Open questions remain: is there a better way to represent what gets predicted (a summary of the state instead of the raw output)? Which observations to use, when to filter and how much to weigh prediction against the policy? Does it work beyond the terminal, in browser agents, multi-tool systems or assistants, where user corrections are another kind of response? Back in May 2026 they bet that, before the year was out, some form of environment-token prediction would be standard in agent trainers.

The laptop mazelink

Before all of this, Dimitris tried the idea on his laptop: a maze in a tiny terminal and a 10-million-parameter transformer trained from scratch. The agent says up, down, left or right, and the terminal tells it what's around it and how far the goal is. Training on those responses too, it solved more small mazes (up to 0.42 higher solve rate on 6×6 mazes with λ = 1); on 9×9 or bigger, the advantage almost disappeared.

Solve-rate difference between ECHO and training on actions only, by maze size, for three values of lambda.
The original figure from the article: ECHO's advantage over training on actions only, by maze size.

He himself says it's not a Nature paper. His lesson is a different one: almost every clean idea has a microcosm, a scaled-down version you can run on a laptop in an evening to find out whether it's worth scaling up. The maze didn't prove ECHO would work, but it gave him enough conviction to message Vaish, and the big results are hers. Most of his ideas are wrong, he says, and the cheap experiment tells him which ones to drop before they cost anyone else time.

In shortlink

A terminal agent already reads what the terminal says back, but standard reinforcement learning doesn't learn from it. ECHO makes it predict that, at almost no cost, and according to the authors the agent solves more tasks, learns faster, relies less on an expert and, in some cases, improves even without rewards.

In one sentence

Stop throwing away the tokens the terminal already gave you: they teach too.

Sourceslink

Continue reading

Last posts -->

Have you seen these projects?

Gymnasia

Gymnasia Gymnasia
Expo
React Native
TypeScript
OpenAI
Anthropic

Fitness app with two agents that run entirely on the device, with no backend, so the user's data never leaves the phone. A BYOK conversational coach with local tools and a remote system prompt with offline fallback, plus a food estimator that pulls macronutrients out of a photo of the plate, with barcode scanning against OpenFoodFacts.

LangGraph Deep Researcher

LangGraph Deep Researcher LangGraph Deep Researcher
Python
LangGraph
FastAPI
React
TypeScript
Docker

Multi-agent research system built with LangGraph. A supervisor breaks your question down into topics and launches search sub-agents in parallel; each one compresses its findings before handing them to a writer agent that produces the final sourced markdown report. Live streaming over WebSockets, a configurable model per role and bring-your-own API keys that are never persisted server-side.

Tau

Tau Tau
Python
LangChain

Multi-agent tutoring system for secondary school students, with one agent per subject and course material written and validated by a team of teachers. It was used with real students at a private school in Spain and at a secondary school in Colombia.

View all projects -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to watch any talk?

Last talks -->

Do you want to improve with these tips?

Last tips -->

Use this locally

Hugging Face spaces allow us to run models with very simple demos, but what if the demo breaks? Or if the user deletes it? That's why I've created docker containers with some interesting spaces, to be able to use them locally, whatever happens. In fact, if you click on any project view button, it may take you to a space that doesn't work.

Flow edit

Flow edit Flow edit

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
View all containers -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to train your model with these datasets?

short-jokes-dataset

HuggingFace

Dataset with jokes in English

Use: Fine-tuning text generation models for humor

231K rows 2 columns 45 MB
View on HuggingFace →

opus100

HuggingFace

Dataset with translations from English to Spanish

Use: Training English-Spanish translation models

1M rows 2 columns 210 MB
View on HuggingFace →

netflix_titles

HuggingFace

Dataset with Netflix movies and series

Use: Netflix catalog analysis and recommendation systems

8.8K rows 12 columns 3.5 MB
View on HuggingFace →
View more datasets -->