Inferensys

Glossary

Stochastic Differential Equation (SDE)

A mathematical equation that describes a system evolving over time with both deterministic drift and random noise, forming the continuous-time foundation for diffusion-based generative models.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
DIFFUSION MODELS

What is a Stochastic Differential Equation (SDE)?

A mathematical framework for modeling continuous-time stochastic processes, central to the theory of score-based and diffusion generative models.

A Stochastic Differential Equation (SDE) is a differential equation in which one or more terms is a stochastic process, resulting in a solution that is also a stochastic process. In diffusion models, an SDE provides a continuous-time framework that generalizes the discrete forward and reverse processes, describing the data corruption as a gradual drift and diffusion of noise. The forward SDE transforms data into pure noise, while the reverse-time SDE defines the generative denoising path.

The SDE framework unifies Denoising Diffusion Probabilistic Models (DDPMs) and score-based generative models under a single theory. The drift coefficient dictates the deterministic component of the transformation, while the diffusion coefficient scales the stochastic Wiener process (Brownian motion). Training involves learning a score network to approximate the gradient of the log data density, enabling the numerical simulation of the reverse SDE for sample generation via methods like Euler-Maruyama discretization.

MATHEMATICAL FRAMEWORK

Key Components of an SDE in Diffusion

A Stochastic Differential Equation (SDE) provides a continuous-time framework for diffusion models, describing the data corruption (forward) and generation (reverse) processes as trajectories influenced by both deterministic drift and random noise.

01

Drift Coefficient

The drift coefficient, often denoted as f(x_t, t), is the deterministic component of the SDE. It defines the predictable, average direction of change for the data variable x_t over an infinitesimal time step.

  • In the forward process, the drift is typically designed to push the data towards zero or a prior distribution.
  • In the reverse process, the learned drift guides the denoising trajectory back towards the data manifold.
  • It is analogous to the mean of the transition kernel in discrete-time diffusion models.
02

Diffusion Coefficient

The diffusion coefficient, denoted as g(t), controls the magnitude of the stochastic (noise) term in the SDE. It is a scalar function of time that determines how much random noise is injected at each instant.

  • It governs the variance schedule of the corruption process.
  • A common choice is g(t) = √(dβ/dt), linking it to the noise schedule β(t) from discrete models.
  • In the variance-exploding SDE formulation, g(t) increases over time, while in the variance-preserving SDE, it is coupled with the drift to keep total variance constant.
03

Wiener Process (Brownian Motion)

The Wiener process, W_t (or dB_t), is the source of continuous random noise in the SDE. Its infinitesimal increments dW_t are normally distributed with mean zero and variance dt.

  • It provides the fundamental stochastic driver for the forward corruption: dx = f(x,t)dt + g(t)dW.
  • The reverse-time SDE, used for generation, involves a backward Wiener process and a correction term dependent on the score function.
  • This mathematical object formalizes the continuous addition of Gaussian noise, generalizing the discrete noise addition steps in models like DDPM.
04

Score Function

The score function, ∇_x log p_t(x), is the gradient of the log-probability of the data distribution at time t. It is the critical learned quantity that steers the reverse SDE.

  • The reverse-time SDE for generation is: dx = [f(x,t) - g(t)² ∇_x log p_t(x)] dt + g(t) dW̄.
  • The term -g(t)² ∇_x log p_t(x) is a drift correction that points towards regions of high data density.
  • A neural score network s_θ(x_t, t) is trained to approximate this function, typically via score matching or as a noise prediction network.
05

Probability Flow ODE

The Probability Flow Ordinary Differential Equation (ODE) is a deterministic counterpart to the reverse-time SDE that shares the same marginal probability distributions p_t(x) at every time t.

  • It is derived by removing the stochastic noise term from the reverse SDE: dx = [f(x,t) - ½ g(t)² ∇_x log p_t(x)] dt.
  • This ODE defines a deterministic sampling trajectory, enabling faster samplers and exact likelihood computation.
  • It connects diffusion models to continuous normalizing flows, where the learned score defines the flow's vector field.
06

Time Variable

The continuous time variable t ∈ [0, T] parameterizes the entire diffusion trajectory, replacing the discrete timestep index. Time flows from t=0 (data distribution) to t=T (approximate noise distribution).

  • The drift f(x,t) and diffusion g(t) coefficients are explicitly functions of time.
  • The score network s_θ(x_t, t) is conditioned on time, often via sinusoidal embeddings or learned embeddings.
  • The choice of T and the functional forms of f and g define the specific SDE formulation (e.g., Variance Preserving, Variance Exploding).
CONTINUOUS VS. DISCRETE MODELING

SDE vs. Discrete-Time Diffusion Frameworks

A comparison of the continuous-time Stochastic Differential Equation (SDE) framework and discrete-time diffusion models (e.g., DDPM) for data generation, highlighting foundational differences in formulation, sampling, and theoretical grounding.

Framework FeatureStochastic Differential Equation (SDE)Discrete-Time Diffusion (e.g., DDPM)

Mathematical Foundation

Continuous-time stochastic calculus; Itô or Stratonovich integrals.

Discrete-time Markov chain; fixed sequence of Gaussian transitions.

Forward Process Formulation

Defined by a drift and diffusion coefficient: dx = f(x,t)dt + g(t)dw.

Defined by a fixed noise schedule: x_t = √(ᾱ_t)x_0 + √(1-ᾱ_t)ε.

Time Variable

Continuous, t ∈ [0, T].

Discrete, indexed by timesteps k ∈ {0, 1, ..., K}.

Reverse Process Sampling

Solves a reverse-time SDE or its associated Probability Flow ODE.

Iteratively applies a learned denoising function x_{k-1} = μ_θ(x_k, k).

Sampling Flexibility

High; enables adaptive step solvers and trade-offs between stochastic (SDE) and deterministic (ODE) paths.

Lower; typically locked into the predefined number of timesteps K, though accelerated samplers (DDIM) exist.

Theoretical Connection

Directly linked to score-based generative modeling and continuous normalizing flows.

Derivable as a discretization of an underlying SDE under a specific noise schedule.

Primary Training Objective

Score matching (estimating ∇_x log p_t(x)).

Variational lower bound (ELBO) or simplified noise prediction loss.

Parameterization of Model

Score network s_θ(x, t) ≈ ∇_x log p_t(x).

Noise prediction network ε_θ(x_t, t) or mean prediction network μ_θ(x_t, t).

STOCHASTIC DIFFERENTIAL EQUATIONS

Frequently Asked Questions

A continuous-time framework for modeling the forward and reverse processes in diffusion models, where the data corruption and generation are described by differential equations with a stochastic (noise) component.

A Stochastic Differential Equation (SDE) is a mathematical framework that describes the evolution of a system over continuous time, where the dynamics are governed by both a deterministic drift component and a random diffusion component driven by a Wiener process (Brownian motion). In the context of diffusion models, SDEs provide a unified, continuous-time perspective for the forward noising process and the reverse generative process. The forward SDE gradually corrupts data into pure noise, while the corresponding reverse-time SDE describes how to denoise a sample back into data from the target distribution. This formulation generalizes discrete-time diffusion models and connects them to concepts in score-based generative modeling and probability flow ODEs.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.