U1.4 16 min read Oct 2026

U1.4 From Discrete Steps to Forward and Reverse Dynamics

Builds on6 notes

Reversing one frame does not yet give fast playback

Our reverse Gaussian generates one state per network call. A thousand forward levels originally meant a thousand sequential reverse calls. Can we accelerate generation?

How can we change the playback speed while preserving the desired distributions?

Recall DDPM’s sampling update [1]:

xt−1=μ~t(xt, x^θ(xt,t))+β~t z,z∼N(0,I).x_{t-1}=\tilde\mu_t\big(x_t,\ \hat x_\theta(x_t,t)\big)+\sqrt{\tilde\beta_t}\,z, \qquad z\sim\mathcal N(0,I).

The true reverse conditional is generally a mixture over possible clean origins, rather than a single Gaussian.

DiscussionQ1

Why not replace t−1t-1 with a much earlier ss and sample a Gaussian centered using the predicted clean image?

The true large-step reverse law is

q(xs∣xt)=∫q(xs∣xt,x0) p(x0∣xt) dx0,q(x_s\mid x_t) =\int q(x_s\mid x_t,x_0)\,p(x_0\mid x_t)\,\mathrm dx_0,

a mixture of conditional Gaussians over possible clean origins.

Suppose a blurry observation could come from a clean point on either side. For a small reverse step, the branch centers remain close. A larger step separates them. Substituting their mean preserves the center but may discard substantial variance.

How much uncertainty does the single-Gaussian approximation omit?

Show the reasoning

Take two equally likely origins −a-a and +a+a. If the reverse mean’s clean-data coefficient is ct,sc_{t,s}, their branch centers differ from the mean by ±ct,sa\pm c_{t,s}a, giving variance

(−ct,sa)2+(ct,sa)22=ct,s2a2.\frac{(-c_{t,s}a)^2+(c_{t,s}a)^2}{2}=c_{t,s}^2a^2.

The omitted variance grows quadratically with the clean-data coefficient, which can become substantial over a large jump.

More generally, the conditional mean is affine in x0x_0. Let its coefficient be ct,sc_{t,s} and its within-branch covariance be β~t→sI\tilde\beta_{t\to s}I. Total variance gives

E[xs∣xt]=μ~t→s(xt,E[x0∣xt]),Var⁡[xs∣xt]=β~t→sI+ct,s2Var⁡[x0∣xt].\mathbb E[x_s\mid x_t] =\tilde\mu_{t\to s}\big(x_t,\mathbb E[x_0\mid x_t]\big), \qquad \operatorname{Var}[x_s\mid x_t] =\tilde\beta_{t\to s}I +c_{t,s}^2\operatorname{Var}[x_0\mid x_t].

Substituting the clean conditional mean gets the center right. The variance contains both within-branch spread and spread between branch means. The plug-in Gaussian omits the latter.

Away from singular boundary regimes, an adjacent-step coefficient is O(βt)O(\beta_t), so the omitted term is higher order. Large jumps can separate modes substantially, making one Gaussian a poor representation.

A correct mean does not capture separated reverse branches. Large steps can make the omitted variance substantial.

Acceleration therefore requires more than enlarging an adjacent update. What part of the construction did training leave unspecified?

Did the denoiser ever observe how the whole Markov chain was connected?

Did training observe complete trajectories?

Write the simple denoising objective again:

Lsimple=Ex0,t,ϵ[∥ϵθ(xt,t)−ϵ∥2],xt=αˉtx0+1−αˉt ϵ.\mathcal L_{\text{simple}} =\mathbb E_{x_0,t,\epsilon} \left[\left\|\epsilon_\theta(x_t,t)-\epsilon\right\|^2\right], \qquad x_t=\sqrt{\bar\alpha_t}x_0+\sqrt{1-\bar\alpha_t}\,\epsilon.

Each example samples one clean image, one time, and one noise. Intermediate states are never calculated. Training observes noisy snapshots:

