Overview · Page 3 of 3

How It Guesses — Statistics in Action

When you send a message to an AI, it doesn't retrieve an answer. It generates one — word by word, each word a statistically-informed guess. This page explains exactly what that means, and why it matters.

One Word at a Time

When an AI responds to you, it doesn't compose the entire response and then display it. It generates one word (actually one "token" — a word or word-fragment) at a time, left to right, each new word informed by everything that came before it.

The process for each token is the same:

  1. The model receives your prompt plus everything it has generated so far
  2. It runs all of that through its billions of learned weights
  3. It produces a probability score for every word in its vocabulary — every possible next word, ranked by likelihood
  4. One word is selected from that ranked list
  5. That word is appended to the response and the process repeats

A 200-word response requires this full process to run 200 times. Each token is its own calculation, its own ranked probability distribution, its own selection. There's no plan for the full response — just one word at a time, each building on the last.

Key Insight

The model doesn't know what it's going to say. It discovers the response the same way you read it — one word at a time. The only difference is it's computing probabilities rather than experiencing narrative.

Not a Lookup. A Distribution.

This is the most important thing to understand about inference: the model never retrieves answers. It always generates them.

When you ask "What is the capital of France?" the model doesn't find a stored fact. It generates the sequence of tokens that is statistically most likely to follow that question — based on the patterns it learned during training. The answer "Paris" appears because "Paris" followed "capital of France" so consistently in training data that the model's weights strongly favor it in this context.

This is why the model can be wrong about things it states confidently. There's no truth-checking step. If a pattern in the training data was wrong, or if the model is operating in a context where the statistical signal is ambiguous, it will generate what fits the pattern — not what is factually correct.

Temperature: Controlling the Randomness

When the model produces its ranked list of probable next words, you might assume it always picks the top-ranked one. It doesn't have to. The "temperature" setting controls how much randomness is introduced into the selection.

Think of it like this: imagine the ranked list of words is a dartboard, with each word taking up space proportional to its probability. At temperature zero, you always aim directly at the highest-probability word — perfectly deterministic, always the same answer to the same prompt. At higher temperatures, the dartboard is shuffled — lower-probability words get a bigger slice, and the dart might land on something surprising.

Low temperature makes the model more focused and predictable. High temperature makes it more varied and creative — but also more likely to veer off into something incoherent. Most practical applications use a temperature somewhere in between.

Why This Matters

Two people can send the exact same message to an AI and get different responses — because temperature injects randomness. The model isn't being inconsistent; it's sampling from a probability distribution. The range of reasonable answers is similar each time; the specific words vary.

Why AI "Hallucinates"

Hallucination — when a model confidently states something false — is a direct consequence of how inference works. The model has no mechanism for checking whether what it's generating is true. It only has the learned pattern of what plausible-sounding text looks like in a given context.

If you ask it about a book that doesn't exist, it might generate a plausible-sounding description — author name, plot summary, publication year — because that's what text about books looks like. The pattern fits. The fact doesn't exist doesn't register as a problem because the model has no "does this exist?" check. It has "does this pattern fit?" and the answer is yes.

This isn't a bug that will eventually be patched. It's a fundamental property of the statistics-based generation process. It can be mitigated — by giving the model access to verified sources, by building retrieval systems around it, by using the model only in contexts where errors are caught downstream. But it cannot be eliminated as long as generation is fundamentally probabilistic pattern-matching.

What You Now Know

Three pages. Three ideas that, together, give you an accurate picture of what generative AI is:

That's the machine. Everything else — the personality, the helpfulness, the ability to write code or draft emails or explain complex topics — is what emerges when you train a machine this way on enough human-generated text.

Want to Go Deeper?

The 7-section Deep Dive walks through the actual code that implements all of this — every component of a real transformer, explained line by line. If you want to understand not just what it does but how it's built, that's the next step.

Think About It

Knowing that every AI response is a probabilistic generation rather than a factual retrieval — how does that change how you'd verify AI output? What kinds of tasks is this approach well-suited for, and what kinds should make you skeptical?

← How It Learns Course Home Deep Dive →