Like flow matching models, diffusion models seek to learn a generative process between a simple distribution
The noising process can be written as a stochastic differential equation that defines the evolution of a sample from
Here
Here the
where the divergence of the matrix-valued term is taken row-wise, so that
We denote reverse time as
In reverse time, the probability current changes sign, so we get
From Anderson’s result for diffusion processes, we know that the reverse-time process for a diffusion is also a diffusion with the same diffusion matrix. So let’s assume a reverse-time SDE with position
We can then match the reverse-time current to the negative of the forward current:
Solving for the reverse drift gives
Expanding the numerator yields
so that
In the common isotropic case, where the diffusion covariance is spatially constant and proportional to the identity so that
the correction term
Given that
Training
The training target of diffusion models is the score function
Equivalently, in reverse-time notation this is
Since we do not have access to the true marginal score, we instead use a conditional score target. This yields the conditional score matching loss:
This conditional score matching loss expectation is an unbiased estimator of the true score function due to a similar argument to the conditional flow matching loss unbiasedness proof.
For Gaussian noising processes, the conditional score is available in closed form, which makes this objective tractable. In practice, many denoising diffusion models use equivalent parameterizations such as noise prediction or denoiser prediction rather than predicting the score directly.
Sampling
Once we’ve learned an estimator
Using a simple Euler-Maruyama solver, this becomes:
After the final step,
In practice, numerical solvers or more advanced sampling methods like Langevin Dynamics are used for better results.