How a language model learns

Pull one slider and watch a pile of random numbers turn into a prediction over a thousand training steps.

Training steps 0

Tap a part of the diagram to open that step.

The whole loop

Pieces of text → numbers → layers of weights → scores → percentages → error → a correction to every weight. Nothing is memorised: training is millions of tiny adjustments to numbers, repeated until the right continuation becomes the most likely one.

What's inside

  1. 1 Cutting the text up — The leading space belongs to the piece, so " drinks" and "drinks" are two different rows.
  2. 2 Numbers instead of words — Move the slider and the jitter stops — the numbers settle on values that mean something.
  3. 3 Layers and attention — Line colour is the sign of the weight, thickness is its size. Right now every weight is random.
  4. 4 The prediction — The correct continuation, "Milk", is still in third place.
  5. 5 Error and learning — The slider drives that cycle: by step 1000 "Milk" is at 92%, "Tractor" at 0.01%, and the error has fallen to 0.08.
Read more How I Accidentally Built an LLM Orchestration System in the Browser An architectural look at how Litseller used GPT API, React, prompts, and browser-side orchestration to generate structured book catalog content.

Explorable Explanations

Training steps 0
1 / 5