q(xt∣x0)=N ⁣(αˉtx0,(1−αˉt)I),q(x_t\mid x_0)=\mathcal N\!\left(\sqrt{\bar\alpha_t}x_0,(1-\bar\alpha_t)I\right),

It does not observe a whole path from the forward joint.

Aerial photographs of a dispersing crowd at several times show how many people occupy each street, without identifying the same person across photographs. Many cross-time assignments could fit the same snapshots.

Keep the snapshots, but redefine their cross-time pairing.

Preserve snapshots while redrawing their connections

During generation we only know xtx_t. The reverse law we want to model has the form

qλ(xs∣xt)=∫qλ(xs∣xt,x0) p(x0∣xt) dx0,q_\lambda(x_s\mid x_t) =\int q_\lambda(x_s\mid x_t,x_0)\,p(x_0\mid x_t)\,\mathrm dx_0,

The denoiser already estimates the clean posterior mean. To construct a new connection, first ask the easier question: if both xtx_t and x0x_0 were known, how could we generate xsx_s?

Different choices of qλ(xs∣xt,x0)q_\lambda(x_s\mid x_t,x_0) define different pairings.

These pairings must preserve the required noisy marginals.

The clean-data law is fixed, and

ps(xs)=∫q(xs∣x0) pdata(x0) dx0,p_s(x_s) =\int q(x_s\mid x_0)\,p_{\text{data}}(x_0)\,\mathrm dx_0,

so preserving q(xs∣x0)q(x_s\mid x_0) suffices. Integrating out xtx_t must recover

∫qλ(xs∣xt,x0) q(xt∣x0) dxt=q(xs∣x0).\int q_\lambda(x_s\mid x_t,x_0)\,q(x_t\mid x_0)\,\mathrm dx_t =q(x_s\mid x_0).

We need a directly sampleable conditional satisfying that constraint.

Given the origin and present state, recover a reusable Gaussian marker:

ϵt:=xt−αˉtx01−αˉt.\epsilon_t:=\frac{x_t-\sqrt{\bar\alpha_t}x_0}{\sqrt{1-\bar\alpha_t}}.

Here ϵt\epsilon_t denotes the accumulated standardized residual at time tt, not the individual transition noise from the earlier DDPM notation. Its conditional law given x0x_0 is standard Gaussian.

To preserve noise variance at ss, reuse part of this marker and fill the remaining variance with fresh independent Gaussian noise.

Choose 0≤λt,s2≤1−αˉs0\leq\lambda_{t,s}^2\leq1-\bar\alpha_s, draw independent z∼N(0,I)z\sim\mathcal N(0,I), and define

xs=αˉsx0+1−αˉs−λt,s2 ϵt+λt,sz.x_s =\sqrt{\bar\alpha_s}x_0 +\sqrt{1-\bar\alpha_s-\lambda_{t,s}^2}\,\epsilon_t +\lambda_{t,s}z.

The second term reuses the residual and the third adds new randomness. This changes the coupling; the original Markov chain does not generally share the same residual across times.

Independence makes the total noise variance

(1−αˉs−λt,s2)I+λt,s2I=(1−αˉs)I.\big(1-\bar\alpha_s-\lambda_{t,s}^2\big)I +\lambda_{t,s}^2I =(1-\bar\alpha_s)I.

The mean and variance therefore recover the original conditional marginal:

qλ(xs∣x0)=N ⁣(αˉsx0,(1−αˉs)I).q_\lambda(x_s\mid x_0) =\mathcal N\!\left(\sqrt{\bar\alpha_s}x_0,(1-\bar\alpha_s)I\right).

Given both x0x_0 and xtx_t, only the newly drawn zz remains random, so

qλ(xs∣xt,x0)=N ⁣(αˉsx0+1−αˉs−λt,s2 xt−αˉtx01−αˉt, λt,s2I).q_\lambda(x_s\mid x_t,x_0) =\mathcal N\!\left( \sqrt{\bar\alpha_s}x_0 +\sqrt{1-\bar\alpha_s-\lambda_{t,s}^2}\, \frac{x_t-\sqrt{\bar\alpha_t}x_0}{\sqrt{1-\bar\alpha_t}}, \ \lambda_{t,s}^2I \right).

