While deterministic samplers like DDIM and the higher-order ODE solvers discussed previously offer significant speed improvements by removing the stochastic element inherent in the original DDPM formulation, there are scenarios where reintroducing noise can be beneficial. Stochastic sampling variants embrace the randomness of the diffusion process, often aligning more closely with the underlying theory and sometimes offering advantages in sample diversity and quality, albeit typically requiring more sampling steps than highly optimized deterministic methods.
Recall that the reverse process in DDPM involves predicting the noise added at a timestep t and then sampling xt−1 from a Gaussian distribution centered around a function of xt and the predicted noise, using a learned or fixed variance σt2. This explicit sampling step introduces randomness.
xt−1∼N(μθ(xt,t),σt2I)Deterministic samplers effectively set σt=0 (as in DDIM with η=0) or approximate the process using an Ordinary Differential Equation (ODE) formulation, which describes the expected path of a sample as noise is removed. Stochastic samplers, in contrast, retain a noise term, aiming to solve the corresponding Stochastic Differential Equation (SDE).
The reverse-time SDE often takes a general form like:
dx=f(x,t)dt+g(t)dwˉHere, dx represents the change in the sample x over an infinitesimal time step dt. The f(x,t)dt term is the drift, guiding the sample towards lower noise levels (this is what ODE solvers approximate). The g(t)dwˉ term is the diffusion or stochastic term, where g(t) scales the noise and dwˉ represents infinitesimal random noise (from a Wiener process). Stochastic samplers incorporate approximations of this g(t)dwˉ term.
DDPM Ancestral Sampler: The original DDPM sampler is inherently stochastic. It directly implements the Markov chain definition of the reverse process, using the model's predicted mean μθ(xt,t) and a variance schedule σt2 (either fixed, like βt, or learned) to draw xt−1. While foundational, it typically requires many steps (e.g., 1000) for high-quality generation.
SDE Solvers (e.g., Euler-Maruyama): These are numerical methods designed to solve SDEs. The Euler-Maruyama method is a straightforward extension of the Euler method for ODEs. An update step looks roughly like:
xt−Δt≈xt+f(xt,t)Δt+g(t)Δtztwhere zt∼N(0,I) is standard Gaussian noise. This explicitly adds scaled noise at each step, guided by the SDE formulation. While simple, it might require small Δt (many steps) for stability and accuracy.
Predictor-Corrector Methods: Samplers inspired by Score-SDE often employ a two-stage process within each time step:
Stochastic Variants of Deterministic Solvers: Some methods add noise injection steps to otherwise deterministic solvers (like DDIM with η>0). This provides a knob to control the degree of stochasticity, balancing speed and diversity. For example, SDEdit uses a deterministic ODE solver for most of the reverse process but introduces significant noise at an intermediate timestep tedit before continuing the solve, effectively perturbing the sampling path to increase diversity or perform editing tasks.
Choosing between stochastic and deterministic samplers involves trade-offs:
Starting from the same initial noise at time T, a deterministic sampler follows a single path to the final sample. Stochastic samplers introduce randomness at intermediate steps, leading to different potential paths and final outcomes.
When using stochastic samplers:
g(t)
): The magnitude of the injected noise throughout the process is significant. It often follows a schedule related to the original diffusion process noise levels. Incorrect scaling can harm sample quality.In summary, stochastic sampling variants provide an alternative approach to generation that embraces randomness. While often slower than state-of-the-art deterministic solvers, they offer benefits in terms of sample diversity and closer alignment with the underlying SDE theory, adding another set of tools for controlling and optimizing the diffusion model generation process.
© 2025 ApX Machine Learning