No history yet

Introduction to Diffusion Models

What Are Diffusion Models?

Diffusion models are a powerful type of generative AI that create new data, like images, from scratch. Think of it like a photograph slowly coming into focus. The model starts with a canvas of random static and gradually refines it, step by step, until a clear, coherent image appears.

Diffusion models work by adding noise to the available training data and then learning how to reverse the process.

Their main job is to learn the underlying structure of a dataset—say, a collection of cat photos—and then use that knowledge to generate entirely new cat photos that look completely real. This ability has made them the engine behind many popular text-to-image tools.

The Two-Step Dance

The magic of diffusion models comes from a two-part process: one that breaks an image down and another that builds it back up. It sounds complicated, but the core idea is surprisingly straightforward.

  1. The Forward Process: Systematically add noise to an image until it becomes unrecognizable.
  2. The Reverse Process: Learn how to remove that noise to create an image from scratch.

Let's look at each part separately.

From Image to Noise

The first step is called the forward diffusion process. The model takes a perfectly clear image from its training data and gradually adds a tiny amount of noise over hundreds or thousands of steps. This isn't just random static; it's a specific kind called Gaussian noise.

Gaussian noise

noun

A type of statistical noise that has a probability density function equal to that of the normal distribution, which is also known as the Gaussian distribution. In images, it looks like random speckles or static.

At each step, a little more noise is added. In the beginning, you can still see the original image. But as the steps continue, the image becomes progressively more obscured. Eventually, after enough steps, all that's left is a field of pure, random noise. The original image is completely gone.

Lesson image

This might seem destructive, but it’s a crucial learning phase. By breaking down thousands of images this way, the model gets an intimate understanding of how an image devolves into noise. It learns what noise looks like at every stage of the process. This prepares it for the much harder job: reversing the process.

From Noise Back to Image

This is where the real creation happens. The reverse diffusion process is about starting with a random patch of noise and carefully, step by step, removing the noise to reveal an image. Because the model has seen this process in reverse so many times, it has learned to predict what a slightly less noisy version of an image should look like.

The model takes the noisy input and, using what it learned during the forward process, subtracts a small amount of noise. It repeats this over and over. Each step refines the image, adding structure and detail where there was once only chaos. A faint outline might appear, then colors, then textures, until a brand new, high-quality image emerges from the static.

Lesson image

This generative process is a type of stochastic process, meaning it involves randomness at its core. It starts with random noise and follows a learned path, but with enough flexibility to create a vast variety of outputs. This is why you can generate many different images from the same text prompt.

While the idea has roots in thermodynamics and physics dating back decades, diffusion models only recently became a dominant force in AI, thanks to new research and more powerful computers. Today, they are used not just for creating art and photorealistic images, but also in fields like audio synthesis, drug discovery, and motion generation.

Quiz Questions 1/5

What is the primary function of a diffusion model in generative AI?

Quiz Questions 2/5

What happens during the forward diffusion process?