The new forward/inference joint is generally non-Markovian, because this conditional still depends directly on x0x_0. This does not mean the reverse network needs the entire sampling history.

SupplementWhy can we reuse the denoiser?

Substitute the clean-data identity into the conditional mean and define

ct,s:=1−αˉs−λt,s2−αˉsαˉt1−αˉt.c_{t,s} :=\sqrt{1-\bar\alpha_s-\lambda_{t,s}^2} -\sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}\sqrt{1-\bar\alpha_t}.

The target conditional and reverse model then take the forms

qλ(xs∣xt,x0)=N ⁣(αˉsαˉtxt+ct,sϵt,λt,s2I),pθ(xs∣xt):=N ⁣(αˉsαˉtxt+ct,sϵθ(xt,t),λt,s2I).\begin{aligned} q_\lambda(x_s\mid x_t,x_0) &=\mathcal N\!\left( \sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}x_t +c_{t,s}\epsilon_t, \lambda_{t,s}^2I \right),\\ p_\theta(x_s\mid x_t) &:=\mathcal N\!\left( \sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}x_t +c_{t,s}\epsilon_\theta(x_t,t), \lambda_{t,s}^2I \right). \end{aligned}

The new variational objective again decomposes into transition KL terms, plus boundary terms:

Jλ(θ)=∑t→sE ⁣[DKL ⁣(qλ(xs∣xt,x0) ∥ pθ(xs∣xt))]+C.J_\lambda(\theta) =\sum_{t\to s}\mathbb E\!\left[ D_{\mathrm{KL}}\!\left( q_\lambda(x_s\mid x_t,x_0) \,\|\, p_\theta(x_s\mid x_t) \right) \right]+C.

Their Gaussian covariances agree; their means differ only through the true versus predicted noise. Hence

DKL=ct,s22λt,s2∥ϵt−ϵθ(xt,t)∥2=γt,s∥ϵt−ϵθ(xt,t)∥2.D_{\mathrm{KL}} =\frac{c_{t,s}^2}{2\lambda_{t,s}^2} \left\|\epsilon_t-\epsilon_\theta(x_t,t)\right\|^2 =\gamma_{t,s}\left\|\epsilon_t-\epsilon_\theta(x_t,t)\right\|^2.

The schedule-dependent coefficient is positive, giving

Jλ(θ)=Lγ(θ)+C.J_\lambda(\theta)=\mathcal L_\gamma(\theta)+C.

Thus these variational objectives reduce to weighted denoising MSE. The ordinary Gaussian-KL derivation assumes positive λt,s\lambda_{t,s}; deterministic sampling is considered as a limit.

Positive time weights leave the ideal fixed-time predictor unchanged.

Training determines an optimal denoiser for each snapshot without uniquely determining the cross-time joint. The same denoiser can therefore be reused, although finite-step plug-in sampling is still approximate.

Follow the new connections backward

Generation cannot inspect x0x_0. Instead use the denoiser’s prediction

ϵ^t:=ϵθ(xt,t)≈E[ϵt∣xt]=−1−αˉt ∇log⁡pt(xt).\hat\epsilon_t:=\epsilon_\theta(x_t,t) \approx\mathbb E[\epsilon_t\mid x_t] =-\sqrt{1-\bar\alpha_t}\,\nabla\log p_t(x_t).

Substitute the clean-data identity and replace hidden noise by its prediction:

xs=αˉsαˉtxt+(1−αˉs−λt,s2−αˉsαˉt1−αˉt)ϵ^t+λt,sz,z∼N(0,I).x_s =\sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}x_t +\left( \sqrt{1-\bar\alpha_s-\lambda_{t,s}^2} -\sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}\sqrt{1-\bar\alpha_t} \right)\hat\epsilon_t +\lambda_{t,s}z, \qquad z\sim\mathcal N(0,I).

