Projects / Denoising diffusion from scratch, three schedules and three parameterizations
Denoising diffusion from scratch, three schedules and three parameterizations
Image and Video Generation, National Yang Ming Chiao Tung University
Abstract
I implement DDPM [1] from scratch, the forward noising, the reverse sampler and the training loss, first on 2D Swiss-roll data and then on AFHQ animal faces, and compare three noise schedules (linear, quadratic, cosine) with three things the network can predict: the noise, the clean image , or the posterior mean. Predicting gives the best FID with every schedule (1.20 with the quadratic one), but those samples are not the most natural, and two implementation fixes, one in the cosine schedule and one in the posterior-mean loss, changed the results more than any choice of schedule.
Noise schedules and parameterizations
The forward process adds Gaussian noise over steps, and a network learns to undo one step at a time. Given , a noisy sample at any step is drawn in closed form, and the standard objective trains the network to predict the noise that was added:
The same network can instead predict or the posterior mean of , and the schedule can be linear, quadratic or cosine. On the Swiss roll, the from-scratch model reaches a Chamfer distance of 21.49 to the data (Figure 1). Figure 2 shows the reverse trajectories on AFHQ for each predictor.

DDPM samples (orange) against the Swiss-roll data (blue), Chamfer distance 21.49.

Reverse-diffusion trajectories on AFHQ with the linear schedule, from pure noise (left) to the sample (right), for the noise, and posterior-mean predictors.
FID on AFHQ (lower is better) for every predictor and schedule.
| Predictor | Linear | Quadratic | Cosine |
|---|---|---|---|
| Noise | 8.37 | 9.00 | 13.94 (fixed) |
| 3.15 | 1.20 | 5.94 | |
| Posterior mean | 54.26 (SNR-weighted) | 64.41 | 90.21 |
Two fixes mattered. The cosine schedule first failed completely with the noise predictor (FID 74.58): the usual clipping of at 0.9999 affected 111 of the 1,000 steps, and clipping at 0.02, the linear schedule’s maximum, brought it to 13.94. The posterior-mean predictor was the weakest in every setting, and weighting its loss by the signal-to-noise ratio improved it from 87.40 to 54.26.

Samples of the predictor with the quadratic schedule, the best FID of the study (1.20).

Samples of the noise predictor with the linear schedule (FID 8.37).
Despite the best FID, the samples often show distorted features, while the noise predictor’s faces look more natural (Figures 3 and 4). A lower FID did not guarantee perceptually better images, so the samples had to be judged by eye as well.
Findings
- What the network predicts matters as much as the schedule: predicting gave the best FID with every schedule, and the posterior mean the worst.
- Implementation details can break a schedule: one clipping value turned the cosine schedule from 74.58 to 13.94.
- FID is not the whole story: the configuration with the best FID did not give the most natural faces.
References
- J. Ho, A. Jain and P. Abbeel. Denoising diffusion probabilistic models. NeurIPS, 2020.