No history yet

Introduction to Diffusion Models

From Noise to Masterpiece

At their core, diffusion models are a type of generative AI that creates new data, like images or audio, from scratch. They work by learning to reverse a process of gradually adding noise to an image until it becomes pure static. Once trained, the model can start with random noise and work backward, step by step, to generate a completely new, coherent image.

Think of diffusion models like a sculptor working in reverse.

Instead of chipping away at a block of marble to reveal a statue, a diffusion model starts with a 'block' of random noise and carefully refines it into a detailed picture. This process is broken down into two main parts: the forward process and the reverse process.

The Forward Process: Adding Noise

The first step is the forward process, where the model learns what noise looks like. It takes a clean, clear image from a training dataset and systematically adds a small amount of random noise over many steps. This is repeated again and again until the original image is completely indistinguishable from random static.

Imagine taking a photograph and adding a tiny bit of grain. Then you add a little more, and a little more, until the original photo is completely lost in a sea of static. This controlled degradation is the key to training the model.

The forward process is destructive. It methodically turns structured data into unstructured noise.

But how much noise is added at each step? That's determined by something called a noise schedule.

Noise Schedule

noun

A predetermined sequence that defines how much noise is added at each step of the forward diffusion process.

The noise schedule is like a recipe. It could specify adding a small, constant amount of noise at each step (a linear schedule) or adding noise more slowly at the beginning and faster toward the end (a cosine schedule). The choice of schedule can significantly impact how well the model learns and the quality of the final generated images. It's a critical part of the model's design.

The Reverse Process: Denoising

After the model understands how to turn an image into noise, the real magic begins: the reverse process. The model is trained to do the exact opposite. It learns to look at a noisy image and predict the specific noise that was added to it in the previous step of the forward process.

By subtracting this predicted noise, it can take a small step back toward the original, cleaner image. It repeats this over and over, starting from pure static and gradually denoising it at each step until a clear, new image emerges.

Lesson image

The model isn't just randomly removing static. During training, it was shown the noisy image at step tt and the slightly less noisy image at step t1t-1. Its goal became to figure out how to get from tt back to t1t-1. After seeing millions of examples, it becomes incredibly good at predicting and removing the right amount of noise to reveal the underlying structures, shapes, and colors that form a coherent picture.

Data generation is achieved using a learnt, parametrized reverse process that performs iterative denoising, starting from pure random noise.

This two-part system of adding and then learning to remove noise is what allows diffusion models to generate such stunningly detailed and varied images from a simple starting point of random static.

Quiz Questions 1/5

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

Quiz Questions 2/5

The 'forward process' in a diffusion model involves training the model to remove noise from an image step-by-step.