The update now needs only the current state, its predicted noise, and optional fresh noise.

To check that this includes DDPM, set s=t−1s=t-1 and choose

λt,t−12=β~t=1−αˉt−11−αˉt βt.\lambda_{t,t-1}^2=\tilde\beta_t =\frac{1-\bar\alpha_{t-1}}{1-\bar\alpha_t}\,\beta_t.

Using the schedule identities, the coefficients simplify to

αˉt−1αˉt=1αt,1−αˉt−1−β~t−1−αˉtαt=−βtαt1−αˉt.\begin{aligned} \sqrt{\frac{\bar\alpha_{t-1}}{\bar\alpha_t}} &=\frac{1}{\sqrt{\alpha_t}},\\[2pt] \sqrt{1-\bar\alpha_{t-1}-\tilde\beta_t} -\frac{\sqrt{1-\bar\alpha_t}}{\sqrt{\alpha_t}} &=-\frac{\beta_t}{\sqrt{\alpha_t}\sqrt{1-\bar\alpha_t}}. \end{aligned}

and the update becomes

xt−1=1αt(xt−βt1−αˉt ϵ^t)+β~t z,x_{t-1} =\frac{1}{\sqrt{\alpha_t}} \left( x_t-\frac{\beta_t}{\sqrt{1-\bar\alpha_t}}\,\hat\epsilon_t \right) +\sqrt{\tilde\beta_t}\,z,

the familiar DDPM update. Preserving marginals does not require choosing only that coupling.

Setting λt,s=0\lambda_{t,s}=0 instead gives

xs=αˉsαˉtxt+(1−αˉs−αˉsαˉt1−αˉt)ϵ^t.x_s =\sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}x_t +\left( \sqrt{1-\bar\alpha_s} -\sqrt{\frac{\bar\alpha_s}{\bar\alpha_t}}\sqrt{1-\bar\alpha_t} \right)\hat\epsilon_t.

This is deterministic given the current state and score estimate. Infinitesimal steps lead to the ODE described below.

We are not asserting that DDPM’s hidden noise is identical at two times. We have defined a new joint. After reaching xsx_s, we evaluate the network again rather than retaining the first prediction forever.

Given the initial noise draw, the entire trajectory is now deterministic. Song, Meng, and Ermon [2] call this construction a Denoising Diffusion Implicit Model (DDIM).

We may choose a shorter timestep subsequence

0=τ0<τ1<⋯<τS=T,0=\tau_0<\tau_1<\cdots<\tau_S=T,

and generate along its reverse order.

NotationThe usual eta parametrization

The literature commonly writes

λt,s=η1−αˉs1−αˉt1−αˉtαˉs.\lambda_{t,s} =\eta\sqrt{\frac{1-\bar\alpha_s}{1-\bar\alpha_t}} \sqrt{1-\frac{\bar\alpha_t}{\bar\alpha_s}}.

η=0\eta=0 gives deterministic DDIM. With the full adjacent schedule, η=1\eta=1 recovers DDPM posterior variance. On a skipped schedule, it defines a stochastic shortened sampler rather than the original full chain.

Compare the two routes

Interactive demo. Both panels use the same exact mixture score and initial samples. Adjust η\eta and the number of steps. Removing fresh noise smooths trajectories; reducing steps reveals finite-step errors. Equal ideal marginals do not guarantee identical finite-step endpoints, and deterministic paths can still bend.

The exact-score setting removes neural estimation error. The lab adds learned scores to examine that separate source of error.

Move from a fixed grid to continuous time

DDIM can skip scheduled levels. To separate distribution evolution from the computational grid entirely, we turn to continuous dynamics.

Refine the timestep toward zero and identify the limiting rule.

Write corruption as continuous motion

Divide a unit time interval into TT pieces of width Δt=1/T\Delta t=1/T. Noise per step must shrink with the interval, so replace discrete βt\beta_t by β(t)Δt\beta(t)\Delta t.

