Skip to content
Instant download · PDF + web edition · Free sample of every book · 30-day refund promise
Latent Library Browse books
Deep Learning

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

  1. IntroductionIntroduction
  2. Chapter 1Tokens: Cutting Text Into Pieces
  3. Chapter 2Embeddings: Meaning as Coordinates
  4. Chapter 3Attention, Worked Through
  5. Chapter 4The Transformer Block
  6. Chapter 5The Residual Stream and the Feed-Forward Layer
  7. Chapter 6Pretraining: Learning From a Library
  8. Chapter 7The Mechanics of Training
  9. Chapter 8Scale: Parameters, Data and Compute
  10. Chapter 9From Predictor to Assistant
  11. Chapter 10Generation: How Answers Are Written
  12. Chapter 11Running Models Efficiently
  13. Chapter 12Transformers Beyond Text
  14. Chapter 13Looking Inside: Interpretability
  15. Chapter 14Variations on the Transformer
  16. Chapter 15Reasoning, Tools and Retrieval
  17. Chapter 16Measuring Language Models
  18. Chapter 17Limits and Frontiers
  19. AppendixExercises
  20. 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

FormatPDF + web edition
Length80 pages (approx.)
Chapters17
LevelIntermediate
LanguageEnglish
TopicDeep Learning
AuthorLatent Library Editorial

Keep reading

You may also like

All books
$15.00
Details