Diffusion and score-based models represent one of the foundational paradigms of modern generative artificial intelligence, underpinning systems across image synthesis, video generation, audio modeling, and continuous multimodal representations. For years, generative diffusion was approached from two distinct perspectives: discrete-step denoising diffusion probabilistic models (DDPM) pioneered by Sohl-Dickstein et al. and Ho et al., and score matching with Langevin dynamics (SMLD / NCSN) introduced by Song and Ermon.
In 2020, Song et al. unified both frameworks under the continuous-time mathematical theory of Stochastic Differential Equations (SDEs). By treating the noise corruption and generative reconstruction processes as continuous paths governed by forward and reverse-time Itô SDEs, the framework revealed that discrete diffusion models are numerical discretizations of underlying continuous processes.
This continuous formulation unlocked several practical capabilities: exact likelihood computation via continuous normalizing flows, deterministic sampling via the Probability Flow ODE, predictor-corrector sampling architectures, and flexible controllable generation.
1. The Core Formulation: Forward and Reverse-Time SDEs
Traditional diffusion models define a discrete Markov chain over distinct time steps . In the continuous limit as and the step size , the forward corruption process evolves according to an Itô Stochastic Differential Equation:
In this equation:
- represents the continuous state vector indexed by continuous time .
- is the drift coefficient, governing deterministic state shifts over time.
- is the diffusion coefficient, modulating the scale of injected stochastic noise.
- denotes standard Brownian motion (a Wiener process), with infinitesimal increment .
As evolves from to , the data distribution is smoothly transformed into a tractable prior distribution , typically an isotropic standard Gaussian distribution or .

