<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>generative models | Yichao Zhou</title>
    <link>https://yichaozhou.com/tags/generative-models/</link>
      <atom:link href="https://yichaozhou.com/tags/generative-models/index.xml" rel="self" type="application/rss+xml" />
    <description>generative models</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>© 2018-2026 Yichao Zhou All Rights Reserved</copyright><lastBuildDate>Tue, 28 Apr 2026 00:00:00 +0000</lastBuildDate>
    <image>
      <url>https://yichaozhou.com/images/icon_hu55475fe97c00cec85fe596a6a8c7f761_27704_512x512_fill_lanczos_center_2.png</url>
      <title>generative models</title>
      <link>https://yichaozhou.com/tags/generative-models/</link>
    </image>
    
    <item>
      <title>Yet Another Tutorial on Diffusion Models</title>
      <link>https://yichaozhou.com/post/20260428diffusion/</link>
      <pubDate>Tue, 28 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://yichaozhou.com/post/20260428diffusion/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;Learning diffusion models can be challenging.  To my knowledge, there are at least three theories explaining how diffusion models work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Variational inference (similar to VAE). This results
in the famous DDPM and DDIM. It first defines a
forward noising process &lt;span  class=&#34;math&#34;&gt;\(q(x_t| x_{t-1})\)&lt;/span&gt; and a backward process &lt;span  class=&#34;math&#34;&gt;\(p_\theta(x_{t+1}| x_{t})\)&lt;/span&gt;. Then it optimizes
the evidence lower bound (ELBO) to learn the optimal reverse process, which serves as a generative model.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Score-based modeling. This is from solving the stochastic differential equation (SDE): what the denoiser learns is the &lt;em&gt;score function&lt;/em&gt;
&lt;span  class=&#34;math&#34;&gt;\(\nabla_x \log p_t(x)\)&lt;/span&gt; of a stochastic process.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Rectified flow. In this view,
diffusion models are a way to map samples from two distributions, i.e., between random Gaussians (source)
and images (target), and to find smooth non-intersecting paths (i.e., rectify the field) to move samples from source to target.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;diffusion-models-from-variational-inference&#34;&gt;Diffusion Models from Variational inference&lt;/h2&gt;

&lt;h3 id=&#34;elbo&#34;&gt;ELBO&lt;/h3&gt;

