Training sounds mysterious, but it's one tiny loop run at absurd scale: guess the next token, measure how wrong the guess was, nudge the weights to be a little less wrong. Play with each part of the loop below.
A language model never really 'knows' the next word — it hands every candidate a probability. Training compares that guess to the token that actually came next. (A token is a word or word-piece.)
The cat sat on the ___.-log(p): low if it was confident and right, high if it got blindsided.One number told us how wrong the guess was. Now we change the model to be a little less wrong — by rolling its weights downhill on the loss.
weight ← weight − rate × slope. The learning rate is how big a step you take.One guess barely moves the model. Do it across trillions of tokens and the loss slides down a long, curved hill — fast at first, then a slow crawl.
the is common or that qx never appears. Every point the curve drops is a pattern squeezed out of prediction errors, never a rule written by hand.This loop gives you a base model — a raw next-token predictor that will happily continue any text. Next: how that raw predictor is turned into a helpful assistant that answers you instead of just autocompleting.