Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
Lesson 1 of 12
What Does an LLM Learn?
Before understanding how an LLM learns, it helps to understand what it is actually learning. The answer is simpler — and more interesting — than most people expect.
The Core Learning Task
An LLM learns one fundamental thing: given a sequence of tokens, what is the most likely next token?
This is called next-token prediction, and it is remarkably simple as a task. But doing it well across billions of examples of human text requires the model to learn:
- Grammar and sentence structure
- Facts about the world (history, science, geography, culture)
- Logical reasoning and cause-and-effect relationships
- Writing styles, tones, and formats
- Programming languages and code patterns
- Mathematical patterns
- How conversations work
All of this emerges from training on the single task of predicting the next token. The model does not have these concepts explicitly programmed — it develops them as a side effect of learning to predict text accurately.
What Does an LLM Learn? Diagram
What Emerges from Next-Token Prediction
- Language understanding: to predict the next word, the model must understand grammar and sentence structure
- World knowledge: facts come up so often in training data that the model learns them to make better predictions
- Reasoning: the model learns cause-effect patterns by seeing millions of examples of logical text
- Common sense: everyday assumptions appear so frequently in text that the model learns them implicitly
- Code: the model learns programming syntax and patterns the same way it learns natural language
- Style and tone: the model learns that formal text follows different patterns than casual conversation
Quick Q&A
Key Takeaways
- Before understanding how an LLM learns, it helps to understand what it is actually learning.
- Language understanding: to predict the next word, the model must understand grammar and sentence structure
- World knowledge: facts come up so often in training data that the model learns them to make better predictions
- Reasoning: the model learns cause-effect patterns by seeing millions of examples of logical text
Finished this lesson?