The interactive film is in the book's Companion

Play it, pause it, turn it and drag it with Mathematics for AI and Machine Learning.

Get the book

Rectified Flow: Straightening by Retraining

Chapter 20 · Mathematics for AI and Machine Learning · Advanced · 1:46

An interactive live film in one dimension: random pairs cross, the learned velocity surface bends the flow, and one Euler step misses. After one round of reflow the paths are straight and a single step is exact.

Narration

Flow matching joins each noise point to a data point by a straight line, and learns the velocity that moves points along such lines. Here the space has one dimension: the position x runs across the floor, and the time t runs back, from zero to one.

Pair noise and data at random, and the training lines cross each other everywhere. Where two lines cross, the model sees two different velocities at the same place and time, and it learns their average.

The rest of the narration is in the book's Companion.

More from Chapter 20

Interactive1:45Flow Matching: Velocity Fields and the Continuity EquationChapter 20Preview1:28From a Residual Network to a Neural ODEChapter 20Preview1:27Gradient Flow: Gradient Descent With Infinitely Small StepsChapter 20Preview1:26Memory by Orthogonal Projection (HiPPO)Chapter 20Preview1:36Momentum Methods: Second-Order ODEChapter 20Preview1:34Probability Flow ODE: Deterministic Paths, Identical MarginalsChapter 20Preview1:40Backward Error Analysis: What Gradient Descent FollowsChapter 20