Chapter 0: The Grand Vision
Chapter 0: The Grand Vision
What Problem Are We Solving?
Imagine you type "I love" into ChatGPT. How does it know "pizza" or "coding" are good next words, but "purple" isn't? That's what transformers solve: predicting the next word based on everything that came before.
Think of it like playing "What happens next?" with friends. If someone starts a story with "I love," you'd naturally suggest words that make sense—food, activities, people—not random words like "purple" or "elephant." Your brain has learned from thousands of conversations which words typically follow others. Transformers learn the same patterns, but from billions of text examples.
In technical terms, this is called autoregressive language modeling—a fancy phrase that simply means: predict one word at a time, using everything you've generated so far to inform the next choice.
What does "autoregressive" actually mean? Break it down: "auto" means "self" and "regressive" means "depending on previous values." So autoregressive = depending on its own previous outputs.
Imagine writing a sentence with a blindfold on. You write "The", then lift the blindfold to see what you wrote, then write "cat", lift the blindfold again to see "The cat", then write "sat". Each word depends on seeing all the previous words. That's autoregressive.
Mathematically: P(\text{sentence}) = P(w_1) \times P(w_2|w_1) \times P(w_3|w_1,w_2) \times \ldots
This notation means: The probability of the whole sentence equals the probability of the first word, times the probability of the second word given the first, times the probability of the third word given the first two, and so on. Each prediction is conditional on all previous words.
Is It Just Fancy Autocomplete?
You might hear someone say: "AI models are just autocomplete with extra power."
That's partly true, but it misses the most interesting part.
Yes, the training game is: given the words so far, guess the next word. But to get good at that game, memorizing exact sentences is not enough. The model has to learn a kind of internal map of language and ideas.
Think of it like a giant map where related ideas live near each other:
- ocean, water, waves, deep, boat
- blue, sky, light, color, clear
- doctor, symptom, medicine, patient, hospital
The model may never have seen, for example, the words "blue" and "ocean" together before, but it can still combine ideas that live in related neighborhoods. If it has learned that oceans connect to water and depth, and that blue connects to light, sky, and color, then "blue ocean" is not a random jump. It is a reasonable connection between learned ideas.
This is where embeddings come in. An embedding is a list of numbers that stores useful meaning about a token. We will build this idea carefully in Chapter 3. For now, just remember: the model is not storing meaning as dictionary definitions. It is storing meaning as patterns in numbers.
Later layers make this even richer. They can adjust meaning based on context, so the word "bank" in "river bank" is treated differently from "bank" in "bank account." That is much more powerful than a simple list of "what word usually comes next."
This is why language models can help with brainstorming. They can combine learned patterns and suggest connections you may not have considered. But we need one important warning: a new connection can be useful, creative, or completely wrong. The model is predicting likely text, not proving truth.
The Magic Ingredients
- Attention - Words "talk" to each other to share meaning
- Position awareness - The model knows word order matters
- Deep stacking - Layers refine understanding progressively
- Parallel processing - All words computed at once (unlike slow RNNs)
Course navigation: Previous: Introduction - What Are Transformers Really? | Next: Chapter 1 - Building Our Vocabulary