Type a prompt, press Generate, and watch GPT-2 continue it word by word. There is no server involved: the model is downloaded once into your browser and every token is computed on your own machine.
Low temperature and low top-k make the text safe and repetitive; high values make it surprising and often nonsensical. Try the extremes.
GPT-2 (124M parameters, released by OpenAI in 2019) is a language model: given a sequence of tokens it predicts a probability distribution over the next token. Generation is just that step, repeated — sample a token, append it, predict again. Everything you change above affects how that sample is drawn:
Unchecking sampling switches to greedy decoding: always the single most likely token. The output becomes deterministic — the same prompt gives the same continuation every time — and usually rather dull.
Your first reaction will probably be that the output is rubbish: it drifts off topic, invents quotes, contradicts itself, and ignores questions. That is worth sitting with, because it is the honest baseline. What you are looking at is pure next-word prediction and nothing else. GPT-2 was trained on one objective — given this text, which token comes next in a web page? — and it has no notion of being asked something, of being helpful, or of whether any of it is true. If there was ever a stochastic parrot, this is it: it reproduces the statistical patterns of the text it was trained on, convincingly enough to look like language, with no model of the world behind it.
What separates this from the assistants you are used to is mostly what came after pre-training. A model like ChatGPT or Claude starts from the same next-token objective, and is then put through further training stages that GPT-2 never had:
Scale is the other half of the story: this is the 124M-parameter version, some four orders of magnitude smaller than current frontier models, trained on roughly 40 GB of scraped web pages, and it can only see 1024 tokens of context. So when you compare the text below to ChatGPT, you are not mainly seeing a gap in size — you are seeing what a language model is before anyone has taught it to behave like an assistant.
The page loads Transformers.js, which runs models through ONNX Runtime Web — the same ONNX runtime you would use in Python, compiled to WebAssembly so it executes inside the browser tab. The weights are a quantised (8-bit) ONNX export of GPT-2 hosted on the Hugging Face CDN; the browser fetches them once and keeps them in its Cache Storage, so a second visit starts instantly.
One detail worth stealing: the model runs in a Web Worker, on a thread of its own. Run it on the main thread instead and the tab freezes solid for the whole generation — no text appearing token by token, and a Stop button that cannot be clicked. Because the worker is busy inside WebAssembly it cannot read incoming messages either, so Stop terminates it outright; the weights stay in the cache, so the next run only reloads them.
This means the page is fully static. It is served from GitHub Pages, which only ever hands out files — no Python, no GPU, no API key, no inference bill. Your prompt never leaves your laptop. The whole thing is one HTML file you can view the source of, copy, and host yourself.