VisualAI
Chapter 3 · Language Models

Large Language Models

ChatGPT, demystified: it's a machine guessing the next word — really, really well.

9 minLesson 8 of 23

Here's the secret that powers ChatGPT, and it's almost disappointingly simple: it guesses the next word. Then it does it again. That's the entire trick — done very, very well, at a scale that's hard to imagine.

Everything you've built converges here. A large language model takes the text so far and predicts what comes next. It doesn't blurt out one word, though — it produces a probability for every word it knows. Then something picks one, adds it to the text, and the whole thing runs again on the now-longer text. Be that something:

Next-Token Predictor

You are the model — pick the next word

The cat sat on the

What word comes next?

Temperature0.80

Low → safe & repetitive (always the top word). High → creative & chaotic.

A toy model, but the loop is the real one: read the text, score every next word, pick one, repeat. That loop is ChatGPT.
Try this

Click words to write a sentence yourself. Then try the two extremes. Hit Most likely over and over — safe, but flat and a little robotic. Now push Temperature up and hit Sample — suddenly it's adventurous, surprising, sometimes nonsense. Press Auto-writeand watch it generate on its own. That temperature dial is the exact same “creativity” knob behind ChatGPT.

Predicting, then feeding back its own words

Notice the loop: each word the model picks becomes part of the input for the next prediction. It writes by reading what it has written so far — over and over. This feed-it-back-in style is called autoregression, and it's how a next-word predictor turns into something that writes whole paragraphs.

Two small truths behind the curtain. First, models predict tokens, not always whole words (“running” might be run + ning). Second, those probabilities aren't hand-set like our toy's — they pour out of a deep network full of the attention layers and embeddings from the last few lessons, trained by gradient descent on a staggering amount of text.

Key idea

A large language model is a next-token predictor run in a loop. Temperature controls how boldly it samples: low stays on the safest, highest-probability path; high takes risks. Everything that feels like reasoning, style, or knowledge is this one mechanism, scaled up beyond intuition.

This also explains why these models sometimes make things up. They're built to produce the most plausible-sounding next word — not the most trueone. When a confident-but-wrong answer is the statistically natural continuation, that's exactly what you get. Knowing that is the difference between using AI well and being fooled by it.

The payoff

That's the whole ladder. You started by teaching a machine from examples, watched everything dissolve into numbers, fit a line, stacked neurons into networks, turned words into geometry, let them pay attention to each other — and arrived at the machine guessing the next word that is ChatGPT. AI is no longer magic to you. It's a set of ideas you've felt with your own hands. Welcome to the other side. ✦