<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://qufy6.github.io/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://qufy6.github.io/" rel="alternate" type="text/html" /><updated>2026-10-10T17:58:05-04:00</updated><id>https://qufy6.github.io/blog/feed.xml</id><title type="html">Feiyu (Felix) Qu</title><subtitle>Notes on diffusion language models, latent reasoning, multi-agent systems, reinforcement learning, and life.</subtitle><author><name>Feiyu (Felix) Qu</name></author><entry><title type="html">LLaDA Is Actually a Discrete Flow Matching Model</title><link href="https://qufy6.github.io/blog/2026/10/10/llada-is-a-discrete-flow-matching-model/" rel="alternate" type="text/html" title="LLaDA Is Actually a Discrete Flow Matching Model" /><published>2026-10-10T13:00:00-04:00</published><updated>2026-10-10T13:00:00-04:00</updated><id>https://qufy6.github.io/blog/2026/10/10/llada-is-a-discrete-flow-matching-model</id><content type="html" xml:base="https://qufy6.github.io/blog/2026/10/10/llada-is-a-discrete-flow-matching-model/"><![CDATA[<div class="abstract">
  <p><strong>Abstract.</strong> In computer-vision generation tasks, diffusion models have demonstrated remarkable performance, and flow matching improves inference efficiency by replacing an SDE with an ODE. As the first open-source 7B-scale diffusion language model (DLM), LLaDA shows strong promise, suggesting that diffusion language models may eventually replace the widely used autoregressive paradigm. This raises a natural question: can models guided by discrete flow matching achieve better performance? However, our theoretical analysis indicates that the current diffusion language model LLaDA is, in fact, already equivalent to a discrete flow matching model.</p>
</div>

<h2 id="1-introduction">1. Introduction</h2>

<p><em>(Omitting some related works…)</em></p>

<p>Here, I will explain why LLaDA is a Discrete Flow Matching model. At a conceptual level, continuous flow matching can be viewed as addressing the fact that the randomness in continuous diffusion models often makes generation require many iterative steps. In diffusion language models, especially LLaDA, each token typically moves directly from <code class="language-plaintext highlighter-rouge">[MASK]</code> to a concrete token (ignoring the remasking mechanism), so this “stochasticity” issue is much less pronounced, and discrete diffusion and discrete flow matching become effectively equivalent. More concretely, since the “velocity” is defined as a probability-flow velocity, the model is trained to predict an accurate posterior distribution; LLaDA is also learning to predict this posterior. When the loss is chosen as cross-entropy, the resulting objective matches LLaDA exactly.</p>

<p>This note reviews (i) denoising diffusion probabilistic models (DDPMs) <a href="#ref-1">[1]</a> in continuous spaces as stochastic forward–reverse processes and (ii) flow matching <a href="#ref-2">[2]</a> as a deterministic alternative based on ordinary differential equations. We then summarize discrete diffusion (e.g., D3PM <a href="#ref-3">[3]</a>) and discrete flow matching <a href="#ref-4">[4]</a>, <a href="#ref-5">[5]</a>, and explain why the LLaDA training objective <a href="#ref-6">[6]</a> can be interpreted as a discrete flow matching objective.</p>

<h2 id="2-preliminaries">2. Preliminaries</h2>

<p><em>Unless otherwise specified, throughout the rest of this note, subscript 0 denotes clean data and subscript 1 denotes noise.</em></p>

<h3 id="21-diffusion-models-and-flow-matching-in-continuous-spaces">2.1 Diffusion models and flow matching in continuous spaces</h3>

<p>Denoising diffusion probabilistic models (DDPMs) <a href="#ref-1">[1]</a> were originally developed and widely used in continuous domains. They define a noise-injection <em>forward</em> process and a learned <em>reverse</em> denoising process.</p>

<p><strong>Forward (noising) process.</strong> Let \(x_0\) denote data and \(x_{1:T}\) denote a sequence of latent variables. A standard Gaussian forward process is</p>

\[q(x_{1:T} \mid x_0) = \prod_{t=1}^{T} q(x_t \mid x_{t-1}), \tag{1}\]

\[q(x_t \mid x_{t-1}) = \mathcal{N}\big(x_t;\ \sqrt{\alpha_t}\, x_{t-1},\ (1-\alpha_t) I\big), \tag{2}\]

\[\text{equivalently}\quad x_t = \sqrt{\bar\alpha_t}\, x_0 + \sqrt{1-\bar\alpha_t}\,\epsilon, \qquad \epsilon \sim \mathcal{N}(0, I), \tag{3}\]

<p>where \(\bar\alpha_t := \prod_{s=1}^{t} \alpha_s\).</p>

