Skip to main content

Rectified Flow from Scratch

Key Insight

Rectified flow is a kind of flow matching: instead of predicting the noise added at a discrete step the way DDPM does, you train the model to predict a velocity — the straight-line direction ε - x_0 that points from a half-noised image back toward clean data. Because the training paths are straight lines, sampling simply steps along the predicted arrows by solving an ODE (with Euler or Heun), and you reach good images in only 10–50 steps. Re-deriving your earlier diffusion model with this objective shows how little has to change — the same network, but a simpler loss with no noise schedule to tune — yet it trains cleanly and few-step sampling works out of the box.