cCarebun Reading‹ All reading
Carebun Interactive/How an LLM works LabCheat sheet Study view

An interactive mini book

How an LLM Works
Novice to Ninja

What happens between your question and the answer: tokens, weights, one multiplication repeated billions of times, and a guess. Taught from zero, with a real model opened up on the page.

Start readingOpen the lab

17 chapters · about 3.2 hours · 48 interactives · no background needed

How to read this book

  1. In order. Each chapter uses only what the earlier ones taught. The whole book takes about three hours of reading, and longer if you play.
  2. With your hands. Chapters marked interactive have sliders and small machines. Make your guess first, then move them.
  3. Trust the measured numbers. We opened a real model, GPT-2 small, and printed what is inside. Every such number can be reproduced with the programs in the book's examples folder.
  4. Answer before you look. Every chapter ends with questions and folded answers. Recalling beats re-reading.

Part I · Novice

What a language model is: a machine that guesses the next word, built from weights.

Part II · Apprentice

Inside the machine: tokens, embeddings, attention, chances, and how the weights were learned.

Part III · Journeyman

Using a model: the API, the context window, the bill, and what goes wrong.

Part IV · Ninja

How large the machines are, and one request followed from the first byte to the last.

Part V · Practice

Play with every number, answer the usual questions, and explain it all on a whiteboard.