<p><strong>Reverse (denoising) process.</strong> The learned reverse dynamics are typically parameterized as</p>

\[p_\theta(x_{t-1} \mid x_t) = \mathcal{N}\big(x_{t-1};\ \mu_\theta(x_t, t),\ \Sigma_\theta(x_t, t)\big), \tag{4}\]

\[p_\theta(x_0, x_1, \ldots, x_T) := p(x_T) \prod_{t=1}^{T} p_\theta(x_{t-1} \mid x_t). \tag{5}\]

<p>Because diffusion sampling can be viewed as solving an SDE and injects random noise at each step, many steps are often required for high-quality samples.</p>

<p><strong>Flow matching.</strong> To accelerate sampling, flow matching replaces the stochastic SDE with a deterministic ODE <a href="#ref-2">[2]</a>. One defines a velocity field \(\mathbf{v}(x_t, t)\) and evolves samples according to</p>

\[\frac{dx_t}{dt} = \mathbf{v}(x_t, t). \tag{6}\]

<p>A common construction specifies a probability path via linear interpolation of endpoint distributions,</p>

\[p_t(x) = (1-t)\, p_T(x) + t\, p_0(x), \qquad t \in [0, 1]. \tag{7}\]

<p>Flow matching then trains a model \(\mathbf{v}_\theta(x, t)\) to approximate the target velocity field \(\mathbf{v}(x, t)\) along the path.</p>

<h3 id="22-discrete-diffusion-and-discrete-flow-matching">2.2 Discrete diffusion and discrete flow matching</h3>

<p>To transfer the generative capabilities of diffusion and flow matching to discrete domains, researchers have developed <em>discrete diffusion models</em> and <em>discrete flow matching</em> methods.</p>

<p><strong>Discrete diffusion (D3PM).</strong> In discrete spaces, Gaussian noise is not directly applicable. D3PM instead defines the forward process through Markov transition matrices \(\{\mathbf{Q}_t\}_{t=1}^{T}\) <a href="#ref-3">[3]</a>:</p>

\[[\mathbf{Q}_t]_{ij} = q(x_t = j \mid x_{t-1} = i), \tag{8}\]

\[q(\mathbf{x}_t \mid \mathbf{x}_{t-1}) = \mathrm{Cat}\big(\mathbf{x}_t;\ \mathbf{p} = \mathbf{x}_{t-1}\mathbf{Q}_t\big), \tag{9}\]

\[q(\mathbf{x}_t \mid \mathbf{x}_0) = \mathrm{Cat}\big(\mathbf{x}_t;\ \mathbf{p} = \mathbf{x}_0 \bar{\mathbf{Q}}_t\big), \qquad \bar{\mathbf{Q}}_t := \mathbf{Q}_1 \mathbf{Q}_2 \cdots \mathbf{Q}_t. \tag{10}\]

<p>A widely used choice is <em>absorbing-state diffusion</em>, where noise corresponds to replacing tokens by a <code class="language-plaintext highlighter-rouge">[MASK]</code> symbol:</p>

\[\mathbf{Q}_t = (1-\beta_t)\,\mathbf{I} + \beta_t\, \mathbf{e}_{\text{mask}} \mathbf{1}^\top. \tag{11}\]

<p><strong>Discrete flow matching.</strong> A direct velocity in token space is ill-defined due to discrete jumps. Discrete flow matching therefore defines a <em>probability-space</em> transition rate (an “ODE” in distribution space) <a href="#ref-4">[4]</a>, <a href="#ref-5">[5]</a>. For the \(i\)-th token, a typical form is</p>

\[\nu_t^i(x^i, x_t) = \frac{\dot\kappa_t}{1-\kappa_t}\Big[p_{0 \mid t}(x^i \mid x_t) - \delta_{x_t}(x^i)\Big], \tag{12}\]

<p>where \(\nu_t^i \in \mathbb{R}^{\lvert \mathcal{V} \rvert}\) is a probability transition-rate tensor indicating how quickly the \(i\)-th token transitions to other vocabulary elements. Equivalently,</p>

\[\nu_t^i(x, x_t) = \underbrace{\frac{\dot\kappa_t}{1-\kappa_t}}_{\text{time coefficient}} \Big[\, \underbrace{p_{0 \mid t}(x \mid x_t)}_{\text{inflow (destination)}} - \underbrace{\delta_{x_t}(x)}_{\text{outflow (source)}} \,\Big]. \tag{13}\]

<p>After evolving the categorical distribution for a small time step \(h\), one samples the next token:</p>

