EN
q ( x t ∣ x t − 1 ) = N ( x t ; 1 − β t x t − 1 , β t I ) q(\mathbf{x}_t \mid \mathbf{x}_{t-1}) = \mathcal{N}(\mathbf{x}_t; \sqrt{1 - \beta_t} \mathbf{x}_{t-1}, \beta_t \mathbf{I}) q ( x t ∣ x t − 1 ) = N ( x t ; 1 − β t x t − 1 , β t I )
x t = α ˉ t x 0 + 1 − α ˉ t ϵ \mathbf{x}_t = \sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1 - \bar{\alpha}_t}\boldsymbol{\epsilon} x t = α ˉ t x 0 + 1 − α ˉ t ϵ
where α t = 1 − β t , α ˉ t = ∏ s = 1 t α s , ϵ ∼ N ( 0 , I ) \text{where} \quad \alpha_t = 1 - \beta_t, \quad \bar{\alpha}_t = \prod_{s=1}^t \alpha_s, \quad \boldsymbol{\epsilon} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}) where α t = 1 − β t , α ˉ t = s = 1 ∏ t α s , ϵ ∼ N ( 0 , I )
p θ ( x t − 1 ∣ x t ) = N ( x t − 1 ; μ θ ( x t , t ) , σ t 2 I ) p_\theta(\mathbf{x}_{t-1} \mid \mathbf{x}_t) = \mathcal{N}(\mathbf{x}_{t-1}; \boldsymbol{\mu}_\theta(\mathbf{x}_t, t), \sigma_t^2 \mathbf{I}) p θ ( x t − 1 ∣ x t ) = N ( x t − 1 ; μ θ ( x t , t ) , σ t 2 I )
μ θ ( x t , t ) = 1 α t ( x t − β t 1 − α ˉ t ϵ θ ( x t , t ) ) \boldsymbol{\mu}_\theta(\mathbf{x}_t, t) = \frac{1}{\sqrt{\alpha_t}} \left( \mathbf{x}_t - \frac{\beta_t}{\sqrt{1 - \bar{\alpha}_t}} \boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \right) μ θ ( x t , t ) = α t 1 ( x t − 1 − α ˉ t β t ϵ θ ( x t , t ) )
L simple ( θ ) = E t , x 0 , ϵ [ ∥ ϵ − ϵ θ ( α ˉ t x 0 + 1 − α ˉ t ϵ , t ) ∥ 2 ] L_{\text{simple}}(\theta) = \mathbb{E}_{t, \mathbf{x}_0, \boldsymbol{\epsilon}} \left[ \| \boldsymbol{\epsilon} - \boldsymbol{\epsilon}_\theta(\sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1 - \bar{\alpha}_t}\boldsymbol{\epsilon}, t) \|^2 \right] L simple ( θ ) = E t , x 0 , ϵ [ ∥ ϵ − ϵ θ ( α ˉ t x 0 + 1 − α ˉ t ϵ , t ) ∥ 2 ]
Generate New Sample
Ready
Part II: Flow Matching
d x d t = v θ ( x , t ) , t ∈ [ 0 , 1 ] \frac{dx}{dt} = v_\theta(x, t), \quad t \in [0, 1] d t d x = v θ ( x , t ) , t ∈ [ 0 , 1 ]
x t = ( 1 − t ) x 0 + t x 1 x_t = (1 - t) x_0 + t x_1 x t = ( 1 − t ) x 0 + t x 1
v t a r g e t ( x t , t ) = x 1 − x 0 v_{target}(x_t, t) = x_1 - x_0 v t a r g e t ( x t , t ) = x 1 − x 0
L ( θ ) = E t , x 0 , x 1 [ ∥ v θ ( x t , t ) − ( x 1 − x 0 ) ∥ 2 ] \mathcal{L}(\theta) = \mathbb{E}_{t, x_0, x_1} \left[ \| v_\theta(x_t, t) - (x_1 - x_0) \|^2 \right] L ( θ ) = E t , x 0 , x 1 [ ∥ v θ ( x t , t ) − ( x 1 − x 0 ) ∥ 2 ]
def train_step (model, x_1):
# t ~ U[0, 1]
t = torch.rand(B, 1 )
# x_0 ~ N(0, I)
x_0 = torch.randn_like(x_1)
# Linear interpolation
x_t = (1 - t) * x_0 + t * x_1
# Target velocity is simply the difference
v_target = x_1 - x_0
# Predict velocity field
v_pred = model(x_t, t)
# MSE Loss
loss = F.mse_loss(v_pred, v_target)
return loss
def sample_euler (model, steps= 50 , shape= (1 , 3 , 256 , 256 )):
x = torch.randn(shape) # Start at noise (t=0)
dt = 1.0 / steps
for i in range (steps):
t = torch.full((shape[0 ],), i * dt)
v = model(x, t)
# Euler integration step
x = x + v * dt
return x # Data at t=1
x t − Δ t = ( 1 − ( t − Δ t ) ) ⏟ signal coeff x ^ 0 + ( t − Δ t ) cos ( η π 2 ) ⏟ predicted noise x ^ 1 + ( t − Δ t ) sin ( η π 2 ) ⏟ fresh noise ϵ \bm{x}_{t-\Delta t} = \underbrace{(1-(t-\Delta t))}_{\text{signal coeff}} \hat{\bm{x}}_0 + (t-\Delta t)\underbrace{\cos\!\left(\frac{\eta\pi}{2}\right)}_{\text{predicted noise}} \hat{\bm{x}}_1 + (t-\Delta t)\underbrace{\sin\!\left(\frac{\eta\pi}{2}\right)}_{\text{fresh noise}} \bm{\epsilon} x t − Δ t = signal coeff ( 1 − ( t − Δ t )) x ^ 0 + ( t − Δ t ) predicted noise cos ( 2 η π ) x ^ 1 + ( t − Δ t ) fresh noise sin ( 2 η π ) ϵ
Method
Stochasticity
Noise Artifacts
Matches Scheduler
ODE (Euler)
None
None
Yes
Flow-SDE
Uncontrolled
Severe
No (Excess)
CPS
Controlled (η)
None
Yes (Exact)
Reference: Wang & Yu, "Coefficients-Preserving Sampling for Reinforcement Learning with Flow Matching," arXiv:2509.05952, 2025.
Error Euler ∝ max t ∥ ∇ x v θ ∥ ⋅ d t 2 \text{Error}_{\text{Euler}} \propto \max_{t} \| \nabla_x v_\theta \| \cdot dt^2 Error Euler ∝ t max ∥ ∇ x v θ ∥ ⋅ d t 2
Feature
DDPM / DDIM
Flow Matching
Mathematical Framework
Stochastic Differential Equations (SDE)
Ordinary Differential Equations (ODE)
Training Target
Predict Noise ϵ \epsilon ϵ or Data x 0 x_0 x 0
Predict Velocity v = x 1 − x 0 v = x_1 - x_0 v = x 1 − x 0
Path Shape
Curved (Noise Schedule dependent)
Straight (Linear Interpolation)
Typical Sampling Steps
20 - 1000
1 - 50 (with Reflow)