How ChatGPT works
The clearest plain-language explanation of large language models you will read. No maths, just the one simple thing they actually do.
ChatGPT can write essays, explain quantum physics, and crack jokes. It feels like it understands you. So the honest truth is surprising: underneath, it is doing one strikingly simple thing, over and over. It is guessing the next word. That is not a simplification hiding the real magic. It genuinely is the whole trick, and this lesson shows you exactly how it turns into something that feels intelligent.
It predicts the next word
A large language model, the kind of AI behind ChatGPT, has one job: given some text, predict what word most likely comes next. Type "The capital of France is" and it predicts "Paris". Then it adds that word, looks at the whole thing again, and predicts the next word. And the next. One word at a time, it writes a whole reply.
That repeated guess-the-next-word, using its own output as it goes, is how a machine that only predicts words ends up writing paragraphs, poems, and code.
Try it: be the language model
Below is a tiny version of the same idea. Start with a few words, and it offers the most likely next words with their odds, just like the real thing (only much, much smaller). Keep clicking to build a sentence one word at a time.
Next-word predictor
How did it learn the odds?
Remember lesson 2: AI learns from examples. A language model is trained by reading a staggering amount of text, much of the public internet, books, and articles, and playing a simple game billions of times: cover the next word and try to guess it. Every wrong guess nudges it to do better. After enough practice, it has absorbed the patterns of language: grammar, facts, styles, and the way ideas tend to follow one another.
It also breaks text into pieces called tokens (roughly, word-fragments) and it is really predicting the next token. That detail lets it handle any word, even ones it has never seen, but the idea is the same: predict what comes next.
Why it sounds smart but does not "know"
Here is the crucial catch. The model is predicting likely words, not true ones. Usually likely and true line up, because truthful text is common. But not always. When the model does not have the pattern, it will still confidently produce plausible-sounding words, which may be completely made up. This is called a hallucination, and it is not a bug it will simply grow out of; it is a direct result of how the machine works.
So what is a transformer?
You will hear that these models are built on a transformer. In one line: a transformer is the particular design that lets the model weigh which earlier words matter most when predicting the next one, its way of paying attention to context. That is what made these models so good. How it works in detail is a topic in itself, and if this lesson has you hooked, that is exactly where to go next.