The forward transition becomes

xt+Δt=1−β(t)Δt xt+β(t)Δt ξt,ξt∼N(0,I),x_{t+\Delta t} =\sqrt{1-\beta(t)\Delta t}\,x_t +\sqrt{\beta(t)\Delta t}\,\xi_t, \qquad \xi_t\sim\mathcal N(0,I),

where ξt\xi_t is fresh Gaussian noise. For small Δt\Delta t,

1−β(t)Δt=1−12β(t)Δt+O(Δt2),\sqrt{1-\beta(t)\Delta t} =1-\tfrac12\beta(t)\Delta t+O(\Delta t^2),

subtracting the current state gives

xt+Δt−xt=−12β(t)xt Δt+β(t)(Δt ξt)+O(Δt2).x_{t+\Delta t}-x_t =-\tfrac12\beta(t)x_t\,\Delta t +\sqrt{\beta(t)}\big(\sqrt{\Delta t}\,\xi_t\big) +O(\Delta t^2).

The noise scales as Δt\sqrt{\Delta t} because independent variances add. After 1/Δt1/\Delta t steps, total variance remains order one. Scaling noise by Δt\Delta t would make its accumulated variance vanish.

Define

ΔWt:=Δt ξt,ΔWt∼N(0,Δt I).\Delta W_t:=\sqrt{\Delta t}\,\xi_t, \qquad \Delta W_t\sim\mathcal N(0,\Delta t\,I).

a Brownian increment. Passing to the continuous limit gives

dx=−12β(t) x dt+β(t) dWt,t:0→1.dx=-\tfrac12\beta(t)\,x\,dt+\sqrt{\beta(t)}\,dW_t,\qquad t:0\to1 .

The drift shrinks toward the origin and the diffusion injects Gaussian noise, retaining the same forward construction without a fixed grid.

Drift describes systematic motion; diffusion describes injected randomness. For VP,

ft=−12β(t),gt=β(t).f_t=-\tfrac12\beta(t),\qquad g_t=\sqrt{\beta(t)}.

The score alone does not determine reverse dynamics. It gives a local log-density gradient, while the forward noise intensity determines how strongly that information enters the reverse rule.

How does the score reverse time?

Under suitable regularity, Anderson [3] gives a reverse-time SDE with a score correction:

dx=[−12β(t) x−β(t) ∇log⁡pt(x)]dt+β(t) dWˉt,t:1→0.dx=\Big[-\tfrac12\beta(t)\,x-\beta(t)\,\nabla\log p_t(x)\Big]dt+\sqrt{\beta(t)}\,d\bar W_t,\qquad t:1\to0 .

The forward drift and noise scale combine with the learned score. Here time runs backward, so the sign of dtdt must be interpreted accordingly.

Song and colleagues [4] give a deterministic ODE with the same single-time marginals under exact scores and suitable regularity:

dxdt=−12β(t) x−12β(t) ∇log⁡pt(x)(probability-flow ODE).\frac{dx}{dt}=-\tfrac12\beta(t)\,x-\tfrac12\beta(t)\,\nabla\log p_t(x) \qquad\text{(probability-flow ODE)} .

The score coefficient in the ODE is half the reverse-SDE coefficient.

NotationThe general forward and reverse equations

The equations above substitute the VP schedule. More generally, for a linear forward drift,

dx=ft x dt+gt dWt,dx=f_t\,x\,dt+g_t\,dW_t ,

the reverse SDE and probability-flow ODE are

dyt=[ft yt−gt2 sθ(yt,t)]dt+gt dWˉt,dytdt=ft yt−12 gt2 sθ(yt,t)(PF-ODE).\begin{aligned} dy_t&=\big[f_t\,y_t-g_t^2\,s_\theta(y_t,t)\big]dt+g_t\,d\bar W_t ,\\[2pt] \frac{dy_t}{dt}&=f_t\,y_t-\tfrac12\,g_t^2\,s_\theta(y_t,t)\qquad\text{(PF-ODE)} . \end{aligned}

