RecapSection I introduced Langevin Dynamics for sampling from :
where is the score function, and .
Section II defined DDPM’s processes:
Forward Process ():
The discrete version adds noise through:
where is the noise at step , and controls the noise schedule.
Backward Process ():
where .
Section III covered the denoising objective:
which trains to predict (approximating ).
ODE and Flow-Based Diffusion Model
The ODE Based Backward Diffusion Process
The backward diffusion process is not the only reverse process for the forward process . We can derive a deterministic ordinary differential equation (ODE) as an alternative, removing the stochastic term in the backward process.
To obtain this ODE reverse process, consider the Langevin dynamics with a rescaled time ():
Following the same logic used to derive the backward diffusion process in Section II, we could read from this splitting the backward ODE (known as the probability flow ODE 1):
where is backward time, and is the score function of the density of in the forward process. This ODE maintains the same forward-backward duality as the SDE reverse process .
Since the ODE is deterministic, it enables faster sampling than the SDE version. Established ODE solvers—such as higher-order methods and exponential integrators—can further reduce computational steps while maintaining accuracy.
Variance Perserving, Variance Exploding, and Rectified Flow
With the ODE based backward process, we can discuss three common formulations of ODE based diffusion models: variance-preserving (VP), variance-exploding (VE), and rectified flow (RF). We demonstrate their mathematical equivalence and show how they can be transformed into one another.
To simplify notation, we now use continuous time and its corresponding state , rather than discrete notations like and .
Variance Preserving (VP)
The ‘variance-preserving’ formulation is very similar to what we have introduced in the previous section, just replacing the SDE backward process to the ODE version.
The forward diffusion process in continuous time is:
where and . It is the same as introduced in the previous section.
Forward and Backward Processes
The forward and backward processes in VP notation are consistent with the previously introduced DDPM model, with the only difference being the substitution of the SDE backward process with the ODE version.
- Forward SDE ():
- Backward ODE ():
where is reversed time, and the score function is learned via the denoising objective.
Discrete Forward and Backward Processes
We also list the discrete version of Forward and Backward Processes, which is used in trainining and inference practice.
- Discrete Forward SDE: Suppose we discretize the time as and denote , , then
- Discrete Backward ODE: Correspondingly, we discretize the backward diffusion time as and denote . This discretizes the backward diffusion process 1 into:
To see how this matches the continuous version, note that .
Score Matching Objective
While we previously trained the denoising network using the , we can alternatively model the score function directly. This yields the equivalent score matching objective:
where follows the forward process. This represents an equivalent but reweighted version of the original denoising objective.
Variance Exploding (VE)
The variance exploding formulation provides an alternative to variance preserving. Define:
Substituting the definitions above and rewriting the process in VE notation yields:
where is the clean image corrupted by the standard Gaussian noise .
Forward and Backward Processes
Substituting the definitions from and rewriting both the and yields:
- Forward SDE:
- Backward ODE:
The advantage of the VE notation lies in its simpler backward ODE compared to the VP notation. In practice, directly discretizing the using an Euler solver tends to yield greater accuracy than the , which includes an additional term that can introduce numerical errors. However, a notable disadvantage of the VE notation is that can become quite large at time , potentially leading to numerical instability.
Discrete Forward and Backward Processes
We also list the discrete version of Forward and Backward Processes, which is used in trainining and inference practice.
- Discrete Forward SDE: Suppose we discretize the as and , then
where is a standard Gaussian noise.
- Discrete Backward ODE: Correspondingly, define and denote . This discretizes the backward diffusion process into:
Denoising Objective
To directly model , we adapt the to VE coordinates by replacing with :
where and follows the VE forward process. This preserves the denoising objective’s structure while operating in VE space.
Rectified Flow (RF)
While often presented as a distinct framework from DDPMs, rectified flows are mathematically equivalent 2 to DDPMs. We now provide a much simpler proof via the following transformations:
Rewriting the process in yields:
This process linearly interpolates between clean data () and standard Gaussian noise . While many sources refer to as since both represent Gaussian noise, this notation can be misleading. Such notation suggests that is a deterministic interpolation between and . But in fact is a combination of clean data and random Gaussian noise, similar to the formulation in VP and VE notation.
Forward and Backward Processes
The forward and backward process of rectified flow model could be derived from the and by substituting the .
- Forward SDE:
- Backward ODE:
The advantage of the rectified flow notation is its simple backward ODE, which eliminates the diverging behavior of at time found in the VE notation, ensuring that remains within a finite range of .
Discrete Forward and Backward Processes
We also list the discrete version of Forward and Backward Processes, which is used in trainining and inference practice.
- Discrete Forward SDE: Suppose we discretize the as and , then 3
where is a standard Gaussian noise.
- Discrete Backward ODE: Correspondingly, define and denote . This discretizes the backward diffusion process into:
Flow Matching Objective
To directly model , we transform the by substituting and with and , respectively. This transformation utilizes the and processes and the definitions from , while also neglecting a constant scaling factor of . As a result, we obtain the flow matching objective:
where follows the RF forward process. This represents a re-weighted equivalent of the denoising objective, interpreted in the flow matching framework where corresponds to the endpoint and models the velocity field transporting to .
IMPORTANTThe equivalence between VP, VE, and RF notation
The three notations (VP, VE, and RF) are mutually transformable through the mappings defined above. Models trained with score matching, denoising, and flow matching objectives can be converted into other notations. This implies that samplers or guidance designed for one notation can be easily transformed and adapted to the others.
What is Next
Now that we have covered the major theories of diffusion models, including DDPMs, ODE-based diffusion models, and flow models, it is important to note that these models are primarily unconditional. In the next section, we will explore how diffusion models can be utilized to model conditional distributions.
Stay tuned for the next installment!
Discussion
If you have questions, suggestions, or ideas to share, please visit the discussion post.
Cite this blog
This blog is a reformulation of the appendix of the following paper.
@misc{zheng2025lanpainttrainingfreediffusioninpainting, title={LanPaint: Training-Free Diffusion Inpainting with Asymptotically Exact and Fast Conditional Sampling}, author={Candi Zheng and Yuan Lan and Yang Wang}, year={2025}, eprint={2502.03491}, archivePrefix={arXiv}, primaryClass={eess.IV}, url={https://arxiv.org/abs/2502.03491},}
Footnotes
-
Song, Y., Sohl-Dickstein, J., Kingma, D. P., Kumar, A., Ermon, S., & Poole, B. (2020). Score-Based Generative Modeling through Stochastic Differential Equations. arXiv preprint arXiv:2011.13456. ↩ ↩2
-
Gao, R., Hoogeboom, E., Heek, J., De Bortoli, V., Murphy, K. P., & Salimans, T. (2025). Diffusion Models and Gaussian Flow Matching: Two Sides of the Same Coin. The Fourth Blogpost Track at ICLR 2025. https://openreview.net/forum?id=C8Yyg9wy0s ↩
-
Liu, X., Gong, C., & Liu, Q. (2022). Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. ArXiv, abs/2209.03003. ↩