Preface

The promise

This is a textbook to learn from, not a catalog of frameworks. It combines explanation, mathematics, runnable code, real measurements, diagrams, and exercises in one continuous path. The intended reader understands neural networks, backpropagation, and basic Python, but has not yet studied language models or agent systems. Everything else we define in plain language at first use.

The aim is senior engineering judgment: not jargon, not reference tables, but the ability to build a mechanism, measure it, and defend it. We earn that in layers: first intuition, then a precise mechanism, then working code whose output you can see, then the production boundary where the toy stops being enough.

How each chapter works

Chapters follow one rhythm, borrowed from Dive into Deep Learning. We open on the concrete thing the chapter builds. We motivate each idea in plain prose before any equation or specification. We implement it in small executable cells, run them, and read the real output together, imperfect results shown honestly rather than cleaned up. A short summary and a set of investigative exercises close the chapter.

Systems chapters, where there is no model to train, substitute a small simulation or measurement for the training curve: we build the mechanism, drive it with a synthetic workload, print the numbers, change one knob, and measure again.

How code is presented

Teaching code lives inline, in full, in cells that run top to bottom as you read. Nothing is hidden behind an external file or an elided fragment. Every runnable cell shows what it produced, a printed value, a generated completion, a measured latency, or a plot, so you can reproduce every number in the book on a laptop, offline, with pinned seeds. Definitions that later chapters reuse are marked so a small script can extract them for the test suite; the code you read is the code that runs.

Real API calls, which are neither deterministic nor free, appear as explicitly labeled recorded runs: the exact request, and one captured response shown as data.

How to read figures

Figures earn their place. Most are plots the chapter’s own code produced; a few are diagrams that compare approaches, locate a component, or trace a flow that prose carries poorly. Every figure has a numbered caption phrased as the question it answers, and the sentence after it states the conclusion to keep. Color is never the only carrier of meaning.

A note on 2026

The field moves faster than a book. We therefore keep durable mechanisms in the chapters and volatile details, such as model names, versions, prices, benchmark standings, and legal dates, in dated callouts and in Appendix C, which records the source and the next date to re-check. Deleting a dated callout never breaks the surrounding explanation.