Библиотека · CC BY-SA 4.0

Приключения Алисы в Странедифференцируемых чудес

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

Иллюстрация к книге

Выберите версию

Один и тот же текст на каждом уровне, на всех языках и во всех оформлениях, что здесь есть. Выберите, потом слушайте или скачивайте.

Слушать и смотреть

Тот же плеер, который продукт даёт для вашей книги: голос, рисунки по мере того, как они рисуются, текст.

Современный учебник о том, как на самом деле устроены нейросети: от тензоров и градиентов до трансформеров. Глава 6 показывает, как программа сама находит свои градиенты: автоматическое дифференцирование, обратный проход, на котором обучается любая модель.

Это пробная часть: 1 из 13 (главы).

Из лекций

A box with three inputs, six weights and two outputs; beside it a grid of 2 by 3 cells for the input Jacobian and a grid of 2 by 6 cells for the weight Jacobian.
A Chain of Buttons

The Two Tables of a Primitive

The book assumes only one thing about each primitive: that we know its local rates, collected in two tables called Jacobians. The input Jacobian says how each output number moves when each input number is nudged, so it has one row per output and one column per input.

The function a·sin x + b·x·sin x and its derivative a·cos x + b·x·cos x + b·sin x, with the two sines and the two cosines highlighted as repeated work.
Three Ways to Find a Slope

A Formula and Its Repeats

The second way is the one you learned at school. Take a small function: a times the sine of a number, plus b times the number times its sine.

A long product drawn as shapes: a thin row of ones, then three square tables, then one narrow table; a red arrow from the right end shows table-times-table products, a green arrow from the left end shows a row moving through the tables and staying a row.
Walking the Chain Backwards

Which End to Start From

The book writes out the rate of the final score with respect to the weights of one step, somewhere in the middle of the chain. It is a long product. First comes a row of ones, which stands for the final sum: every number of the last result counts once in the score.

A box with the forward pass entering on the left and leaving on the right, and two arrows going back through it: one gives the weight rates, the other the next adjoint; below, rows with a single one in turn rebuild a full table row by row.
Never Build the Table

A Primitive With Two Backward Rules

So a backward step is just two calls. Call the weight vector-Jacobian product with the adjoint, and out come the rates of the score with respect to that step's weights. Call the input vector-Jacobian product with the same adjoint, and out comes the new adjoint, ready to be carried one step back.

A machine labelled grad takes in the function sum of squares and gives out a new function; fed 1, 2, 3, the new function returns 2, 4, 6, while the old one returns 14; below, an object with weights inside is opened into a function that takes input and weights side by side.
Notes Left Along the Way

A Function That Makes Functions

In a functional library such as JAX, everything is a function, and so is differentiation. A vector-Jacobian product becomes a function that makes functions.

The ReLU with the line of slope one half through the corner: at input 2 the line is at 1 below the ReLU's 2, at input −2 it is at −1 below the ReLU's 0; the line of slope 1.5 reaches 3 at input 2, above the ReLU.
A Ruler at the Corner

Checking a Subgradient

The more careful answer uses the fan you just drew. For a function that curves upwards, a convex function, a subgradient at a point is the slope of a line through that point which stays below the whole function everywhere.

Как это сделано

Примеры для: 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

Источник

Лекции пересказывают с английского оригинала книгу arXiv 2404.17625 (version 3, 2025), автор — Симоне Скардапане; книга вышла под открытой лицензией, которая разрешает пересказ и перевод. Пересказ, рисунки и голос сделаны ИИ и сверены с книгой второй моделью. Как используется ИИ.

Лекции — переработка оригинала и распространяются под той же лицензией: их можно свободно распространять и перерабатывать с указанием автора и ссылкой на эту страницу: CC BY-SA 4.0

Ваша трудная книга — так же

Загрузите учебник или любую сложную книгу. Первые пять минут бесплатно.

Загрузить книгу