Inside the Transformer
How Large Language Models Read, Think and Write
- Pages
- 80
- Chapters
- 17
- Level
- Intermediate
- Format
- E-book
About this book
Large language models are built from a surprisingly small set of ideas. Inside the Transformer explains each of them clearly and in order, so that by the end you can describe what happens between typing a question and reading the answer.
You will follow text as it is split into tokens, turned into embeddings and given positions; work through self-attention with a small numeric example; see how attention heads, feed-forward layers, residual connections and normalisation form a transformer block; and understand how pretraining, instruction tuning and preference training turn a text predictor into an assistant.
Final chapters cover generation settings such as temperature and top-p, context windows and their costs, and an honest look at the limits of current models and the research directions aimed at them.
What you will learn
- How tokenisation and embeddings represent text as numbers
- Self-attention, worked through with real numbers
- The parts of a transformer block and why each one matters
- How pretraining and fine-tuning create an assistant
- How sampling settings shape generated text
- The real limits of today's models and where research is heading
- How the residual stream and feed-forward layers store and move information
- How to count parameters and estimate training compute, memory and KV-cache size
- Efficient inference, mixtures of experts, interpretability and how models are evaluated
Table of contents
- IntroductionIntroduction
- Chapter 1Tokens: Cutting Text Into Pieces
- Chapter 2Embeddings: Meaning as Coordinates
- Chapter 3Attention, Worked Through
- Chapter 4The Transformer Block
- Chapter 5The Residual Stream and the Feed-Forward Layer
- Chapter 6Pretraining: Learning From a Library
- Chapter 7The Mechanics of Training
- Chapter 8Scale: Parameters, Data and Compute
- Chapter 9From Predictor to Assistant
- Chapter 10Generation: How Answers Are Written
- Chapter 11Running Models Efficiently
- Chapter 12Transformers Beyond Text
- Chapter 13Looking Inside: Interpretability
- Chapter 14Variations on the Transformer
- Chapter 15Reasoning, Tools and Retrieval
- Chapter 16Measuring Language Models
- Chapter 17Limits and Frontiers
- AppendixExercises
- GlossaryGlossary
Who this book is for
Technically curious readers, developers, product managers and students who want to understand how language models work internally. Comfort with basic algebra helps; no prior deep-learning knowledge is assumed.
Details
| Format | PDF + web edition |
|---|---|
| Length | 80 pages (approx.) |
| Chapters | 17 |
| Level | Intermediate |
| Language | English |
| Topic | Deep Learning |
| Author | Latent Library Editorial |
Keep reading