The surprising idea
If it is not looking answers up, what is it doing?
If nothing is looked up, where is Paris?
Llama 3 8B, an open model from Meta, ships as about 16 GB of weights that you can download and inspect byte by byte. It was trained on more than 15 trillion tokens of text. Ask it “What is the capital of France?” and it says Paris essentially every time, with no database, search index or network call involved.
Pause and predict So where is “Paris”? Where inside those 16 GB is the sentence “Paris is the capital of France”?
And yet it answers. It also handles requests that nobody had written down before you asked, such as this one:
An LLM is a function: text so far in, probabilities for the next token out. What it “knows” is written nowhere in it as text; it is implicit in the billions of numbers that shape that function.
Every system you have built works differently
As a programmer you know three ways to make a computer answer a question. All three are about getting out what somebody put in.
Database
Someone stored a row. You fetch that row by its key.
Search engine
Someone wrote a document. You get a ranked list of documents that match your words.
Program
Someone wrote a rule for this case. The rule runs.
- The problem
- People ask open-ended questions in free wording, including questions nobody has asked before.
- The naive fix
- Store more rows, index more documents, write more rules.
- Why it fails
- Language is unbounded. The number of possible 20-word questions is astronomically large. You cannot pre-store answers, and you cannot write a rule per case.
- The idea
- Stop storing answers. Instead, learn one general function that, given any text, says what is likely to come next. Then generate answers with it.
- The trade-off
- A function that produces plausible continuations for any input will also produce plausible continuations when it should say “I do not know”.
A function with billions of dials
Seen from the outside, the whole model is one function signature.
Inside that function the work is ordinary arithmetic, mostly multiplications and additions, repeated billions of times for every token. The arithmetic uses a very long list of constants, and those constants are what the model is.
- Parameters (also called weights)
- The adjustable numbers inside the model. Change them and the same input gives different probabilities. A model file is, near enough, this list of numbers.
- For example:
y = a·x + bhas two parameters,aandb. Set them to 2 and 1 and the function maps 3 → 7. A small GPT-2 has 124 million of them. Modern models have billions to trillions.
Where do the numbers come from? Nobody types them in. They start random.
Then the model is shown a huge amount of text, one position at a time, and asked “what comes next?”. It answers with probabilities, and we look at how much probability it gave to the token that really came next.
After every prediction, every number is nudged a tiny bit in the direction that would have made the true next token more likely. This happens even when the guess was good. A prediction that put 60% on the right token could have been a little better, so it gets a small nudge too. Only a prediction of 100% on the right token would need no nudge.
(In practice the nudges for many positions are averaged and applied together.)
Trillions of predictions later, the function is good at predicting text. That process is training, and you will build it from scratch, starting with Gradient descent.
After training, “Paris” is not stored. But the numbers have been shaped so that, when the input is “The capital of France is”, the arithmetic happens to produce a very high probability for “ Paris”.
You have met “knowledge as parameters” before. A spam filter does not store a list of spam emails: it stores a few thousand weights.
A line fitted through data points does not store the points. It stores a slope and an intercept, and can answer for an x it never saw. An LLM is the same idea at an enormous scale: a curve fitted through human text.
Could it be storing the text anyway?
A fair suspicion is that the numbers are a zipped copy of the internet. Public figures for Llama 3 8B are enough to check it.
Pause and predict Llama 3 8B was trained on more than 15 trillion tokens of text, and its weights take about 16 GB. Roughly how many times smaller is the model than its training text?
So the model cannot be holding more than a small fraction of its training text. Mostly it can only be holding the regularities in it: grammar, facts that recur, styles, how code is structured, how arguments go.
This cuts both ways. A fact that appeared thousands of times has shaped the numbers strongly.
A fact that appeared once has usually left almost no trace. But the model will still produce a fluent continuation when asked about it.
What you should remember
- An LLM is a function: tokens so far → a probability for every possible next token. It is not a database, a search engine or a rule-based program.
- What it knows is implicit in its parameters: billions of numbers tuned by training so that real text became likely. No sentence is stored as a sentence.
- Because it generates rather than retrieves, it handles rewording and brand-new requests.
- For the same reason it always answers. It has no “not found”, and it is trained to produce text that is likely, which is not always text that is true. That is where made-up answers come from.
- Classic systems are exact and brittle. LLMs are flexible and inexact. Good products combine them.
Where this appears in a real LLM
Why is next-token prediction enough?
Guessing the next word sounds like autocomplete. How does that produce working code, or a correct explanation of why the sky is blue?
Consider what it takes to be good at the guessing game on different kinds of text:
- To predict the next token of 48213 + 90577 = across millions of such lines with different numbers, memorising fails. Something like addition has to be captured.
- To predict the next line of a Python function, it pays to track which variables exist and what the function is for.
- To predict the end of “The ball was dropped from the tower. After two seconds it had fallen about…”, it pays to have captured some regularity about falling objects.
- To predict the last page of a detective story, it pays to have tracked who was where.
The training goal never mentions arithmetic, code or physics. But text is produced by a world with structure, and the most efficient way to predict the text is to capture some of that structure in the numbers.
- In this lesson
- The hand-written probability table in the pipeline explorer
- Soon: a model with a few thousand parameters that you train yourself on tiny text
- It learns spelling and short-range word patterns
- In a real system
- The same function signature: tokens in, probabilities out
- Billions to trillions of parameters, trained on trillions of tokens
- Captures grammar, facts, styles, code structure and some multi-step reasoning
A character-counting toy and a frontier model run the same loop. They differ in scale: how many numbers the function has, and how much text shaped them.
You now have the two big ideas: the loop, and the function inside it. Your map of the course lays out the boxes inside that function.