Gaussian Probability Paths: Diffusion and Flow Matching VP, linear & cosine schedules · log-SNR clock · annealed Langevin ladder · conditional flow matching · target dictionary · loss floors
Why We Need a Continuum of Noise Levels
Motivation
High noise (\sigma \gg s) resolves global weights: When Gaussian blur fills the 10\text{--}12 nat valleys between modes, trajectories establish the true 0.5 / 0.3 / 0.2 mode proportions.
Low noise (\sigma \ll s) resolves local geometry: As \sigma \to 0, \nabla\log p_\sigma \to \nabla\log p, pulling points tightly into each mode center.
Unifying continuous path: Interpolate \mathbf{x}_t = \alpha_t\mathbf{x}_0 + \sigma_t\boldsymbol\epsilon across t \in [0, 1] and train one time-conditioned network across all scales.
Annealed Langevin Dynamics on Exact Scores
Proof of Concept Before Training
Before training any network, we test multi-scale annealing using the exact mixture scores \nabla \log p_{\tilde\sigma} down a geometric ladder of 10 noise levels \tilde\sigma_i \in [3.0, 0.05](100 steps per level, step size h_i = 0.1\tilde\sigma_i^2):
Single fine level (1{,}000 steps at \tilde\sigma = 0.05): Chains stay trapped in their initial modes, returning equal weights \approx [0.33, 0.33, 0.33].
Ten annealed levels (10 \times 100 steps): Coarse levels mix across smoothed valleys and fine levels sharpen each mode, recovering [0.50, 0.30, 0.20] within \pm 0.03 and \approx 1.5\% strays.
Why move from a ladder to a continuous path: Hand-tuning discrete levels \tilde\sigma_i and step sizes h_i in high dimensions is fragile; a continuous path t \in [0, 1] replaces the ladder with a smooth ODE or SDE.
While the variance-exploding (VE) path \tilde{\mathbf{x}}_t = \mathbf{x}_0 + \sigma_t\boldsymbol\epsilon lets input norms grow fiftyfold, modern schedules shrink the signal coefficient \alpha_t as noise \sigma_t grows so inputs stay O(1):
Variance-Preserving (VP / DDPM): Enforces \alpha_t^2 + \sigma_t^2 = 1 via a linear noise rate \beta(t) = 0.1 + 19.9t: \bar\alpha_t = \alpha_t^2 = \exp\!\Big(-\int_0^t \beta(r)\,dr\Big)
Linear path (Flow Matching / Rectified Flow): Joins \mathbf{x}_0 to \boldsymbol\epsilon by a straight line at constant speed across t \in [0, 1]: \alpha_t = 1 - t and \sigma_t = t.
Exact rescaling onto the linear path: Dividing \mathbf{x}_t = \alpha_t\mathbf{x}_0 + \sigma_t\boldsymbol\epsilon by \alpha_t + \sigma_t(c = 1/(\alpha_t + \sigma_t)) lands on the linear path at t_{\textrm{lin}} = \sigma_t/(\alpha_t + \sigma_t) with identical log-SNR \lambda_t.
Schedule = time reparameterization: All Gaussian paths traverse the exact same family of distributions indexed by \lambda \in (-\infty, +\infty), differing only in clock speed.
Comparing VP, Linear, and Cosine Clocks in Code
Schedule Pacing
Evaluating GaussianPath.vp() and GaussianPath.linear() at t \in \{0.1, 0.5, 0.9\} shows how differently they allocate time across log-SNR:
vp, linear = GaussianPath.vp(), GaussianPath.linear()t = torch.tensor([0.1, 0.5, 0.9])r2 =lambda v: [round(u, 2) for u in v.tolist()]for name, path in (('vp', vp), ('linear', linear)):print(f'{name:>6}: alpha {r2(path.alpha(t))} sigma {r2(path.sigma(t))} 'f'log-SNR {r2(path.log_snr(t))}')
Why Nichol & Dhariwal (2021) introduced the cosine schedule: The linear-\beta VP path crosses \lambda_t = 0 (equal signal and noise) at t \approx 0.26, spending 74\% of its time where noise dominates. The cosine path\alpha_t \approx \cos(\pi t / 2) spreads log-SNR decay much more evenly across [0, 1].
The DDPM Markov Chain Is the VP Path on a Grid
Discrete-Time Forward Process
Ho et al. (2020) defined DDPM as a T-step Markov chain that shrinks the state by \sqrt{1 - \beta_k} and injects independent Gaussian noise \sqrt{\beta_k}\,\boldsymbol\epsilon_k at each step k = 1, \ldots, T:
Closed-form k-step marginal: Because independent Gaussians add in variance, composing k steps telescopes into a single draw from \mathbf{x}_0 with \bar\alpha_k = \prod_{j=1}^k (1 - \beta_j): \mathbf{x}_k = \sqrt{\bar\alpha_k}\,\mathbf{x}_0 + \sqrt{1 - \bar\alpha_k}\,\boldsymbol\epsilon
Zero-chain training: Training never simulates k sequential steps—any \mathbf{x}_k is sampled in O(1) from (\mathbf{x}_0, \boldsymbol\epsilon).
Conditional velocity \dot{\mathbf{x}}_t = \dot\alpha_t\mathbf{x}_0 + \dot\sigma_t\boldsymbol\epsilon: Single-pair velocity (on the linear path: \boldsymbol\epsilon - \mathbf{x}_0); chords from different pairs cross throughout space.
Marginal velocity field \mathbf{u}_t(\mathbf{x}): Posterior-averaged velocity of all trajectories passing through (\mathbf{x}, t), defining a single-valued vector field that transports p_t.
Visualizing Conditional vs. Marginal Fields
Geometric Blueprint on the 2D Mixture
On our three-mode mixture, both the single-point conditional path p_t(\mathbf{x} \mid \mathbf{x}_0) and the full marginal velocity field \mathbf{u}_t(\mathbf{x}) can be plotted in closed form:
(a) Conditional path: Expanding circles of radius 2\sigma_t centered at \alpha_t\mathbf{x}_0 for a single data point \mathbf{x}_0.
(b) Marginal density p_t: As t goes from 0 to 1, the three sharp modes merge into a single unit Gaussian \mathcal{N}(\mathbf{0}, \mathbf{I}).
(c) Conditional field -(\mathbf{x} - \mathbf{x}_0)/t: Points straight toward that single training example \mathbf{x}_0.
(d) Marginal field -\mathbf{u}_t(\mathbf{x}): Averages over all possible clean points weighted by p(\mathbf{x}_0 \mid \mathbf{x}_t = \mathbf{x}), pointing smoothly into the three modes.
Conditional Flow Matching identity (Lipman et al., 2022): Conditioning on \mathbf{x}_t splits the loss into the marginal field error plus a \boldsymbol\theta-independent variance floor C.
Identical gradients: Because \nabla_{\boldsymbol\theta} C = \mathbf{0}, SGD on random pairs (\mathbf{x}_0, \boldsymbol\epsilon) has the exact same expected gradient as regressing onto the unknown oracle \mathbf{u}_t(\mathbf{x}_t).
Training a Velocity Network in Five Lines of Code
Implementation & Convergence
Training TimeMLP(256, 3) on the linear path draws fresh batches of 512 mixture points, uniform times t \sim U(0, 1), and noise \boldsymbol\epsilon \sim \mathcal{N}(\mathbf{0}, \mathbf{I}) for 40{,}000 Adam steps:
Per-example target: On the linear path, path.target('velocity', x0, eps, t) is simply eps - x0.
Sinusoidal time features:TimeMLP embeds t \in [0, 1] at geometric frequencies from 1 to 64\,\text{rad} so nearby noise levels remain distinct.
Why does the loss plateau near 4.9? The training curve drops rapidly and flattens far above zero—not because training stalled, but because of the irreducible variance floor C.
One posterior oracle, five coordinates: Because conditional expectation is linear, the posterior means \hat{\mathbf{x}}_0 = \mathbb{E}[\mathbf{x}_0 \mid \mathbf{x}_t] and \hat{\boldsymbol\epsilon} = \mathbb{E}[\boldsymbol\epsilon \mid \mathbf{x}_t] determine all five targets:
Takeaway: Flow-matching velocity networks and score-based diffusion models learn the exact same object in different coordinates.
Verifying the Target Dictionary at a Single Point
Cross-Path Translation in Code
At \mathbf{x} = (0.5, -0.5) on the VP path at t = 0.5(\alpha_t = 0.28, \sigma_t = 0.96), we query the exact mixture oracle for all five targets and translate the point onto the linear path:
x0 on vp: [0.29, -0.98]
eps on vp: [0.44, -0.23]
score on vp: [-0.46, 0.24]
v on vp: [-0.15, 0.88]
velocity on vp: [-0.22, 1.29]
velocity on linear at t = 0.773: [0.15, 0.75] eps_hat - x0_hat: [0.15, 0.75]
Practical Conditioning: Which Target Fits Which Path?
Numerical & Weighting Differences
Division-by-zero singularity at pure noise (\alpha_1 = 0): Noise prediction ('eps') reconstructs \hat{\mathbf{x}}_0 = (\mathbf{x}_t - \sigma_t\hat{\boldsymbol\epsilon})/\alpha_t, dividing by \alpha_t \to 0 on schedules reaching exact pure noise (so 'eps' requires VP with \alpha_1 \approx 0.007 > 0).
Well-conditioned velocity & \mathbf{v}-prediction: Linear velocity (\hat{\mathbf{x}}_0 = \mathbf{x}_t - t\hat{\mathbf{u}}) and cosine \mathbf{v}-prediction (\hat{\mathbf{x}}_0 = \alpha_t\mathbf{x}_t - \sigma_t\hat{\mathbf{v}}) reconstruct \hat{\mathbf{x}}_0 without dividing by \alpha_t.
DDPM’s Simple Loss vs. Score Matching Weighting
Historical Unification
Every milestone generative diffusion family corresponds to selecting one path, one target from the dictionary, and one time weighting:
Generative Model Family
Forward Path
Regression Target
Relationship to Denoising Score Matching
NCSN (Song & Ermon, 2019)
VE (\alpha_t = 1, \tilde\sigma_i)
Score -\boldsymbol\epsilon/\tilde\sigma_i
Weighted by \tilde\sigma_i^2, making the loss \mathbb{E}\|\tilde\sigma_i\mathbf{s}_{\boldsymbol\theta} + \boldsymbol\epsilon\|^2
Every target is c_t\mathbf{x}_0 + f(\mathbf{x}_t) at fixed \mathbf{x}_t: Thus every target’s irreducible loss floor is c_t^2 times the posterior covariance trace.
Explaining the 9\times plateau gap (4.91 vs. 0.54): Linear velocity (c_t = -1/t) plateaus at \approx 4.91 while VP noise (c_t = -\alpha_t/\sigma_t) plateaus at \approx 0.54: the targets are scaled by different c_t^2, and the two paths run on different clocks.
Measuring Excess Loss Above the Exact Oracle Floor
Verifying Cross-Path Equivalence
Using 10^6 Monte Carlo draws, we decompose the loss of our trained linear-velocity network (ema_v) and VP-noise network (ema_eps) into the exact oracle floor plus the network’s excess error \mathbb{E}\|\text{net} - \text{oracle}\|^2:
target, path t=0.1 t=0.5 t=0.9 t~U(0,1) s.e. train loss excess
noise, vp 1.368 0.477 0.002 0.540 0.0011 0.542 0.0002
velocity, linear 2.351 2.796 9.157 4.906 0.0070 4.899 0.0010
velocity net read as a noise model on vp: loss 0.540, excess 0.0002
Both networks learn the exact same posterior mean: Their excess errors over the oracle are \le 0.001 (smaller than Monte Carlo standard error), and querying the linear-path velocity network as a VP noise predictor via eps_from_velocity matches ema_eps to four decimal places (0.540 loss, 0.0002 excess).
Pitfall: Comparing Raw Training Losses Across Targets
Practical Diagnostics
Because the loss floor scales with c_t^2, raw training losses in diffusion and flow matching carry three counterintuitive diagnostic traps:
Trap 1: High plateau \neq underfitting: A velocity flow-matching loss plateauing at 4.9 and a DDPM noise loss plateauing at 0.54 are both within 0.001 of the Bayes-optimal oracle.
Trap 2: Lower raw loss \neq better model: The 9\times difference between 4.9 and 0.54 comes from the magnification factor c_t^2(1/t^2 vs. \alpha_t^2/\sigma_t^2) and the different clocks of the two paths. Models trained on different targets or schedules must be compared in a common target unit (such as \mathbb{E}\|\hat{\mathbf{x}}_0 - \mathbf{x}_0\|^2 at matched log-SNR \lambda) or by sample quality.
Trap 3: Finite-dataset memorization: The empirical optimum on a small dataset of N points is the exact posterior mean of N Dirac delta masses, which memorizes training examples verbatim (Exercise 17.2.5); neural networks generalize because architectural inductive bias smooths the velocity field across space.
Concept Check: Log-SNR Clock & Target Conversions
Check Your Understanding
Test your mastery of Gaussian probability paths and the target dictionary:
Half-signal, half-noise time (\lambda_t = 0): At what time t \in [0, 1] does signal variance equal noise variance (\alpha_t^2 = \sigma_t^2, so \lambda_t = 0) on the linear path versus the VP path with \log \bar\alpha_t = -(0.1t + 9.95t^2)?
Cross-path rescaling: At t = 0.5, the VP path has \alpha_{0.5} = 0.28 and \sigma_{0.5} = 0.96. Which linear-path time t_{\textrm{lin}} has the same log-SNR, and by what scalar c must a VP point \mathbf{x}_{0.5} be multiplied to land on the linear path?
Endpoint noise floors: On the 2D mixture (d = 2), why does the VP noise-prediction floor approach 2 as t \to 0 and 0 as t \to 1?
Answers:
Linear:1 - t = t \implies \mathbf{t = 0.50}. VP:\bar\alpha_t = 0.5 \implies 0.1t + 9.95t^2 = \log 2 \approx 0.693 \implies \mathbf{t \approx 0.26} (VP spends 74\% of its time in the noise-dominated regime).
Matched linear time:t_{\textrm{lin}} = \frac{\sigma}{\alpha + \sigma} = \frac{0.96}{0.28 + 0.96} \approx \mathbf{0.773}, with rescaling factor c = \frac{1}{\alpha + \sigma} = \frac{1}{1.24} \approx \mathbf{0.806}.
As t \to 1, \mathbf{x}_t \approx \boldsymbol\epsilon, so \boldsymbol\epsilon is known almost exactly (\text{floor} \to \mathbf{0}). As t \to 0, tiny noise \sigma_t\boldsymbol\epsilon is indistinguishable from within-mode spread, so \hat{\boldsymbol\epsilon} \to \mathbf{0} and \mathbb{E}\|\boldsymbol\epsilon - \mathbf{0}\|^2 = d = \mathbf{2}.