The Reverse-Time SDE
To generate new samples, one must reverse the continuous diffusion process from back to . Using classical results in stochastic calculus established by Brian D. O. Anderson (1982)90051-5), the reverse of an Itô diffusion process is itself an Itô diffusion running backward in time:
Here, represents an infinitesimal negative time increment (marching backward from to ), denotes a reverse-time standard Brownian motion, and is the score function: the spatial gradient of the log-probability density of the marginal distribution at time .
The critical insight of score-based modeling is that the drift and diffusion are predetermined analytical design choices. The only unknown quantity required to simulate the reverse process is the time-dependent score function .
2. Unifying DDPM and SMLD in Continuous Time
The continuous SDE framework demonstrates that discrete diffusion algorithms are simply specific parameterizations of drift and diffusion coefficients:
Variance Exploding (VE) SDE (Continuous SMLD)
Score Matching with Langevin Dynamics (SMLD / NCSN) perturbs data with a sequence of growing Gaussian noise variances . In continuous time, this corresponds to a process where the drift is zero and the variance grows monotonically:
The resulting VE-SDE is:
The perturbation kernel from to is Gaussian:
Because the state variance diverges as , this formulation is termed Variance Exploding.
Variance Preserving (VP) SDE (Continuous DDPM)
Denoising Diffusion Probabilistic Models (DDPM) scale down the input vector at each step while adding scaled noise to keep the total variance bounded:
Taking the continuous limit where , the drift and diffusion become:
The resulting VP-SDE is:
The transition kernel satisfies:
If the initial data variance is normalized to 1, the total variance remains exactly 1 across all , hence Variance Preserving.
Sub-VP SDE
Song et al. introduced the sub-VP SDE, which modifies the diffusion coefficient:
This ensures that the variance at any intermediate time is strictly upper-bounded by the VP-SDE variance, yielding empirically superior negative log-likelihood (NLL) bounds.
3. Training the Score Network via Denoising Score Matching
Direct computation of is impossible because the true marginal data density is intractable.
However, by extending Vincent's (2011) denoising score matching to continuous time, we train a neural network to approximate the score of the tractable transition kernel .
The continuous denoising score matching loss objective is:
where is a positive weighting function, typically chosen as $\lambda(t) \propto \frac{1}{\mathbb{E}\left[\|\nabla_{x(t)} \log p_{0t}(x(t) \mid x(0))\|_2^2\right]}$ to balance loss magnitudes across different noise scales.
Equivalence to Noise Prediction
Because is Gaussian with mean and variance , its ground-truth score has a simple analytical form:
where is the standard Gaussian noise vector used to generate .
Thus, predicting the score function is mathematically equivalent to predicting the injected noise , establishing an exact identity between score matching and DDPM objective formulations.
4. The Probability Flow ODE and Exact Likelihoods
Every Itô SDE of the form possesses an associated deterministic Ordinary Differential Equation (ODE), termed the Probability Flow ODE:
The Probability Flow ODE shares the exact same marginal probability densities as the stochastic SDE for all .
+-------------------------------------------------------------+
| Forward SDE |
| dx = f(x, t)dt + g(t)dw (adds noise) |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| Learned Score Function |
| s_theta(x, t) ~= grad_x log p_t(x) |
+------------------------------+------------------------------+
|
+---------------+---------------+
| |
v v
+-----------------------------+ +-----------------------------+
| Reverse-Time SDE | | Probability Flow ODE |
| dx = [f - g^2 s_theta]dt | | dx/dt = f - 0.5 g^2 s_theta |
| + g d_w_bar | | |
| (Stochastic generation) | | (Deterministic trajectory) |
+-----------------------------+ +-----------------------------+
|
+---------------+---------------+
| |
v v
+-----------------------------+ +-------------+
| Continuous Normalizing Flow | | Fast ODE |
| Exact Log-Likelihood | | Solvers |
| Hutchinson Trace Estimator | | (Dopri5/RK4)|
+-----------------------------+ +-------------+Exact Log-Likelihood via Continuous Normalizing Flows
Because the Probability Flow ODE defines a deterministic, invertible mapping between data space and latent space , it can be treated as a Continuous Normalizing Flow (CNF).
Using the instantaneous change of variables formula, the exact log-likelihood of any data point can be computed by integrating the divergence of the drift field over time:
where .
The divergence involves computing the trace of the Jacobian matrix , which is computed efficiently using the Skilling-Hutchinson trace estimator:
This requires only a single vector-Jacobian product (VJP) per step via automatic differentiation, turning score models into exact density estimators without partition function intractability.
5. Sampling Architectures: Predictor-Corrector Framework
The continuous framework allows decoupling model training from the choice of numerical solvers. During inference, one can use standard high-order numerical ODE solvers (such as Dormand-Prince / Dopri5 or Runge-Kutta 4) or hybrid Predictor-Corrector (PC) samplers.
A Predictor-Corrector sampler alternates between two complementary operations at each discrete time step :
- Predictor Step: Uses a numerical SDE solver (such as Euler-Maruyama or Reverse Diffusion) to advance the state from to , predicting the coarse evolution of the sample.
- Corrector Step: Runs several steps of score-based Markov Chain Monte Carlo (MCMC), such as annealed Langevin dynamics, at fixed time :
The corrector step acts as an error-correction mechanism, pulling the trajectory back toward the high-density regions of the intermediate marginal distribution whenever numerical discretization error accumulates.
import torch
def euler_maruyama_predictor_step(x, t, dt, f_fn, g_fn, score_fn):
"""Executes a single reverse-time Euler-Maruyama SDE step."""
drift = f_fn(x, t) - (g_fn(t) ** 2) * score_fn(x, t)
diffusion = g_fn(t)
z = torch.randn_like(x) if t > 0 else torch.zeros_like(x)
# Note: dt is negative when stepping backwards from T to 0
x_prev = x + drift * dt + diffusion * torch.sqrt(torch.abs(dt)) * z
return x_prev
def langevin_corrector_step(x, t, score_fn, r=0.16, snr=0.16):
"""Executes a single Langevin dynamics corrector step at fixed time t."""
grad = score_fn(x, t)
noise = torch.randn_like(x)
# Calculate step size based on Signal-to-Noise Ratio (SNR)
grad_norm = torch.norm(grad.reshape(grad.shape[0], -1), dim=-1).mean()
noise_norm = torch.norm(noise.reshape(noise.shape[0], -1), dim=-1).mean()
step_size = 2 * (snr * noise_norm / grad_norm) ** 2
x = x + step_size * grad + torch.sqrt(2 * step_size) * noise
return x6. Structural Trade-Offs and Architectural Impact
The transition to continuous score SDEs reshaped generative modeling research across several axes:
| Feature | Discrete Diffusion (DDPM / SMLD) | Continuous Score SDEs | | :--- | :--- | :--- | | Time Representation | Discrete index | Continuous variable | | Sampling Mechanism | Fixed step-by-step Markov reverse chain | Flexible SDE, ODE, or Predictor-Corrector solvers | | Sample Trajectory | Purely stochastic | Choice between stochastic (SDE) and deterministic (ODE) | | Likelihood Evaluation | Variational Lower Bound (ELBO) | Exact log-likelihood via Probability Flow ODE | | Latent Inversion | Approximate or heuristic (DDIM) | Exact bidirectional encoding via ODE flow | | Step-Count Flexibility | Requires fixed retraining or resampling schedule | Arbitrary number of function evaluations (NFEs) at inference |
Descendants and Modern Offshoots
The mathematical rigor established by continuous score SDEs provided the direct theoretical foundation for several subsequent breakthroughs:
- Flow Matching and Continuous Normalizing Flows: Lipman et al. (2022) generalized score SDEs by formulating generative modeling as regressing arbitrary continuous velocity vector fields along optimal transport paths, removing the restriction to isotropic Gaussian diffusion.
- Consistency Models: Song et al. (2023) used the trajectories of the Probability Flow ODE to enforce a self-consistency mapping from any point on the ODE path directly to its origin , enabling single-step and few-step generation.
- Diffusion Transformers (DiT): Peebles and Xie (2022) scaled the underlying score network from standard U-Nets to vision transformers, operating on tokenized patch representations conditioned on continuous time embeddings .
By recasting diffusion from discrete heuristic noise steps into continuous stochastic calculus, score-based SDEs established a unified theoretical foundation that continues to govern modern generative architectures.
Sources
- Score-Based Generative Modeling through Stochastic Differential Equations (Song et al., ICLR 2021)
- Reverse-Time Diffusion Equation Models (Anderson, Stochastic Processes and their Applications, 1982)90051-5)
- Generative Modeling by Estimating Gradients of the Data Distribution (Song & Ermon, NeurIPS 2019)
- Denoising Diffusion Probabilistic Models (Ho et al., NeurIPS 2020)
- A Connection Between Score Matching and Denoising Autoencoders (Vincent, Neural Computation, 2011)
- Flow Matching for Generative Modeling (Lipman et al., ICLR 2023)
- Consistency Models (Song et al., ICML 2023)



