How a model learns — by minimizing its own surprise.

SRC·07 Source
Training is one nagging order: be less surprised next time.

Training is one nagging order: be less surprised next time.

A model learns from a firehose of text, but the lesson never changes: when the next word arrives, be less caught off guard than last time. No grammar rules, no facts handed down — just a running tally of surprise, pushed down word by word. Like a goalkeeper: the whole craft is reading the play early, so the shot is never a shock.
It never says one word. It bets on every word at once.

It never says one word. It bets on every word at once.

Ask for the next word and the model doesn't answer — it spreads its confidence across the whole vocabulary, a number on every option. Right-or-wrong can't grade that; it hedged across thousands of guesses. You need one score that rewards a big bet on the truth and stings a big bet on a dud. Like a fistful of darts: you throw at the whole board at once, but only where the bullseye lands decides your score.
Surprise has a formula: how rare it was, logged.

Surprise has a formula: how rare it was, logged.

surprise(x)=logp(x)\text{surprise}(x) = -\log p(x)
Give an event probability p; when it happens, your surprise is −log p. Call something near-certain and it arrives — almost zero surprise. Bet against it and it lands anyway — the surprise blows up. Like a bolt from a clear sky: the calmer you were sure it would stay, the harder the jolt when it strikes.
Your loss is just the surprise at the word that came.

Your loss is just the surprise at the word that came.

L=logqy\mathcal{L} = -\log q_{y}
Here's the move: of all those bets, only one word actually comes next. Your penalty is the surprise at that word — −log of the probability you gave it. Park lots of belief there: tiny loss. Starve it: huge loss. Every other guess is ignored when the bill arrives. Like a toll gate: you can dream of every road, but you only pay at the one the truth drives through.
Why 'cross-entropy': surprise measured against the truth.

Why 'cross-entropy': surprise measured against the truth.

H(p,q)=ipilogqiH(p, q) = -\sum_{i} p_i \log q_i
Average that surprise over everything that actually happens, weighting each outcome by how often it truly occurs, and you get cross-entropy. One word's penalty is luck; the real grade is the long-run average. Like a long exposure: a single frame tells you nothing, but hold the shutter open and the busy lanes burn brightest — the true pattern writes itself in.
Lowering surprise and raising likelihood are one move.

Lowering surprise and raising likelihood are one move.

argminθ  1Nnlogqθ(yn)  =  argmaxθ  nqθ(yn)\arg\min_{\theta}\; -\frac{1}{N}\sum_{n} \log q_{\theta}(y_n) \;=\; \arg\max_{\theta}\; \prod_{n} q_{\theta}(y_n)
Multiply thousands of tiny probabilities and the answer vanishes to zero — useless. Take logs and the product becomes a sum of surprises you can just add. And the flip falls out: making the data likely is making the total surprise small — one summit, two names. Like light fading with depth: each meter multiplies the dimming toward black, but counting the meters climbs steadily — the log is the honest measure.
This one number is the whole objective — and it counts choices.

This one number is the whole objective — and it counts choices.

perplexity=eH=exp ⁣(1Nnlogqθ(yn))\text{perplexity} = e^{H} = \exp\!\left(-\frac{1}{N}\sum_{n} \log q_{\theta}(y_n)\right)
Every gradient, every nudge to a billion weights, chases this single scalar down: the average surprise on the truth. Exponentiate it and you get perplexity — how many words the model is effectively torn between. A loss of ln 20 means it's as lost as a fair guess among 20. Lower loss, fewer live options, sharper mind. Like a braided river: the fewer channels the water can take, the surer its course.
🌱 A mind trained only to expect — can it ever truly surprise?

🌱 A mind trained only to expect — can it ever truly surprise?

🌱 Every step of training rewards one thing: being unsurprised by what was already written — so the model grows into the smoothest echo of the past. But the ideas worth having are the ones nobody saw coming. Can a mind built to minimize surprise ever make the kind that turns out right — or only ever finish our sentences?
tap →swipe ↑ for depthswipe ↓ to exit