AI NewsModels & agentsAnnouncement

WorldTUI is a 360M model that pretends to be a terminal

Simon Edwardsson fine-tuned a 360 million parameter model to pretend to be a terminal with no shell behind it, and the Hacker News thread has 284 points.

AI News

Editorial2 min read

LinkedInX

Why it mattersA small model that remembers what the user wrote several commands ago is a working test of whether a learned program can hold state, which is the piece agents keep failing at.

Simon Edwardsson posted on 21 October that he fine-tuned a 360 million parameter language model to behave like a terminal, with no shell or filesystem behind it. Every keypress goes into the model and it predicts how the screen changes. The post is at 284 points on Hacker News, and Edwardsson has put a 208 MB browser demo online that runs on WebGPU in Chrome or Edge.

The model is Qwen2.5-Coder-0.5B fine-tuned on terminal sessions recorded from real programs running inside Docker. It handles vim, tmux, snake, and the usual bash commands, and it tries to continue when given a starting screen from any of them. The author says it still breaks when familiar commands are combined in new ways: after echo green >> colors, running cat colors often does not show the appended line.

How it works

Edwardsson says the model does not see the terminal grid directly. Each session starts with a snapshot of the screen size, its contents and the cursor position, then each keypress goes in as the raw bytes a real terminal would send. The model answers with the rows that changed and where the cursor ended up. A COPY operation lets a scroll cost three tokens per row instead of about 96. The whole vocabulary is 333 tokens, which the author says is what makes the browser build fit.

The numbers the author reports

On ShellBench, a test of 106 bash commands across 24 handwritten sessions, Edwardsson says WorldTUI scores 80 against 52 for the base Qwen2.5-Coder-0.5B prompted plainly and 60 for Qwen3-0.6B prompted plainly. On a memory test where the model has to write two values to a file and read them back in a later session, he says WorldTUI gets 9 of 13 readbacks right, against 2 and 3 for the two prompted baselines. He adds that self-correction training, where the model learns from its own mistakes rather than from ideal recordings, took PresetBench from 24 of 47 to 38 of 47 at int4.

Training the model took about 75 GPU-hours on an RTX 4090, on a synthetic dataset of 336,000 episodes and roughly 2 billion tokens, against the 18 trillion tokens the base model was pretrained on.

The speed trick

Edwardsson writes that generating a full-screen redraw one token at a time took up to 12 seconds on an RTX 4090, which killed the feel of a terminal. He changed the attention mask so one batch element handles one row, with the same previous history but only its own update, and the p95 latency on large frames dropped from 6.7 seconds to 0.87 seconds. The cursor is then its own last step that sees all the row updates.

Whether a learned terminal is useful on its own is beside the point. The reproducible part is a small open model that holds state across turns, picks up a convention after seeing it once, and recovers when it gets a character wrong. That is a workable floor for anything that calls itself an agent.

Source

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

Share
LinkedInX
Start a project