From Noise to Images

Introduction

Project introduction

From Noise to Images

You have written every piece both models need, which are the noise schedule, the one-jump forward process, the DDPM training loss, one reverse step, a sampler that skips steps, and an Euler sampler that follows a velocity.

In the notebook they come together, already written, and your tasks are to wire them into training and read the results. On a 2D spiral you train a small DDPM and a small rectified flow in about 15 seconds each and watch their samples trace the spiral. On 14 × 14 Fashion-MNIST clothing images you use the same functions with networks trained offline with the same budget.

What you will find out

With many steps both models are good. With 5 steps DDPM gives a blur on the spiral and washed-out shapes on images, while rectified flow still traces the spiral and draws clothes with clear outlines. You will trace this to one division in the DDPM step that multiplies every mistake when a step is big.

The images also keep the story honest. There the gap is smaller and closes by about 25 steps, and with 100 or more steps DDPM makes the better images, so rectified flow mainly buys speed.

From noise to an image

DDPM and rectified flow
step 999
step 600
step 400
step 200
step 0
noiseimagemany small DDPM stepsa few straight flow steps
Add noiseone jump to any step
Predict itthe training loss
Walk backDDPM sampling
Go straightrectified flow

How the notebook is organized

01

A toy spiral

Write a score for samples, wire DDPM and rectified flow into training, and sample both.

02

The few-step race

Find the fewest steps each model needs, then look inside DDPM to see why it breaks.

03

Clothing images

Race the pretrained DDPM and flow, then try a sampler that adds no noise.

Sample a spiral and clothing images

Run the whole project in the browser, about 60 minutes.

Open the notebook project