liveBook · Manning

Denoising

As explained in Grokking AI Algorithms, Second Edition

A denoising process is an iterative procedure that removes predicted noise from a corrupted representation to recover structured data.

Denoising removes predicted noise from a noisy image in small steps. In a diffusion model, it is less like painting a picture stroke by stroke and more like bringing a shape into focus: the model repeatedly decides what noise to take away. section 12.9 section 12.2

From a noisy blob to a tree

Start with random noise. After several denoising steps, a vague silhouette appears. Further steps make a trunk and canopy recognizable; later ones refine branches and texture. The first steps establish broad structure, while the final steps make smaller adjustments. section 12.2 section 12.25

Training and generation use noise in opposite directions:

  • During training, forward diffusion makes noisy examples from clean images. The saved noise patterns let a U-Net practice predicting the noise at a given timestep; prediction errors are used to update its weights. section 12.9 section 12.3
  • During generation, start with random noise. At each timestep, the U-Net uses the current image, timestep, and text-prompt embedding to predict noise. Subtract an amount set by the noise schedule, then repeat until an image emerges. section 12.25 section 12.3
Figure 12.54 The denoised images from timestep 1000 to timestep 1
12_54

Follow the images from timestep 1000 to timestep 1 to see repeated noise removal turn a noisy starting point into a clearer result. section 12.25

The noise schedule links the two directions. Its alpha and beta values govern how noise is added during training and how much predicted noise is removed during generation. Larger early corrections give way to smaller, cautious refinements. A schedule that adds noise too harshly can make denoising difficult to learn; one that is too gentle can make later steps costly. section 12.25 section 12.28

Denoising can also edit an existing image. For inpainting, a mask marks the region to replace; after each prediction, known pixels outside the mask are restored so the surrounding image stays in place. Outpainting uses a blank area beyond the image border as the region to fill. section 12.31

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Traces training examples and the repeated predict-and-subtract procedure, including timestep scaling and noise-schedule trade-offs.
Examples
Follows a tree emerging from random noise and shows image progressions across denoising timesteps.
What it assumes
Starts with clean images and explains how forward diffusion creates the noisy examples needed to learn denoising.
What you can do after
Evaluate/understand how a trained diffusion model generates or edits an image through repeated noise prediction and removal.
How it connects
Links forward diffusion, U-Net noise prediction, text embeddings, noise schedules, and inpainting.

Also explained in

Compare how 7 books explain denoising →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.