How does an AI answer? Watch a real one, one step at a time.
It's autocomplete: a language model guesses the next word, adds it, and guesses again. Here a real one runs in your browser, slowed down so you can follow every step. Every number you see is its own.
A language model is autocomplete: it only ever guesses the next word. An "AI agent" is that model plus a short program that people wrote. The model can only write words. The program gives it a task, reads what it writes, and when the words are a command, types that command into a shell (the box where people type commands to a computer), then gives the output back for the model to read. Round and round. That loop is all "autonomous" means. Here is a real one, slowed down so you can follow every step. It is the same model machinery as in Write mode, plus the steps marked agent.
1Choose a model
2Write the start of a sentence
The model downloads once from Hugging Face and runs on your computer or phone; nothing you type is sent anywhere. The chat model, Mamba and every detail at once are in the Explorer.
- Your words become pieces
- Each piece gets its spot in the cloud
- One layer, up close
- Through every layer
- The wall of lights
- The weighted dice
- Again, word by word
1Your words become pieces
The picture: a big dictionary of pieces, each with a number. The model never sees letters, only these numbers.
2Each piece gets its spot in the cloud
Your pieces, each at its spot in the cloud.
The picture: a cloud with one dot for every piece in the dictionary. A piece's list of numbers is its address in the cloud, and pieces used alike sit close together: it comes from how a word is used, not how it sounds. The real cloud has one direction per number (from 128 to 768 in these models); the map squashes it flat, so distances on it are rough.
3One layer, up close
The knobs
Its numbers, before and after this layer
The picture: rows of volume knobs, set at the factory and glued. Before each row, the newest word listens back to the earlier words (pink) and blends in what matters. That listening is the only step whose mixing depends on what you type.
4Through every layer
The thought cloud: every piece in the dictionary is a dot, and pieces used alike sit close together.
The picture: the same thing, row after row of knobs. Next to each layer: what it would say if it stopped there (the “logit lens”), and in the cloud, every piece it might say lights up. Early layers are not built to be read this way, so their guesses look odd. The guess after each layer is a peek we take by running the model's final scoring early: the model itself only scores once, after the last layer, and never looks anything up in between. The cloud is a flat map of the model's own embedding rows (made with t-SNE); distances on it are approximate.
5The wall of lights
The same wall of lights, laid out as the thought cloud.
The picture: a wall with one light for every piece in the dictionary. Each glows by how closely the final list of numbers points the same way as that piece's row in the output table.
6The weighted dice
The picture: a dice loaded by the brightest lights. Usually the brightest wins; sometimes a dimmer one does. That is why the same start can give different stories.
7Again, word by word
Everything here is real: the pieces, the numbers, the knobs, the listening (attention, averaged over every head of the layer), the guesses after each layer, the scores and the dice. The model engine (llm.js) is checked against the official transformers implementation, number by number inside every layer (the checks and their results). Only the speed is changed.
Talk to an agent that can use a real Linux computer
Your message goes to the model. The program around it types any command the model writes into a real Linux machine running in this tab, then hands back what Linux prints. The machine has no internet, and Reset puts it back. Watch each step light up below.
Pick an example, or type a task.
The examples play straight away: recorded runs of the real model, and the commands really run on this Linux. Your own task needs the live model (988 MB, computers only).
The computer starts with the first task.
- You
- The model writes
- The program finds a command
- Linux runs it
- The output goes back
- The model answers
slowly, with the model's inner numbers: the context, the 24 layers, every token's chances.
Pick one. The first is the clearest place to start. These play straight away, on a phone too: each is a recorded run of the real model, with every token, chance and attention number exactly as it produced them.
Or type your own task (runs live)
Run it live instead. Load the model and every run happens here in your browser: the examples, your own task, and “Ask me before each command”.
494 million knobs (about 358 million in its 24 layers, 136 million in its table of token rows). It runs in this tab on your processor, so it needs a computer with a few GB of free memory, not a phone. It downloads once; nothing you type is sent anywhere. The shell is pretend: three files on this page, and no internet.
The model is loaded: every run is now live in your browser.
- Your task
- The hidden instructions
- Your words become pieces
- Through every layer
- The wall of lights, word by word
- The program reads the reply
- The shell runs it
- The output goes back
- What actually happened
1Your task
2The hidden instructions agent
Before your task, the program puts text you never see in front of it: the system prompt. Apps do this too. Here it has three parts:
Why does a bit of text make it use a shell? Test it.
The text does not switch anything on inside the model: the 494 million knobs are the same with or without it. It is just more tokens to read. It works because, after its first training on ordinary text, the Qwen team trained this model further on example conversations, and Qwen publishes exactly this chat form and tool format for it (the training data itself is not published). So when the model reads this pattern, a <tool_call> becomes a likely next token, and when it writes the tool's name it reads the list through attention (the arcs reach into the green squares).
The test: run the same task with parts of the hidden instructions removed, and see what the real model does. Each row runs the model from scratch (a few seconds each).
| Hidden instructions | Its probability for <tool_call> | What it wrote |
|---|
3Your words become pieces: everything the model reads
4Through every layer: 24 layers of fixed knobs
5The wall of lights, word by word
The same wall of lights as in Write mode, but no dice: this agent always takes the brightest light (temperature 0), so a run comes out the same each time and can be checked.
Its next-token chances
Where it looked back (attention)
6The program reads the reply agent
This is the program's loop, simplified from agent.js (the real one also catches broken requests). The values next to the lines are the real ones from this run.
7The shell runs it agent
8The output goes back agent
9What actually happened agent
What the model said
What actually happened
Everything here is real: the examples play back recorded runs of this same page (they come out the same live, because the model always takes its most likely token), the model is Qwen2.5-0.5B-Instruct (checked number by number against the official transformers implementation: the checks), every token it writes is its most likely next token after Qwen's published repetition penalty, the attention and the logit lens are its own numbers, and in the chat every command runs on a real Linux computer emulated in this tab (v86, with a Linux built for this page: what is in it). The slow step-by-step walk-through uses a small pretend shell in agent.js with the same three files; for these examples both print exactly the same. Only the speed is changed: the model works faster than you can read, so the page shows each step slowly. Source: agent.js.