Learning and architectures / 7 of 7
Transformers: the big picture
What you’ll learn
- Explain the main idea of “Transformers: the big picture” in your own words.
- Trace a concrete example and identify the assumptions behind it.
- Apply the principle in a practice problem and recognize a common failure.
The idea, intuitively
Transformers use attention to mix information across sequence positions. They can process positions in parallel during training, while autoregressive generation still produces tokens sequentially. Position information is needed because attention alone does not encode order.
Treat a neural network as a computation graph, not a mysterious black box. Follow a tiny input through each operation and keep track of tensor shapes. Distinguish the forward pass, gradient computation, and optimizer update. These three stages are connected but solve different parts of the learning problem.
Under the hood
A block typically combines attention, a feed-forward network, normalization, and residual connections. A causal mask prevents a position from attending to future tokens during next-token training.
Longer context can increase compute and memory costs substantially.
A worked example
In “the animal crossed the road because it was tired,” attention can connect the pronoun with earlier context; attention weights alone are not a complete explanation.
How to use this way of thinking
Build intuition with a small calculation before scaling dimensions. Check whether the architecture can represent the desired relationship, then whether optimization can learn it, then whether the learned solution generalizes. A failure in any one of these stages needs a different response.
Try it yourself
Explain why position information matters for “dog bites person” and “person bites dog.”
Key takeaways
- To prevent future-token information leakage
- Longer context can increase compute and memory costs substantially.
- Check the assumptions with a small example before applying this idea to a larger system.
Check your understanding
Use feedback to learn. Quiz scores and lesson completion are tracked separately.
Go to lesson completionFurther reading
Original papers and reference material for this school. External resources may be in English and require internet access.
Dive into Deep Learning (opens a new tab)PyTorch: automatic differentiation (opens a new tab)Finish this lesson
Mark this lesson complete when you’re ready to continue.