Denoising removes noise from a corrupted input by reversing a gradual noising process. A diffusion model learns to remove small amounts of noise repeatedly until image structure re-emerges. section 2.2.1 section 10.3
During generation, denoising works as an iterative reconstruction process:
- Start with random noise or an existing image, depending on whether the task is synthesis or image-to-image generation. section 2.2.1
- Pass the current data and timestep to a learned model that predicts the noise added at that stage. section 10.7
- Subtract the predicted noise, optionally reintroducing a controlled amount of noise to explore possible reconstructions. section 10.7
- Repeat the update across timesteps until a coherent result appears; masking preserves pixels outside the selected editing region. section 2.2.1 section 10.7
Turning a horse into a zebra
A text prompt supplies the desired change, an input horse photo anchors the composition, and a mask identifies the editable region. Repeated denoising repaints the masked horse while preserving the surrounding scene and pose. section 2.2.1
Sampling from random points
A PyTorch implementation starts with random points and iterates backward from the final timestep. At each step, sample_timestep predicts noise and updates the points, eventually producing a recognizable PyTorch logo. section 10.7
Figure 10.3 Forward and reverse processes of diffusion models on an image
Compare the forward process, which gradually destroys image structure with noise, against denoising, which restores structure step by step. section 10.3






