The headline result: you can run a functional-looking terminal emulator backed purely by a neural network. No operating system, no shell process, no filesystem. Every keystroke feeds into the model, which predicts which screen cells update and where the cursor moves next. The project is called WorldTUI, and it runs entirely in the browser at 208 MB.

The foundation is Qwen2.5-Coder-0.5B, a 500M-parameter model chosen for its small footprint and pre-existing familiarity with CLI patterns. The author generated 336,000 training episodes — roughly 2 billion tokens — by scripting realistic shell sessions inside Docker containers, randomizing usernames, directory trees, terminal dimensions, and typo rates, then logging every keypress against the exact resulting screen state. That keystroke-to-screen alignment is the key ingredient existing datasets like asciinema couldn't supply.

Two engineering choices turned a slow, inconsistent prototype into something workable. First, parallel row decoding: most screen rows in a given frame are independent, so the model drafts each row simultaneously as a separate batch element, then runs a speculative-decoding pass to catch cross-row conflicts (like vim rendering on the wrong line). On an RTX 4090, this dropped p95 latency for large frames from 6.7 seconds to 0.87 seconds. Second, a DAgger-style self-correction loop: the model was periodically shown its own prediction mistakes and trained to fix them on the next step, lifting a key benchmark (PresetBench) from 24/47 to 38/47 correct cases.

WorldTUI: A 360M-Parameter Neural Net That Emulates a Terminal With No OS Behind It

The memory tests are the most revealing. Asked to write values to files and recall them in a later session, WorldTUI got 9 out of 13 correct readbacks — versus 2/13 and 3/13 for prompted variants of the base model. That's a meaningful gap. The honest caveat from the author: appending to files with >> and reading back with cat frequently breaks, and unusual command combinations degrade fast. This is pattern generalization, not a real filesystem.

For the browser deployment, the author pruned the vocabulary from 151,936 tokens down to 333 — 256 byte values, 64 row identifiers, and a few special ops — shrinking the model from 494M to ~360M parameters. Int4 quantization brought weights to 208 MB. Inference runs client-side via WebGPU with custom WGSL compute shaders, no server involved. On an M4 Mac, a single keypress costs around 60 ms; a full-screen redraw like man test takes roughly 0.9 seconds with parallel drafting on.

Why builders should pay attention: the terminal is an unusually clean domain for world-model research — effectively unlimited labeled training data, compact state, and an unambiguous correctness signal. The tokenization scheme (stripping to only necessary vocabulary) and the self-correction training loop are both transferable techniques. If you're working on learned UI simulation, offline environment modeling, or lightweight on-device agents, the architecture decisions here are worth studying directly.