Interactive edition

Natural Language Processing with Transformers

An interactive study companion to the book by Lewis Tunstall, Leandro von Werra, and Thomas Wolf (O'Reilly, Revised Edition, 2022). Self-attention, question answering, and the frontiers of transformer research — rebuilt as labeled diagrams, step-through derivations, live attention widgets, and quizzes. The same ideas, made visual.

3 chapters 17 interactive sections 3 learning tracks 81 glossary terms
  • ⚡ Live attention labs
  • 🧮 Step-through derivations
  • 📊 Interactive plots & heatmaps
  • 🖼️ Every figure redrawn as SVG
  • ✅ Quizzes with explanations
This is the official free excerpt — it contains only Chapter 3 (Transformer Anatomy), Chapter 7 (Question Answering), and Chapter 11 (Future Directions) of the full 11-chapter book. The original chapter numbers are kept. The full book covers text classification, NER, summarization, training from scratch, and more.

Read a chapter straight through, or jump to any section below. Use / to move between sections; the sidebar tracks what you've read.

Part I — Transformer Internals

How a transformer actually works under the hood — building self-attention from scratch, stacking it into an encoder and decoder, and touring the zoo of BERT/GPT/T5-style models that grew from the original 2017 architecture.

Part II — Building Applications

Building a real review-based question-answering system end to end — span-based reading comprehension, retriever–reader pipelines with Haystack, and how to measure and improve every stage.

Part III — Frontiers

Where transformers are headed — scaling laws and their limits, making self-attention efficient, and moving beyond text into vision, tables, speech, and multimodal models.

Content faithful to Natural Language Processing with Transformers (Revised Edition) by Lewis Tunstall, Leandro von Werra, and Thomas Wolf (O'Reilly Media, 2022), rewritten as an original web-native, interactive edition for personal study. This site reproduces only the publisher's free three-chapter excerpt.