Course contentsShow
← Machine Learning and Deep Learning
Lesson 1542 of 3,53834. Diffusion ModelsFree lesson

Closed-Form Forward Sampling

Using reparameterization to sample any noisy timestep directly without iterating through all steps.

Closed-Form Forward Sampling

What You'll Learn

You'll learn how to jump directly to any noisy timestep in the diffusion process without iterating through all previous steps.

The Core Idea

In the forward diffusion process, we gradually add noise to an image over T timesteps. Naively, to get a noisy image at timestep t=500, you'd need to apply noise 500 times sequentially. That's incredibly inefficient!

Fortunately, thanks to the properties of Gaussian distributions and the reparameterization trick, we can derive a closed-form equation that lets us sample any noisy version of the image directly in a single step.

Remember from earlier lessons that each forward step adds Gaussian noise, and combining Gaussian distributions has nice mathematical properties. By repeatedly applying the noise-addition formula and using the fact that sums of Gaussians are also Gaussian, we can collapse the entire chain into one expression.

The Mathematical Result

The closed-form forward sampling formula is:

x_t = √(α̅_t) * x_0 + √(1 - α̅_t) * ε

Where:

  • x_0 is the original clean image
  • α̅_t (alpha-bar) is the cumulative product of (1 - beta) values up to timestep t
  • ε is standard Gaussian noise sampled once

This means you can generate a noisy image at any timestep t by simply scaling the original image and adding appropriately scaled noise—no loops needed!

Why This Matters

This closed-form makes training dramatically more efficient. During training, you can randomly sample any timestep t and immediately compute what the noisy image should look like, allowing parallel training across all timesteps.

Key Takeaway: Closed-form forward sampling lets you jump directly to any noise level using a single equation, making diffusion model training practical and efficient.