Quiz: diffusion models and generated detail
Before this unit: Attention, transformers and pretrained models (previous unit); Generating and exploring images with a VAE (day 39); Day 36: Neural networks; Day 38: Evaluation and statistics; Day 39: Variational autoencoders.
See also: Day 15: Watershed; Day 5: Deconvolution; Day 35: Gaussian mixtures.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. In the forward process, what happens to an image as \tau goes from 0 to 1, and what does the noise schedule decide?
Signal \sqrt{\bar\alpha}, noise \sqrt{1 - \bar\alpha}.
The signal is shrunk and Gaussian noise is added until only noise is left (\bar\alpha \approx 0). The schedule decides how fast: how much signal remains at each time.
Q2. Why is training a denoiser “supervised learning with free labels”?
Who added the noise?
We take clean training images and add noise ourselves, so the correct answer (the noise, or the clean image) is known for every training example without any annotation.
Q3. At very high noise, what does the best possible denoiser output?
What is the best guess when the noisy image says almost nothing?
The average of all clean images compatible with the noisy one; at the highest noise, the average of the whole training set: a blurry mean image, not a sample.
Q4. Why does sampling with very few steps give blurry or “in-between” results?
Q3.
Each step jumps towards the denoiser’s estimate, which at high noise is an average of many images. With few steps the sample ends near such an average (between modes); many small steps let the estimate refine at lower noise levels, where it follows one mode.
Q5. A diffusion model was trained to perfection on 50 images. What will its samples be?
What distribution does a perfect denoiser of 50 images describe?
Copies of the 50 training images: the perfect denoiser of a finite set generates exactly that set. Real networks generate new images because they are imperfect (they smooth between examples).
Q6. What does a strong guidance weight do to conditional samples?
Typical versus diverse.
They become more typical of the condition and less diverse: samples move to where the condition is most certain and away from anything that might also fit another condition.
Q7. A restoration’s posterior mean and one posterior sample: which has the higher PSNR on average, and which looks more realistic?
Averaging removes uncertain detail.
The mean has the higher PSNR (it minimises the expected squared error; a sample has twice the error for a Gaussian posterior). The sample looks more realistic: it is sharp everywhere, but its uncertain details come from the prior.
Q8. A generatively restored image shows two nucleoli in a cell whose nucleoli are smaller than the blur of the raw image. May you report “two nucleoli”?
Where does detail below the resolution come from?
No. Below the resolution of the measurement the detail comes from the prior (the training images). Count on the raw data, or validate the count on images with ground truth, and check whether several samples agree.
Q9. Why is a prior that has never seen a rare phenotype dangerous for restoration?
What does the posterior do with something it cannot explain?
It explains the measurement with the closest normal training images, so the rare phenotype is “corrected” to normal. The result looks convincing, and even samples agree on it, so nothing warns you.
Q10. (math) x_0 = 3, \sqrt{\bar\alpha} = 0.6, \sqrt{1 - \bar\alpha} = 0.8, \varepsilon = 0.5. Compute x_\tau and its variance given x_0.
x_\tau = \sqrt{\bar\alpha}\,x_0 + \sqrt{1 - \bar\alpha}\,\varepsilon.
x_\tau = 1.8 + 0.4 = 2.2. Given x_0 the variance is 1 - \bar\alpha = 0.64.