&lt;p&gt;Before discussing DDPM, it is helpful to recall the basic idea of the evidence lower bound
(ELBO).  Suppose we have an observed variable &lt;span  class=&#34;math&#34;&gt;\(x\)&lt;/span&gt;, a latent variable &lt;span  class=&#34;math&#34;&gt;\(z\)&lt;/span&gt;, and a probabilistic model &lt;span  class=&#34;math&#34;&gt;\(p_\theta(x|z)\)&lt;/span&gt;.
We want to optimize &lt;span  class=&#34;math&#34;&gt;\(\theta\)&lt;/span&gt; to maximize the data likelihood&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\log p_{\theta}(x)=\log \int p_{\theta}(x,z)\mathrm{d}z.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This integral is hard to compute directly without enumerating &lt;span  class=&#34;math&#34;&gt;\(z\)&lt;/span&gt;. The trick is to introduce an approximate posterior
&lt;span  class=&#34;math&#34;&gt;\(q(z|x)\)&lt;/span&gt; that is close to &lt;span  class=&#34;math&#34;&gt;\(p_\theta(z|x)\)&lt;/span&gt;.  This &lt;span  class=&#34;math&#34;&gt;\(q(z|x)\)&lt;/span&gt; can be either a fixed distribution (as in most diffusion models) or
a learned distribution (as in VAE). Then we can rewrite the likelihood as&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
\log p_{\theta}(x)
&amp;= \log \mathbb{E}_{q(z|x)}
\left[
\frac{p_{\theta}(x,z)}{q(z|x)}
\right]\\
&amp;\ge
\mathbb{E}_{q(z|x)}
\left[
\log \frac{p_{\theta}(x,z)}{q(z|x)}
\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The inequality is Jensen&#39;s inequality.  The right-hand side is called the ELBO:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\mathrm{ELBO}=
\mathbb{E}_{z\sim q(z|x)}
\left[
\log p_{\theta}(x,z)-\log q(z|x)
\right] \le \log p_{\theta}(x).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The gap between ELBO and &lt;span  class=&#34;math&#34;&gt;\(p_\theta(x)\)&lt;/span&gt; is the KL-divergence:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
\log p_{\theta}(x)
&amp;=
\mathrm{ELBO}
+D_{\mathrm{KL}}\left(q(z|x)\,\Vert\,p_{\theta}(z|x)\right).
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In the VAE-style factorization, the negative ELBO can be
written in the KL divergence form:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
L_{\mathrm{VAE}}
&amp;:= -\mathrm{ELBO}\\
&amp;=
\mathbb{E}_{q(z|x)}
\left[
\log q(z|x)-\log p_{\theta}(x,z)
\right]\\
&amp;=
\mathbb{E}_{q(z|x)}
\left[
\log q(z|x)-\log p(z)-\log p_{\theta}(x|z)
\right]\\
&amp;=
\mathbb{E}_{q(z|x)}
\left[
\log \frac{q(z|x)}{p(z)}
\right]-
\mathbb{E}_{q(z|x)}
\left[
\log p_{\theta}(x|z)
\right]\\
&amp;=
D_{\mathrm{KL}}\left(q(z|x)\,\Vert\,p(z)\right)-
\mathbb{E}_{q(z|x)}
\left[
\log p_{\theta}(x|z)
\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This is the form is close to the DDPM expression below.&lt;/p&gt;

&lt;h3 id=&#34;ddpm&#34;&gt;DDPM&lt;/h3&gt;

&lt;p&gt;&lt;a href=&#34;https://arxiv.org/abs/2006.11239&#34;&gt;DDPM&lt;/a&gt; is the classic formulation that made diffusion models
popular in computer vision.  They derived the fomulation of the diffusion model with variational inference,
similar to VAE.  Unfortunately, the fomulation is quite complex since it is one of the early work.
Assuming &lt;span  class=&#34;math&#34;&gt;\(x_0\)&lt;/span&gt; is a clean image sample,  DDPM first defines a
forward Markov process that gradually corrupts &lt;span  class=&#34;math&#34;&gt;\(x_0\)&lt;/span&gt; with Gaussian noise:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
q(x_t | x_{t-1})
= \mathcal{N}\left(\sqrt{\alpha_t}x_{t-1}, (1-\alpha_t)I\right),
\qquad \alpha_t = 1-\beta_t.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Here &lt;span  class=&#34;math&#34;&gt;\(\beta_t\)&lt;/span&gt; is a small positive number that controls how much noise is added at step &lt;span  class=&#34;math&#34;&gt;\(t\)&lt;/span&gt;.
Equivalently, we can sample &lt;span  class=&#34;math&#34;&gt;\(x_t\)&lt;/span&gt; directly with&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
x_t=\sqrt{\bar{\alpha}_t}x_0+\sqrt{1-\bar{\alpha}_t}\epsilon_t,
\qquad \epsilon_t\sim\mathcal{N}(0,I),
\qquad \bar{\alpha}_t=\prod_{i=1}^{t}\alpha_i \tag{1}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The forward process is a conditional Gaussian distribution to be learned:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
p_{\theta}(x_{t-1}| x_t)
= \mathcal{N}\left(\mu_{\theta}(x_t,t), \Sigma_t\right).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Next, we maximize &lt;span  class=&#34;math&#34;&gt;\(p_\theta(x_0)\)&lt;/span&gt; by optimizing the ELBO.  Let &lt;span  class=&#34;math&#34;&gt;\(L_{\mathrm{VLB}}\)&lt;/span&gt; as the negative ELBO.  It can be decomposed into a sum of KL terms similar to &lt;span  class=&#34;math&#34;&gt;\(L_{\mathrm{VAE}}\)&lt;/span&gt;:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
L_{\mathrm{VLB}}
&amp;=
D_{\mathrm{KL}}\left(q(x_T|x_0)\,\Vert\,p(x_T)\right)\\
&amp;\quad+
\mathbb{E}_{q(x_{1:T}|x_0)}
\left[
\sum_{t=2}^{T}
D_{\mathrm{KL}}\left(q(x_{t-1}|x_t,x_0)\,\Vert\,p_{\theta}(x_{t-1}|x_t)\right)
\right]\\
&amp;\quad-
\mathbb{E}_{q(x_1|x_0)}\left[\log p_{\theta}(x_0|x_1)\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;details&gt;
&lt;summary&gt;Full ELBO Derivation for DDPM (Click to Unfold)&lt;/summary&gt;&lt;/p&gt;

&lt;p&gt;The joint reverse model is&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
p_{\theta}(x_{0:T})=p(x_T)\prod_{t=1}^{T}p_{\theta}(x_{t-1}|x_t),
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;and the forward process is&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
q(x_{1:T}|x_0)=\prod_{t=1}^{T}q(x_t|x_{t-1}).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Starting from the likelihood,&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
\log p_{\theta}(x_0)
&amp;=
\log \int p_{\theta}(x_{0:T})\mathrm{d}x_{1:T}\\
&amp;=
\log \mathbb{E}_{q(x_{1:T}|x_0)}
\left[
\frac{p_{\theta}(x_{0:T})}{q(x_{1:T}|x_0)}
\right]\\
&amp;\ge
\mathbb{E}_{q(x_{1:T}|x_0)}
\left[
\log \frac{p_{\theta}(x_{0:T})}{q(x_{1:T}|x_0)}
\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The inequality is Jensen&#39;s inequality.  Expanding the terms gives&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\mathbb{E}_{q}
\left[
\log p(x_T)
+\sum_{t=1}^{T}\log p_{\theta}(x_{t-1}|x_t)
-\sum_{t=1}^{T}\log q(x_t|x_{t-1})
\right].
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The non-obvious step is to rewrite the forward chain in terms of the tractable posterior
&lt;span  class=&#34;math&#34;&gt;\(q(x_{t-1}|x_t,x_0)\)&lt;/span&gt;.  By Bayes&#39; rule,&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
q(x_t|x_{t-1})q(x_{t-1}|x_0)
= q(x_{t-1}|x_t,x_0)q(x_t|x_0).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Using this identity repeatedly, the forward process can be refactored as&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
q(x_{1:T}|x_0)
= q(x_T|x_0)\prod_{t=2}^{T}q(x_{t-1}|x_t,x_0).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Substituting this refactorization into the negative ELBO gives&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
L_{\mathrm{VLB}}
&amp;=
\mathbb{E}_{q}
\left[
\log q(x_{1:T}|x_0)-\log p_{\theta}(x_{0:T})
\right]\\
&amp;=
\mathbb{E}_{q}
\left[
\log \frac{q(x_T|x_0)}{p(x_T)}
+\sum_{t=2}^{T}
\log \frac{q(x_{t-1}|x_t,x_0)}{p_{\theta}(x_{t-1}|x_t)}
-\log p_{\theta}(x_0|x_1)
\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Each log-ratio expectation is exactly a KL divergence.  Therefore the negative ELBO becomes&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
L_{\mathrm{VLB}}
&amp;=
D_{\mathrm{KL}}\left(q(x_T|x_0)\,\Vert\,p(x_T)\right)\\
&amp;\quad+
\mathbb{E}_{q(x_{1:T}|x_0)}
\left[
\sum_{t=2}^{T}
D_{\mathrm{KL}}\left(q(x_{t-1}|x_t,x_0)\,\Vert\,p_{\theta}(x_{t-1}|x_t)\right)
\right]\\
&amp;\quad-
\mathbb{E}_{q(x_1|x_0)}\left[\log p_{\theta}(x_0|x_1)\right].
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The posterior &lt;span  class=&#34;math&#34;&gt;\(q(x_{t-1}|x_t,x_0)\)&lt;/span&gt; is tractable because all variables are jointly Gaussian under
the forward process.  Matching this posterior with &lt;span  class=&#34;math&#34;&gt;\(p_{\theta}(x_{t-1}|x_t)\)&lt;/span&gt; gives the denoising
training objective used by DDPM.&lt;/p&gt;

&lt;p&gt;&lt;/details&gt;&lt;/p&gt;

&lt;p&gt;The first term is usually close to zero if &lt;span  class=&#34;math&#34;&gt;\(T\)&lt;/span&gt; is large enough, because &lt;span  class=&#34;math&#34;&gt;\(x_T\)&lt;/span&gt; is nearly
standard Gaussian.  The last term is to predict the image &lt;span  class=&#34;math&#34;&gt;\(x_0\)&lt;/span&gt; from &lt;span  class=&#34;math&#34;&gt;\(x_1\)&lt;/span&gt;, which you can ignore for now (it is similar to the middle term in the final formulation).
The middle terms are the important ones: they ask the learned reverse transition
&lt;span  class=&#34;math&#34;&gt;\(p_{\theta}(x_{t-1}|x_t)\)&lt;/span&gt; to match the true posterior &lt;span  class=&#34;math&#34;&gt;\(q(x_{t-1}|x_t,x_0)\)&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;This reverse posterior &lt;span  class=&#34;math&#34;&gt;\(q(x_{t-1}|x_t,x_0)\)&lt;/span&gt; has a closed form.  Using
&lt;span  class=&#34;math&#34;&gt;\(x_t=\sqrt{\bar{\alpha}_t}x_0+\sqrt{1-\bar{\alpha}_t}\epsilon_t\)&lt;/span&gt;, we can write it in terms of the
noise &lt;span  class=&#34;math&#34;&gt;\(\epsilon_t\)&lt;/span&gt;:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
q(x_{t-1}|x_t,x_0)
= \mathcal{N}\left(\tilde{\mu}_t(x_t,\epsilon), \tilde{\beta}_t I\right),
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;where&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
\tilde{\mu}_t(x_t,x_0)=
\frac{1}{\sqrt{\alpha_t}}
\left(
x_t-\frac{\beta_t}{\sqrt{1-\bar{\alpha}_t}}\epsilon_t
\right), \qquad
\tilde{\beta}_t
= \frac{1-\bar{\alpha}_{t-1}}{1-\bar{\alpha}_t}\beta_t.
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;When both distributions are Gaussian and the variance is fixed, each KL term has a closed form:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\begin{align}
L_{t-1}
&amp;=
D_{\mathrm{KL}}\left(
q(x_{t-1}|x_t,x_0)\,\Vert\,p_{\theta}(x_{t-1}|x_t)
\right)\\
&amp;=
\frac{1}{2\tilde{\beta}_t}
\left\Vert
\tilde{\mu}_t(x_t,x_0)-\mu_{\theta}(x_t,t)
\right\Vert^2 + C,
\end{align}
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In diffusion model literature, people found predicting noise &lt;span  class=&#34;math&#34;&gt;\(\epsilon_t\)&lt;/span&gt; is better in practice.
This becomes a weighted mean-squared error between the true
noise &lt;span  class=&#34;math&#34;&gt;\(\epsilon_t\)&lt;/span&gt; and the predicted noise:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
L_{t-1}=\frac{\beta_t^2}{2\tilde{\beta}_t\alpha_t(1-\bar{\alpha}_t)}
\left\Vert\epsilon_t-\epsilon_{\theta}(x_t,t)\right\Vert^2 + C.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In practice, DDPM usually drops the weighting and uses the simplified objective&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
L_{\mathrm{simple}}(\theta)=
\mathbb{E}_{(t,x_0,x_t)\sim q}
\left[
\left\Vert
\epsilon_t-\epsilon_{\theta}\left(x_t, t\right)
\right\Vert^2
\right].
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;At inference time, DDPM starts from &lt;span  class=&#34;math&#34;&gt;\(x_T\sim\mathcal{N}(0,I)\)&lt;/span&gt; and repeatedly applies the learned
reverse transition until &lt;span  class=&#34;math&#34;&gt;\(x_0\)&lt;/span&gt;.  A single reverse step is stochastic:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
x_{t-1} = \mu_{\theta}(x_t,t)+\sqrt{\tilde{\beta}_t}\epsilon_t,
\qquad \epsilon_t\sim \mathcal{N}(0,I).
\]&lt;/span&gt;&lt;/p&gt;

&lt;h2 id=&#34;ddim&#34;&gt;DDIM&lt;/h2&gt;

&lt;h2 id=&#34;scorebased-generative-modeling&#34;&gt;Score-Based Generative Modeling&lt;/h2&gt;

&lt;p&gt;Score-based generative modeling describes the same family of ideas from the perspective of score
functions.  The score of a distribution is the gradient of log density:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
s(x) = \nabla_x \log p(x).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;For diffusion models, we care about the score of noisy data distributions &lt;span  class=&#34;math&#34;&gt;\(p_t(x_t)\)&lt;/span&gt; or
&lt;span  class=&#34;math&#34;&gt;\(p_{\sigma}(x_{\sigma})\)&lt;/span&gt;.  A score network &lt;span  class=&#34;math&#34;&gt;\(s_{\theta}(x_t,t)\)&lt;/span&gt; learns&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
s_{\theta}(x_t,t)\approx \nabla_{x_t}\log p_t(x_t).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;For the Gaussian noising process&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
x_t = \sqrt{\bar{\alpha}_t}x_0+\sqrt{1-\bar{\alpha}_t}\epsilon,
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;the conditional score of &lt;span  class=&#34;math&#34;&gt;\(q(x_t| x_0)\)&lt;/span&gt; is&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\nabla_{x_t}\log q(x_t| x_0)
= -\frac{\epsilon}{\sqrt{1-\bar{\alpha}_t}}.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This explains why predicting noise and predicting score are closely related.  If a model
predicts &lt;span  class=&#34;math&#34;&gt;\(\epsilon_{\theta}(x_t,t)\)&lt;/span&gt;, then the corresponding score estimate is&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
s_{\theta}(x_t,t)
= -\frac{\epsilon_{\theta}(x_t,t)}{\sqrt{1-\bar{\alpha}_t}}.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://arxiv.org/abs/2011.13456&#34;&gt;Score-Based Generative Modeling through SDEs&lt;/a&gt; generalizes this
view.  Instead of a finite sequence of discrete timesteps, the forward process is a stochastic
differential equation that gradually turns data into noise.  Sampling solves the reverse-time SDE
or a related deterministic probability-flow ODE.  In practice, DDPM, DDIM, EDM, and score-based
models are often different parameterizations of the same underlying denoising problem.&lt;/p&gt;

&lt;h3 id=&#34;edm&#34;&gt;EDM&lt;/h3&gt;

&lt;p&gt;&lt;a href=&#34;https://arxiv.org/abs/2206.00364&#34;&gt;EDM&lt;/a&gt;, short for &amp;quot;Elucidating the Design Space of
Diffusion-Based Generative Models&amp;quot;, reframes diffusion models around continuous noise magnitude
&lt;span  class=&#34;math&#34;&gt;\(\sigma\)&lt;/span&gt; instead of discrete timesteps &lt;span  class=&#34;math&#34;&gt;\(t\)&lt;/span&gt;.  The noisy sample is written as&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
x_{\sigma}=x_0+\sigma\epsilon,
\qquad \epsilon\sim\mathcal{N}(0,I).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This notation is cleaner because the noise level itself is explicit.  The denoiser is trained to
recover the clean sample from &lt;span  class=&#34;math&#34;&gt;\(x_{\sigma}\)&lt;/span&gt;:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
D_{\theta}(x_{\sigma},\sigma)\approx x_0.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In EDM, a common training objective is a weighted denoising loss&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
L_{\mathrm{EDM}}(\theta)
= \mathbb{E}_{x_0,\sigma,\epsilon}
\left[
w(\sigma)
\left\Vert D_{\theta}(x_0+\sigma\epsilon,\sigma)-x_0\right\Vert^2
\right].
\]&lt;/span&gt;&lt;/p&gt;

&lt;h3 id=&#34;dmd-distillation&#34;&gt;DMD Distillation&lt;/h3&gt;

&lt;h2 id=&#34;rectified-flow-flow-matching&#34;&gt;Rectified Flow (Flow Matching)&lt;/h2&gt;

&lt;p&gt;Diffusion models learn to denoise along a noisy path.  &lt;a href=&#34;https://arxiv.org/abs/2210.02747&#34;&gt;Flow matching&lt;/a&gt;
and &lt;a href=&#34;https://arxiv.org/abs/2209.03003&#34;&gt;rectified flow&lt;/a&gt; instead learn a velocity field that transports
noise into data through an ordinary differential equation:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
\frac{\mathrm{d}x_t}{\mathrm{d}t}=v_{\theta}(x_t,t).
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;A simple path between noise &lt;span  class=&#34;math&#34;&gt;\(x_0\sim p_{\mathrm{noise}}\)&lt;/span&gt; and data &lt;span  class=&#34;math&#34;&gt;\(x_1\sim p_{\mathrm{data}}\)&lt;/span&gt;
is linear interpolation:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
x_t = (1-t)x_0 + tx_1.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;For this path, the target velocity is just&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
u_t = \frac{\mathrm{d}x_t}{\mathrm{d}t}=x_1-x_0.
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The flow-matching objective trains a neural network to predict this velocity:&lt;/p&gt;

&lt;p&gt;&lt;span  class=&#34;math&#34;&gt;\[
L_{\mathrm{FM}}(\theta)
= \mathbb{E}_{t,x_0,x_1}
\left[
\left\Vert v_{\theta}(x_t,t) - (x_1-x_0)\right\Vert^2
\right].
\]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;At sampling time, we start from noise and integrate the learned ODE from &lt;span  class=&#34;math&#34;&gt;\(t=0\)&lt;/span&gt; to &lt;span  class=&#34;math&#34;&gt;\(t=1\)&lt;/span&gt;.  This
is conceptually simpler than diffusion sampling because there is no stochastic reverse chain and no
need to add noise at each step.  The tradeoff is that the choice of path and velocity target
matters.  Rectified flow tries to learn straighter transport paths, which can reduce the number of
ODE solver steps needed for high-quality generation.&lt;/p&gt;

&lt;p&gt;The useful mental model is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DDPM learns a stochastic reverse denoising chain.&lt;/li&gt;
&lt;li&gt;DDIM uses the same denoising model but follows a deterministic sampling path.&lt;/li&gt;
&lt;li&gt;EDM rewrites the design around continuous noise levels and better practical choices.&lt;/li&gt;
&lt;li&gt;Score-based modeling describes denoising as learning gradients of noisy data densities.&lt;/li&gt;
&lt;li&gt;Rectified flow and flow matching replace denoising with velocity-field learning.&lt;/li&gt;
&lt;/ol&gt;
</description>
    </item>
    
  </channel>
</rss>
