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 grid of numbers labelled tensor goes through a chain of blocks, linear and nonlinear, whose ends are shaped like plugs and sockets; letters with a cross sit to the side.
Learning as a Search Among Dials

Blocks That Fit Like Plugs

The first part of the book, called Compass and Needle, chapters two to six, sets up exactly this machinery. Seeing a network as a chain of differentiable building blocks raises two questions, and the book's second figure illustrates them. First, what kinds of data can go in and come out?

On a grid, the arrow (2, 1) plus twice the arrow (1, 3), which is (2, 6), completes a parallelogram ending at (4, 7); then the arrow (3, 4) with length 5.
Arrows, Lengths and the Dot Product

Vectors as Arrows

Most of the models in the book are built from very plain ingredients: sums, multiplications, and a few bent functions such as the exponential, sines and cosines, and square roots. Vectors, the tensors with one direction, have their own arithmetic, which mathematicians call a vector space.

Two 2 by 2 by 2 cubes, one filled with ones and one with twos, multiplied position by position and summed into 16, the same as the dot product of their flattened lists of eight.
Stacks of Tables and a Shorthand by Letters

A Dot Product of Whole Tensors

For the second kind, the book gives a generalised dot product. Take two tensors of the same shape, with three directions, multiply them position by position, and add up every single product. It is nothing but the ordinary dot product of the two tensors flattened into long lists.

A valley-shaped curve with a ball starting high on the left and taking steps downhill toward the bottom; each step is an arrow labelled with the step size, and a small flipped hill shows that maximising is minimising the negative.
Where the Ground Falls Fastest

Step by Step Downhill

Now to gradient descent. Suppose we want the input that makes a function of many numbers as small as possible, its minimum.

A latent space with two dog points almost touching, at (1, 2) and (1.1, 2.2), and a car point far away at (4, 6); a short line between the dogs reads 0.22 and a long line from dog to car reads 5.
What Makes a Good Pile of Examples

Close Meanings, Close Points

The chapter's opening figure looks ahead to something remarkable. A differentiable model transforms its input step by step with operations from linear algebra.

The likelihood written as a product of probabilities, then minus its logarithm written as a sum of minus logs; below, the forecaster example: 0.105 plus 0.511 equals 0.616, which is minus log 0.54.
The Most Likely Explanation, and Many Explanations at Once

From Product to Sum of Logs

How is such a model trained? Because the examples are assumed independent and drawn from the same distribution, the probability a model assigns to the whole dataset is the product of the probabilities it assigns to each example's true output. That product is called the likelihood of the dataset.

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