\[X_{t+h}^i \sim \mathrm{Categorical}\Big(\delta_{X_t^i}(\cdot) + h\, \nu_t^i(\cdot, X_t)\Big). \tag{14}\]

<p>Therefore, we train the model to output \(p_\theta(x \mid x_t)\) to predict \(p_{0 \mid t}(x \mid x_t)\), so that we can get the velocity.</p>

<h2 id="3-why-llada-can-be-viewed-as-a-flow-matching-model">3. Why LLaDA can be viewed as a flow matching model</h2>

<p>We compare continuous flow matching (CFM) and discrete flow matching (DFM).</p>

<p><strong>CFM intuition.</strong> In CFM, in training time, one may view the instantaneous velocity as the average velocity over the full path from noise to data. For example, under a linear interpolation \(x_t = (1-t)\,x_1 + t\,x_0\), the velocity is constant and equals \(v_t = x_0 - x_1\) as the ground-truth.</p>

<figure class="fig-row">
  <img src="/assets/blog/llada-dfm/continuousFM.png" alt="Left: flow matching in a continuous semantic space" width="1400" height="901" loading="lazy" />
  <img src="/assets/blog/llada-dfm/DFM_tk.png" alt="Middle: token-wise dynamics between [MASK] and the ground-truth token" width="1400" height="992" loading="lazy" />
  <img src="/assets/blog/llada-dfm/DFM_sq.png" alt="Right: sequence-wise trajectory across decoding states" width="1400" height="931" loading="lazy" />
  <figcaption><strong>Figure 1.</strong> All three panels illustrate the training-time dynamics. <em>Left:</em> flow matching in a continuous semantic space, where \(x\) can be decoded smoothly by following the average velocity. <em>Middle:</em> token-wise dynamics, where the two horizontal dashed lines represent <code>[MASK]</code> and the ground-truth token; as more context is decoded during training, the velocity (shown as the slope) increases, so after multiplying by the same coefficient \(h\), the probability mass transferred toward the ground truth becomes larger, eventually making the sampled token correct. <em>Right:</em> sequence-wise trajectory, where each horizontal dashed line represents a decoding state; because sampling forces the sequence back onto these lines, the red short vertical segments appear as offsets, making the induced flow discontinuous.</figcaption>
</figure>

<p><strong>DFM intuition.</strong> In DFM, the instantaneous velocity at time \(t\) is better interpreted as the average velocity over the <em>remaining</em> process from the current partially noised state to the ground truth. For each token, the transition rate is</p>

\[\nu_\tau^i(x, X_\tau) = \frac{\dot\kappa_\tau}{1-\kappa_\tau}\Big[p_{0 \mid \tau}(x \mid X_\tau) - \delta_{X_\tau}(x)\Big], \tag{15}\]

<p>where \(x\) can be any token ranging over the vocabulary. Here \(X_1\) is a fully masked sequence (all tokens are <code class="language-plaintext highlighter-rouge">[MASK]</code>) with the same length as \(X_0\), and \(p_{0 \mid \tau}(x \mid X_\tau)\) is the posterior distribution over clean tokens given a partially masked sequence.</p>

<p>Using the full-path average transition rate at \(\tau = 1\) is undesirable because all training examples share the same start point (a fully masked \(X_1\)), which makes the learning signal ambiguous and can hinder convergence.</p>

<p>More fundamentally, because discrete sampling alternates between (i) evolving a distribution in probability space and (ii) resampling a discrete token, the induced trajectory is not a single straight line in probability space but a sequence of segments whose behavior depends on the current context. Consequently, using a full-path average as a ground-truth instantaneous rate can introduce systematic bias due to the repeated resampling offsets. This motivates using the remaining-path average velocity as the instantaneous target.</p>

<p><strong>Loss reduction (constant \(\kappa\) simplification).</strong> For exposition, suppose \(\kappa\) is constant so the time coefficient can be absorbed. Then the model predicts</p>

\[\nu_{\theta,\tau}^i(x, X_\tau) = p_\theta(x \mid X_\tau) - \delta_{X_\tau^i}(x), \tag{16}\]

<p>and we match it to the target</p>

\[\bar\nu_\tau^i(x, X_\tau) = p_{0 \mid \tau}(x \mid X_\tau) - \delta_{X_\tau^i}(x). \tag{17}\]

<p>Thus a generic rate-matching loss becomes</p>

