What a Language Model Is (and Isn't)
Understand what a large language model actually does under the hood — next-token prediction over learned patterns — so you can build accurate intuitions instead of sci-fi ones.
One Job, Repeated Very Fast
Strip away the chat bubble, the friendly tone, and the instant replies, and a large language model is doing exactly one thing: predicting the next token, over and over. That’s it. Everything you’ve seen it do — write code, summarize a contract, hold a conversation, explain a joke — is that one prediction step, chained thousands of times in a row.
This isn’t a simplification you can safely forget once you know more. It’s the fact that explains almost every quirk you’ll run into later: why models “hallucinate,” why they’re sensitive to how you phrase things, why they forget what you said ten messages ago. Get this model right in your head first, and the rest of the course will make a lot more sense.
How the Prediction Actually Works
A language model is trained on an enormous amount of text — books, articles, code, conversations. During training, it’s repeatedly shown a chunk of text with the next piece hidden, and it adjusts billions of internal numbers (called parameters or weights) to get better at guessing what comes next.
After training, those weights are frozen. When you send a prompt, the model doesn’t look anything up. It runs your text through that fixed network of weights and produces a probability distribution over “what token is likely to come next” — then picks one, appends it to the text, and repeats the whole process to pick the next one. This is called autoregressive generation: each new token is generated conditioned on everything before it, including the tokens it just generated itself.
Notice what’s not in that loop: no database lookup, no fact-checking step, no understanding in the way a person understands. It’s pattern completion, shaped by training data, applied one token at a time.
What This Means in Practice
Because the model is predicting plausible continuations, not retrieving verified facts, a few things follow directly:
- Fluency and correctness are separate properties. A model can produce a grammatically perfect, confident-sounding sentence that is completely false, because fluency is exactly what it was trained to produce. Correctness is a side effect, not the objective.
- It has no persistent memory of you. Each request is processed fresh against the frozen weights. Anything it “remembers” about your conversation is only there because the previous messages were literally re-sent as part of the current prompt — more on this in the next lesson.
- Phrasing changes output. Since generation is conditioned on the exact token sequence you provide, two prompts that mean the same thing to a human can lead the model down different probability paths and produce different answers.
- Output isn’t perfectly repeatable. Most model APIs, including Claude’s, sample from that probability distribution rather than always taking the single most likely token — which is why asking the exact same question twice can produce two differently worded (and occasionally differently reasoned) answers, even with nothing else changed.
These aren’t edge cases to memorize — they’re the same underlying mechanism showing up in different situations. Every quirk in this list traces back to the one sentence at the top of this lesson: next-token prediction, repeated.
Real models use billions of learned weights, but you can build intuition for autoregressive generation with a tiny toy version — a hardcoded table of “if you just said this word, here’s what’s likely next” — and a loop that keeps picking and re-feeding.
# A miniature, hand-built stand-in for "next-token prediction."
# Real models learn these probabilities from data; here we just fake a few.
next_word_probs = {
"the": {"capital": 0.4, "cat": 0.3, "weather": 0.3},
"capital": {"of": 0.9, "city": 0.1},
"of": {"france": 0.5, "japan": 0.3, "spain": 0.2},
"france": {"is": 1.0},
"is": {"paris": 0.8, "lovely": 0.2},
}
import random
def generate(start_word, steps=5):
sequence = [start_word]
current = start_word
for _ in range(steps):
choices = next_word_probs.get(current)
if not choices:
break
# Pick the next word weighted by its probability, like sampling
# from a real model's output distribution.
next_word = random.choices(
list(choices.keys()), weights=choices.values()
)[0]
sequence.append(next_word)
current = next_word
return " ".join(sequence)
print(generate("the"))
# e.g. "the capital of france is paris"Run it a few times. You’ll sometimes get “the cat” instead of “the capital” — same mechanism a real model uses, just with a probability table you can actually see, instead of billions of learned weights you can’t.
The Misconceptions Worth Killing Early
Wrong mental model: “I asked it a factual question and it checked its database, like a search engine.”
What actually happened: the model generated the most statistically plausible continuation of your prompt, based on patterns absorbed during training. If that pattern happens to match a true fact — which it very often does, since true statements are common in training data — you got a right answer. If the pattern that felt most plausible was wrong or the fact was rare, you got a wrong answer stated with exactly the same confidence.
Treat every factual claim from a model as a claim to verify, not a lookup result — especially for anything specific, recent, or high-stakes. Module 3 goes deep on why this happens and how to catch it.
A colleague says: 'The model told me the meeting is on Thursday, and it sounded really confident, so it must be right.' What's wrong with that reasoning?
Reveal Answer & Explanation
Confidence in tone is not evidence of correctness — a language model’s fluency comes from its training to sound plausible, not from checking facts.
The model’s “confidence” isn’t a signal it computed about its own accuracy; it’s just the natural byproduct of generating fluent, well-formed language, which it does whether the underlying claim is true or invented. A wrong answer and a right answer can be phrased with identical certainty. The fix isn’t to distrust the model less confidently — it’s to verify specific, checkable claims (like a meeting date) against a real source, regardless of how the answer was delivered.
Up Next
Now that you know a model works one token at a time, the next question is: what exactly is a token, and why does that unit — not words, not characters — explain why models have a fixed-size “memory” that fills up and why they sometimes seem to forget the start of a long conversation.