Library · CC BY-SA 4.0

Alice's Adventures in aDifferentiable Wonderland

Alice's Adventures in a Differentiable Wonderland, Volume I: A Tour of the Land

Cover illustration of the book

Choose your version

The same text, told at every level, in every language and look shown here. Pick, then listen or download.

Listen and watch

The same player the product gives for your own book: the voice, the drawings as they are drawn, the text.

A modern textbook on how neural networks really work, from tensors and gradients to transformers. The first three chapters lay the ground: what the book is about, the linear algebra and calculus a network runs on, gradient descent, and what a dataset and a loss function are.

This is a sample: 3 of 13 chapters.

From the lectures

A box with many knobs takes a photo and outputs cat; after a wrong answer an arrow turns one knob; below, a photo turns into a grid of numbers labelled tensor.
One Simple Recipe, Scaled Up

Learning Is a Search

Looking under the hood starts with one idea: learning is a search. You write a program with a vast number of adjustable knobs, called parameters, and you turn them until the program behaves well.

A 2 by 3 matrix of rows times a 3 by 2 matrix of columns gives a 2 by 2 table, each cell the dot product of one row with one column.
Arrows That Recognise Each Other

Many Dot Products at Once

A table of numbers, a matrix, can be read as a stack of such vectors, one per row, and the book calls this a batch of data. Multiplying matrices is then nothing more than computing many dot products at once, every row of one against every column of the other, in a single operation.

From one point, a gradient arrow pointing uphill and three unit step arrows: along it with full slope, at a right angle with slope 0, and diagonal with a partial slope.
How Costs Grow, and Which Way Is Uphill

Every Slope from One Arrow

Stand on a sloping lawn or a ramp and take one small step in several directions: straight up, sideways, diagonally. You should feel the steepest climb in one direction, no climb at all at right angles to it, and partial climbs in between.

Left, a bowl-shaped curve where marbles from both sides end at the same bottom; right, a bumpy curve where each marble settles in the nearest hollow.
Walking Downhill in the Fog

Bowl versus Egg Carton

Where does the walk end? It stops where the ground is flat, a stationary point, but flat ground can be a valley floor, a hilltop, or a saddle like a mountain pass that falls one way and rises the other.

A look-up table scores perfectly on its own examples; two bars show a near-zero training loss and a high test loss, with the gap between them marked.
A Score to Lower, and a Test You Have Not Seen

Memorised versus Learned

Then comes a trap. The average loss on the training examples can always be made perfect by a cheat: a look-up table that stores every example and answers with it, and gives some default for anything else. That table has memorised and learned nothing, exactly like your friend with last year's test.

A client's features in a column, each multiplied by a weight and summed into one prediction, which is either a number or a class.
Many Possible Models, and the Simplest One

The Simplest Block

Chapter 4 now builds the simplest block of all, the linear model, of which the book says every differentiable model is a clever variation.

How it was made

Examples for: a curious adult with school maths who uses AI apps every day; add one modern instance per idea, such as how a chat assistant or a phone's photo app is trained

The source

The lectures retell the English text of arXiv 2404.17625 (version 3, 2025) by Simone Scardapane, published under an open licence that allows retelling and translation. The retelling, the drawings and the voice are made by AI and checked against the book by a second model. How AI is used.

The lectures adapt the original and are released under the same licence, free to share and adapt with credit to the author and a link to this page: CC BY-SA 4.0

Your own hard book, the same way

Upload a textbook or any difficult book. The first five minutes are free.

Upload a book