What exactly does a network learn when we teach it to remove noise?
A noise level is a signal-to-noise ratio; schedules differ in how long they stay at each one.
Noise erases fine detail first, so generation paints coarse first.
The best denoiser at one noise level: for a Gaussian image model it is the Wiener filter; in general the average clean image compatible with the noisy one.
Denoising score matching: squared-error training on pairs we make ourselves gives the score of the noised data, without ever knowing the density of images.
One network for all noise levels; three equivalent outputs (noise, clean image, score).
Slides titled The math give the formulas and proofs; the ideas are complete without them.
From Diffusion models and generated detail: add noise until only noise is left (\mathbf x_\tau = \sqrt{\bar\alpha}\,\mathbf x_0 + \sqrt{1-\bar\alpha}\,\boldsymbol\varepsilon), train a network to remove it, and generate by denoising pure noise step by step. The best denoiser returns an average of the compatible clean images.
A noise level is a signal-to-noise ratio
Divide \mathbf x_\tau by \sqrt{\bar\alpha}: the noisy image is clean image + noise of size σ, with
\bar\alpha = 0.8, 0.5, 0.2: SNR 4, 1, 0.25; σ = 0.5, 1, 2 (in units of the data). Recall SNR from camera noise.
From here on: “noise level σ”, \mathbf x = \mathbf x_0 + \sigma\boldsymbol\varepsilon. Time and schedule only say which σ when.
Two schedules (linear, cosine) are two paths through the same SNRs: on a log-SNR axis they differ only in how long they linger at each level. SNR 1 is reached at τ = 0.26 (linear) and τ = 0.50 (cosine).
What noise destroys first
Image power falls with frequency (recall the power spectrum of the Fourier unit); white noise is flat. At each noise level, every frequency whose power lies below the noise floor is gone.
So the forward process erases fine detail first and coarse layout last, and generation (the reverse) paints coarse layout first, fine detail last.
Numbers: power 1000/f^2, noise floor 1/\text{SNR}. Crossover f^{*} = \sqrt{1000\,\text{SNR}}: SNR 1 → 31.6, 0.1 → 10, 0.01 → 3.2 cycles per image. Ten times less SNR: the crossover drops by \sqrt{10}.
Try it: noise against the spectrum
The best denoiser at one noise level
Gaussian image model (only a power spectrum P(f), random phases): the best denoiser is the Wiener filter of the deconvolution day with no blur: per frequency, multiply by P/(P + \sigma^2): keep what lies above the noise floor, shrink what lies below.
Example: data with variance 4, noise level σ = 1: multiply by 4/5 = 0.8. At σ = 2: 0.5; σ = 4: 0.2. More noise, more shrinkage towards the mean.
Real images are not Gaussian. The best denoiser (lowest squared error) is the conditional mean: the average of all clean images that could have produced this noisy one. Sharper than Wiener where the data say what is there, an average where they do not.
The math: the optimal denoiser for a Gaussian prior
One frequency (or one pixel), x_0 \sim \mathcal N(0, P), x = x_0 + \sigma\varepsilon. Jointly Gaussian, so
For a sum of independent frequencies the problem separates: the Wiener filter is the optimal denoiser of the Gaussian image model. Any squared-error minimiser is the conditional mean: \mathbb E\|f(x) - x_0\|^2 = \mathbb E\|f(x) - \mathbb E[x_0\mid x]\|^2 + \text{const}.
Denoising score matching, intuition first
Make training pairs ourselves: take a clean image, add noise we choose. The noise is the label.
Regress the clean image (or the noise) on the noisy one with squared error.
A squared-error learner converges to the average target for each input: the conditional mean \mathbb E[\mathbf x_0 \mid \mathbf x].
That average is one step along the score, the direction in which noisy images become more likely: \hat{\mathbf x}_0 = \mathbf x + \sigma^2 \times \text{score} (Tweedie).
We never need the density of images. The binned average of the pairs is the denoiser.
Denoising score matching as pseudocode
for many training images x0:
choose a noise level σ, draw noise ε
x = x0 + σ · ε # the input
put the pair (x, x0) into the bin of x
denoiser(x) = mean of x0 over the bin of x # a network: squared-error regression instead
score(x) = (denoiser(x) − x) / σ²
No density of images anywhere: only pairs that we made ourselves.
Empty bins have no answer: a network must guess there.
Try it: pairs, averages and a learned network
The math: denoising score matching
The forward kernel p(\mathbf x \mid \mathbf x_0) = \mathcal N(\mathbf x_0, \sigma^2 I) has the score \nabla_{\mathbf x}\log p(\mathbf x\mid\mathbf x_0) = -(\mathbf x - \mathbf x_0)/\sigma^2 = -\boldsymbol\varepsilon/\sigma (in the \bar\alpha form: -(\mathbf x_t - \sqrt{\bar\alpha}\,\mathbf x_0)/(1-\bar\alpha)).
Identity (Vincent 2011): for any function \mathbf s_\theta,
Which output is trained changes how errors at the different noise levels are weighted, not what the perfect network is. The usual network is a U-Net with the noise level fed in.
The math: parameterisations and weighting
With \mathbf x_t = \sqrt{\bar\alpha}\,\mathbf x_0 + \sqrt{1-\bar\alpha}\,\boldsymbol\varepsilon:
Training on the noise weights the low-noise levels (high SNR) heavily, compared with training on the clean image. Aside: the loss summed over noise levels with suitable weights is the ELBO of a VAE whose encoder is the fixed noising process and whose latent is the pure-noise end.
Where learned denoisers fail
Far from the data (and at low noise between modes): training pairs are sparse there, so the network has little to go on. The exact denoiser at x = 3.5 in the demo says 2.28, a network after 200 steps 3.25, after 20 000 steps still 2.62.
Rare modes get little weight in a squared-error loss: after 2 000 steps the learned score at the rare mode points away from it, towards the common one (recall the rare blob of diffusion2d).
High noise is easy (the answer is close to “the mean”); the hard part is the low-noise detail, where the binned average becomes a staircase.
Summary
Noise level = SNR; schedules are paths through the SNRs. In noise-level form: clean image + noise of size σ.
White noise drowns the high frequencies first: generation goes coarse to fine.
The best denoiser is the conditional mean; for a Gaussian image model it is the Wiener filter.
Training a denoiser with squared error on pairs we make ourselves (denoising score matching) learns that mean, and so the score, without the density of images.
Noise, clean image and score outputs are interchangeable; learned denoisers are weakest far from the data and on rare modes.