yty_t denotes the process followed backward, sθ=−ϵθ/σts_\theta=-\epsilon_\theta/\sigma_t is the learned score, and Wˉ\bar W is reverse-time Brownian motion. A general nonlinear drift can be written f(x,t)f(x,t); here ftxf_t x suffices.

For VP, ft=−β(t)/2f_t=-\beta(t)/2 and gt2=β(t)g_t^2=\beta(t). Other forward processes change these coefficients while retaining the structure. U2.4 develops a common interpolation framework.

SupplementWhere did half the score correction go?

In the Fokker–Planck equation (M3.2), diffusion can be rewritten as a divergence:

12β Δpt=∇⋅(12β pt ∇log⁡pt),\tfrac12\beta\,\Delta p_t=\nabla\cdot\Big(\tfrac12\beta\,p_t\,\nabla\log p_t\Big),

This lets us represent diffusion through a score-dependent drift. Removing stochastic diffusion while adjusting drift preserves density evolution.

Substitution combines the terms into

∂tpt+∇⋅(pt ut)=0,ut(x)=−12β(t) x−12β(t) ∇log⁡pt(x).\partial_t p_t+\nabla\cdot\big(p_t\,u_t\big)=0,\qquad u_t(x)=-\tfrac12\beta(t)\,x-\tfrac12\beta(t)\,\nabla\log p_t(x) .

The velocity utu_t is the probability-flow ODE field. This is a continuity equation: density changes through incoming and outgoing mass flux ptutp_tu_t.

The equal marginals follow from the same density-evolution equation, rather than identical sample paths. U2.1 uses this logic to construct a velocity for a prescribed path.

U2.4 extends this exchange into a family of stochastic samplers.

Compare the three constructions:

Forward SDEReverse SDEPF-ODE
Directionp0→pTp_0\to p_TpT→p0p_T\to p_0pT→p0p_T\to p_0
Marginalsptp_tSame path, reversedSame path, reversed
Individual trajectoryRandomRandomDeterministic given its start
Discrete connectionForward corruptionDDPMDeterministic DDIM

Stochastic reverse-SDE paths and smooth probability-flow ODE paths with matching marginal density evolution.

Figure: equal marginals, different paths. Equality concerns the population distribution, not whether a particular initial point reaches the same endpoint.

In the VP continuous limit, DDPM connects to the reverse SDE and deterministic DDIM to the PF-ODE. Exact numerical forms depend on coordinates. The network supplies the score, dynamics specify motion, and the numerical method approximates it on a grid.

A sampler combines dynamics and a numerical method

Choose reverse dynamics, then a timestep grid and solver. The number of computational steps is a numerical choice.

Keep two errors separate: Gaussian approximation of a mixture reverse kernel, and numerical discretization of continuous dynamics. They have different definitions even when larger steps worsen both.

Equal continuous-time marginals do not imply equal finite-step quality. Euler freezes velocity within a step; SDE solvers also approximate drift and stochastic effects. The balance between score error and numerical error determines the practical comparison.

Gaussian corruption, a Gaussian prior, and a schedule are design choices. U2.0 asks how to construct paths with more freedom.

Check your understanding

Check your understanding

Why does the PF-ODE use half the reverse-SDE score coefficient?

Check your understanding

Why is a large plug-in reverse Gaussian problematic?

Check your understanding

What is non-Markovian about DDIM?

References

  1. Ho, J., Jain, A., Abbeel, P. Denoising Diffusion Probabilistic Models. NeurIPS 2020.
  2. Song, J., Meng, C., Ermon, S. Denoising Diffusion Implicit Models. ICLR 2021.
  3. Anderson, B. D. O. Reverse-time diffusion equation models. 1982.
  4. Song, Y., et al. Score-Based Generative Modeling through Stochastic Differential Equations. ICLR 2021.
  5. Lai, C.-H., et al. The Principles of Diffusion Models. 2025, Section 4.1.