\[\begin{aligned}
\ell_\theta(\tau, X_\tau) &amp;= \mathrm{LOSS}\Big(\nu_{\theta,\tau}^i(x, X_\tau) - \bar\nu_\tau^i(x, X_\tau)\Big) \\
&amp;= \mathrm{LOSS}\Big(\big[p_\theta(x \mid X_\tau) - \delta_{X_\tau^i}(x)\big] - \big[p_{0 \mid \tau}(x \mid X_\tau) - \delta_{X_\tau^i}(x)\big]\Big) \\
&amp;= \mathrm{LOSS}\Big(p_\theta(x \mid X_\tau),\ p_{0 \mid \tau}(x \mid X_\tau)\Big).
\end{aligned}
\tag{18–20}\]

<p>When LOSS is instantiated as cross-entropy, this yields the LLaDA objective. In this sense, LLaDA can be interpreted as learning the remaining-path average transition rate, i.e., a discrete flow matching model.</p>

<h2 id="references">References</h2>

<ol class="refs">
  <li id="ref-1">Jonathan Ho, Ajay Jain, and Pieter Abbeel. <a href="https://arxiv.org/abs/2006.11239">Denoising diffusion probabilistic models</a>. In <em>Advances in Neural Information Processing Systems (NeurIPS)</em>, volume 33, pages 6840–6851, 2020.</li>
  <li id="ref-2">Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. <a href="https://arxiv.org/abs/2210.02747">Flow matching for generative modeling</a>. In <em>International Conference on Learning Representations (ICLR)</em>, 2023.</li>
  <li id="ref-3">Jacob Austin, Daniel D. Johnson, Jonathan Ho, Daniel Tarlow, and Rianne van den Berg. <a href="https://arxiv.org/abs/2107.03006">Structured denoising diffusion models in discrete state-spaces</a>. In <em>Advances in Neural Information Processing Systems (NeurIPS)</em>, volume 34, pages 17981–17993, 2021.</li>
  <li id="ref-4">Itai Gat, Tal Remez, Neta Shaul, Felix Kreuk, Ricky T. Q. Chen, Gabriel Synnaeve, Yossi Adi, and Yaron Lipman. <a href="https://arxiv.org/abs/2407.15595">Discrete flow matching</a>. In <em>Advances in Neural Information Processing Systems (NeurIPS)</em>, 2024.</li>
  <li id="ref-5">Andrew Campbell, Jason Yim, Regina Barzilay, Tom Rainforth, and Tommi Jaakkola. <a href="https://arxiv.org/abs/2402.04997">Generative flows on discrete state-spaces: Enabling multimodal flows with applications to protein co-design</a>. In <em>International Conference on Machine Learning (ICML)</em>, 2024.</li>
  <li id="ref-6">Shen Nie, Fengqi Zhu, Zebin You, Xiaolu Zhang, Jingyang Ou, Jun Hu, Jun Zhou, Yankai Lin, Ji-Rong Wen, and Chongxuan Li. <a href="https://arxiv.org/abs/2502.09992">Large language diffusion models</a>. <em>arXiv preprint arXiv:2502.09992</em>, 2025.</li>
</ol>]]></content><author><name>Feiyu (Felix) Qu</name></author><category term="diffusion-lm" /><category term="flow-matching" /><category term="llada" /><summary type="html"><![CDATA[Can models guided by discrete flow matching achieve better performance than diffusion language models? A theoretical look shows that LLaDA is, in fact, already equivalent to a discrete flow matching model.]]></summary></entry><entry><title type="html">Hello, world</title><link href="https://qufy6.github.io/blog/2026/10/10/hello-world/" rel="alternate" type="text/html" title="Hello, world" /><published>2026-10-10T12:00:00-04:00</published><updated>2026-10-10T12:00:00-04:00</updated><id>https://qufy6.github.io/blog/2026/10/10/hello-world</id><content type="html" xml:base="https://qufy6.github.io/blog/2026/10/10/hello-world/"><![CDATA[<p>Welcome to my corner of the internet. I’ll use this blog for notes on research, such as diffusion language models, latent reasoning, LLM agents and multi-agent systems, and reinforcement learning, and now and then for things from outside the lab.</p>

<p>The site itself is hand-written HTML, CSS and JavaScript: frosted and liquid glass, an agent network drifting in the background, and a little globe of places I’ve been. Press <kbd>⌘K</kbd> (or <kbd>/</kbd>) anywhere to open the command palette.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">print</span><span class="p">(</span><span class="s">"hello, world"</span><span class="p">)</span>
</code></pre></div></div>

<p>More soon.</p>]]></content><author><name>Feiyu (Felix) Qu</name></author><category term="meta" /><summary type="html"><![CDATA[Welcome to my corner of the internet. I’ll use this blog for notes on research, such as diffusion language models, latent reasoning, LLM agents and multi-agent systems, and reinforcement learning, and now and then for things from outside the lab.]]></summary></entry></feed>