Local model
Runs on your own hardware. Private and offline; quality limited by the machine.
A chatbot does one thing: it predicts the next piece of text, over and over. A real language model — a very small one — is running inside this page. Give it a prompt and watch every step: text into tokens, tokens into numbers, numbers through layers, and one word chosen. Then wipe its memory and train it again yourself.
Every reply you have read from a language model came out of this loop. It runs once for each token it writes. Let it play, then step through it — each stage has its own chapter below.
A model never sees letters or words. A tokenizer chops text into pieces from a fixed vocabulary and hands the model a list of ID numbers. Most tokenizers are built by byte-pair encoding: start with single characters, then keep gluing together whichever pair shows up most often. Watch it happen to your prompt, or type anything.
Each token ID selects one row of a table. That row is the token's embedding: its coordinates in a space where tokens that behave alike sit close together. Nobody types those numbers in. Below is the table this page's model learned, squashed flat so you can look at it.
In a large model, the gap between two points carries meaning, so you can do arithmetic with words. Our model's world is too small to show that, so this map is a hand-built example space.
The table has one row per token and no idea where in the sentence that token sits. So a second learned row, one per position, is added on top. These are the first three tokens of your prompt.
An embedding on its own knows nothing about its neighbours. Attention fixes that. At every layer, each token asks a question of all the tokens before it and pulls in information from the ones that answer best. It is the only place in the model where information moves from one position to another. These are the real weights for your prompt.
Each row is one token's question; each cell is how much it took from the token in that column. The hatched half is the future: a token can never look at what has not been written yet.
What "asks a question" means in numbers. This is a hand-sized example with three numbers per vector, so every sum fits on screen; the model above does the same thing with twelve.
One round of attention is not enough. A model repeats the same two-part block several times: attention gathers information, then a small neural network (the MLP) digests it. Each block adds its result to a running vector kept for every token — a shared scratchpad that grows more useful with every layer.
The MLP is built from these. A neuron multiplies each input by a weight, adds them up, and passes the total through a curve that silences negative results. The weights are what training adjusts.
One running vector per token, rising through this model's layers. Gold arcs are the attention the last position really pays in that layer; the green flicker is the MLP. On the right is what the model would say if it were cut off at that depth.
Attention moves information between tokens. Then each token is worked on alone, by a small feed-forward network of the same kind as the one at the top of this page. This is the real one from this page’s model, running on the last token of your prompt: 24 numbers go in, are spread across 64 working neurons, and 24 numbers come out to be added back to that token’s running vector. Drag to turn it. Click a neuron to keep its connections lit.
The stack ends with one score for every token in the vocabulary. A function called softmax turns the scores into probabilities. Then a sampler rolls weighted dice. The settings below change the dice — the model has already finished its work.
The dice: each surviving token owns a slice as wide as its probability. A roll is a random point on this strip.
The model in this page is tiny. Here is the same step — scores, then odds, then a pick — in a real model called Qwen2.5-0.5B, which has about half a billion weights. It is far too big to run inside this page, so its output was recorded ahead of time. Nothing below is computed live. The page replays the recording.
White is the starting text. Gold is what the model added. A dotted underline marks a long shot: a token the model itself gave less than a 5% chance.
This model scores every token it knows at every step, about 150,000 of them. Only the ten highest are listed. The last row adds up all the others.
Every weight used in the chapters above began as a random number. Training shows the model real text with the next token hidden, measures how surprised it was by the truth (the loss), and nudges every weight a tiny step in the direction that would have made it less surprised. Then it does that again and again.
Height on this map is the loss. Training can only feel the slope under its feet, and steps downhill.
Same idea, every weight at once. Wipe the model back to random numbers and train it from nothing, here, in your browser. Watch three things: the loss falling, the sentences going from noise to sense, and the word map sorting itself out. When it finishes, every chapter above is running on the weights you made.
The shape network at the top of this page and the language model in these chapters are trained by exactly the same four moves: show an example with the answer hidden, read off the odds it gave the right answer, turn that into a loss, nudge every weight. Here are fresh copies of both, starting from random numbers. The copies are private to this panel, so nothing else on the page changes.
Pretraining, fine-tuning, learning from human feedback, safety tuning, and evaluation have their own page — including fine-tuning this same model on a word it has never seen.
Everything so far only continues text. So how does that become a conversation? A chat app glues the whole exchange into a single string, with special marker tokens saying who is speaking, and asks the model to continue it. When the model writes the end-of-turn marker, the app cuts it off and shows you the reply.
These are recorded replies from two versions of one small model. The first is the base model, trained only to continue text. The second is the same model after extra training on conversations. Pick a question and compare.
That one long string has a hard size limit. When a chat outgrows it, older turns are squeezed into a summary or fall out altogether — and the model carries on as if nothing were missing.
You have seen that the output is sampled from probabilities, and that the probabilities come from the context. So a prompt is not a command to a mind — it is the thing that decides which continuations are likely. Each line below is one possible run of the same model on the same prompt.
On its own, a model can only produce text from its training and its context. Give it tools and wrap it in a loop, and it becomes an agent: it can ask for a file, a search, or a command, read the result, and decide what to do next. Watch who says what to whom.
"AI" is not one thing. The useful questions are where the model runs, where your text travels, and what is bolted on around it.
Runs on your own hardware. Private and offline; quality limited by the machine.
Runs in a data centre. Usually the strongest reasoning, at the cost of sending your text out.
A model plus tools, memory, permissions, and a loop. It can act — and so needs guardrails.
Turns prompts into pixels or sound. Needs visual direction, not just facts.
Switch capabilities on and off and watch the profile change.
Once you know the machinery, the mistakes stop being mysterious. The first three below are not illustrations: they are this page's model, failing live, in exactly the ways large models fail.
A hallucination is a confident claim with nothing behind it. An assistant has summarised the short source below. Every sentence sounds fine, but some are not backed by the source. Tick the ones you think are unsupported, then check each claim against the source.
The vocabulary, with the common misunderstanding next to each term and a link back to the animation that shows it. Or let it quiz you.