Mock LLM — decode loop
Edit the prompt and knobs, then Run to watch tokens generate one at a time. This mock does not understand language — it faithfully demonstrates the mechanics: prompt → tokens → autoregressive loop → sampling.
A large language model is just a machine that guesses the next word, over and over, given everything so far. Here you type the “everything so far” (the prompt) and watch it guess, one word at a time.
Two knobs decide its behaviour everywhere: temperature (how random the guess is) and the seed (which makes randomness repeatable). Understanding these explains why the same question gives different answers — and how to make them stable.
- 1Leave temperature at 0, press Run twice — identical output (it always picks the top guess).
- 2Drag temperature to 1.5, Run twice — the text now drifts and even garbles.
- 3Keep temperature high but fix the seed, Run twice — random, yet identical again.
20 tokens. A real model splits into sub-word (BPE) pieces; these word/punct tokens are a legible stand-in so you can see the context the loop reads at every step.
Hit Run to generate.
Run to see the per-token sampling.
Run an operation to see it step by step.