19 min read

Discrete flow matching


  • V\mathcal{V} vocabulary set; ∣V∣|\mathcal{V}| is the vocabulary size
  • S=VS\mathcal{S} = \mathcal{V}^S space of all possible sequences of length SS over the vocabulary
  • x=x1…xS\mathbf{x} = x^1 \dots x^S sequence of SS tokens, where each token xix^i takes values in V\mathcal{V}
  • ev\mathbf{e}_v one-hot vector in R∣V∣\mathbb{R}^{|\mathcal{V}|} for token v∈Vv \in \mathcal{V}
  • mm mask token
  • x≠i\mathbf{x}^{\neq i} sub-sequence of x\mathbf{x} at all positions except ii
  • Δk\Delta_k for k∈Nk \in \mathbb{N}, Δk={π∈R+k:∑ℓ=1kπℓ=1}\Delta_k=\{\pi\in\mathbb{R}_+^k:\sum_{\ell=1}^{k}\pi_\ell=1\} is the probability simplex
  • Cat\text{Cat} categorical distribution: x∼Cat(p)x \sim \text{Cat}(\mathbf{p}) means P(x=v)=pv\mathbb{P}(x = v) = \mathbf{p}_v, for a probability vector p∈Δ∣V∣\mathbf{p} \in \Delta_{|\mathcal{V}|}
  • punifp_{\text{unif}} uniform distribution: punif(v)=1∣V∣p_{\text{unif}}(v) = \frac{1}{|\mathcal{V}|}
  • Convention: t=0t=0: noisy data; t=1t=1: clean data.
  • p0p_0 source distribution (mask or uniform)
  • p1p_1 target (data) distribution
  • ptp_t marginal distribution at time tt; the probability path interpolating between the source p0p_0 and the target p1p_1 distributions
  • z\mathbf{z} conditioning variable, of law π(z)\pi(\mathbf{z})
  • pt(x∣z)=∏j=1Sqt(xj∣zj)p_t(\mathbf{x} | \mathbf{z}) = \prod_{j=1}^S q_t(x^j | z^j) factorized conditional probability path given the conditioning variable z\mathbf{z}
  • qt(x∣z)q_t(x | z) token-wise conditional distribution given z\mathbf{z}
  • ut(x)yu_t(\mathbf{x})_{\mathbf{y}} velocity: the instantaneous rate at which the sequence transitions from x\mathbf{x} to y\mathbf{y} at time tt
  • uti(x)vu_t^i(\mathbf{x})_v token-wise velocity at position ii: the instantaneous rate at which the ii-th token of x\mathbf{x} transitions to vv at time tt
  • ut(x∣z)yu_t(\mathbf{x} | \mathbf{z})_{\mathbf{y}} conditional velocity field given z\mathbf{z}
  • uθ,ti(x)vu_{\theta,t}^i(\mathbf{x})_v learned velocity field parameterized by θ\theta
  • Pθ,t(X1i∣xt)P_{\theta,t}(X_1^i | \mathbf{x}_t) learned denoiser: at coordinate jj, probability that the ii-th token at time 11 is ej\mathbf{e}_j, given current sequence xt\mathbf{x}_t

Flow matching and diffusion have emerged as the state-of-the-art techniques for generation of continuous data modalities, in particular images, audio and video [6, 7]. Their strong generation performance, training stability and flexibility motivated their extension to discrete data, including texts, graphs, or molecule sequences [1, 2, 5]. This blog post is an introduction to flow matching for discrete data. A second part TODO link is dedicated to discrete diffusion.

The first section is an introduction to discrete data generation, and discrete flow matching is introduced in Section 2.

Generating discrete data

Discrete data

Autoregressive generative models have being especially successful for generation of sequences of discrete elements. For instance, language models generate sequences of tokens (words or subwords) from a predefined discrete set (the vocabulary).

More precisely, in this blog post, we present flow matching/diffusion for sequences of discrete data:

  • sequences x=x1…xS\mathbf{x} = x^1 \dots x^S of length S∈NS \in \mathbb{N},
  • where each element xix^i belongs to a predefined discrete/finite set called the vocabulary V\mathcal{V}: xi∈Vx^i \in \mathcal{V}.
Sequence x = x1x2x3x4 of length 4
x1A
x2A
x3B
x4B
Vocabulary of 3 elements 𝒱 = {A, B, m}
 A
 B
 m

Figure 1: A toy vocabulary V\mathcal{V} of 3 elements: V={A,B,m}\mathcal{V} = \{A, B, m \} and an example sequence of length 4: each element xix^i of the sequence belongs to V\mathcal{V}: x1,x2,x3,x4∈Vx^1, x^2, x^3, x^4 \in \mathcal{V}.

Elements of the vocabulary are called tokens. For example, for text data, tokens could be the letters: V={a,b,c,…,z}\mathcal{V} = \{a, b, c, \dots, z \}, while DNA sequences would correspond to V={A,T,C,G}\mathcal{V}=\{A, T, C, G\}. In the vocabulary, a special token can be added, the mask token mm.

Discrete data generation process

Discrete generative modelling on Sudoku. The goal is to generate valid Sudoku grids, which are 9×99 \times 9 grids filled with numbers from 11 to 99, such that each number appears exactly once in each row, column. The vocabulary is the set of numbers from 11 to 99: V={1,2,…,9,m}\mathcal{V} = \{1, 2, \ldots, 9, m\}, and the sequence length is number of squares to fill S=9×9=81S= 9 \times 9 = 81.

Discrete diffusion/flow matching on Sudoku. Discrete flow matching starts from a fully masked grid: each square is initially filled with the mask token mm. The model then iteratively fills this grid with non-mask tokens {1,2,…,9}\{1, 2, \ldots, 9\}. For example, one can iteratively unmask the grid one square after one square, and finally reach a filled Sudoku grid.

QBE: todo do a sort of gif?

Generating a Sudoku grid

t = 0.00
Diffusion
random order
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
81Masked
0Generated
Autoregressive
left to right
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
81Masked
0Generated
Masked [M]
Generated

Figure 2: Visualization of the sampling process for discrete flow matching: a fully masked Sudoku 9×99 \times9 grid is transformed into a valid 9×99 \times9 Sudoku grid.

Section 2 provides the details on to generate discrete data with discrete flow matching.

Discrete flow matching

Transporting distributions

Discrete flow matching iteratively transforms fully masked samples/images into samples/images from the target distribution. At the distribution level, discrete flow matching can be seen as a transport of a simple source probability distribution p0p_0 (e.g., x0∼p0x_0 \sim p_0 fully masked) to a target distribution p1p_1, the data distribution we want to generate.

QBE: introduce later?

p0ptp1
x0 ∼ p0
mmmm
mmmm
mmmm
mmmm
xt ∼ pt
mAmm
Ammm
mBmm
mAAB
x1 ∼ p1
AAAB
ABBB
BBBB
AAAB

Figure 3: The transport from the source p0p_0 to the target p1p_1, shown both as distributions over the whole sequence space S=VS\mathcal{S} = \mathcal{V}^S and as samples xt∼pt\mathbf{x}_t \sim p_t drawn below each distribution. Each bar is one sequence x∈S\mathbf{x} \in \mathcal{S}, ordered by number of mask tokens, so that the fully masked sequence mmmmm m m m is right-most. At t=0t=0 all the mass sits on the Dirac δm…m\delta_{m \ldots m}; as tt grows that mass decreases and spreads over partially unmasked sequences, until it vanishes at t=1t=1 and only p1p_1 remains. p1p_1 is the distribution where token BB is not allowed to be placed before a AA in the sequence. Bar heights use a square-root scale, so that the source Dirac and the much flatter intermediate distributions stay legible on the same axis.

The source distribution is typically chosen to be the mask distribution (p0=δm…mp_0 = \delta_{m\ldots m}): all tokens in the starting sequence are equal to the mask token mm; δ\delta is the Dirac delta distribution.

QBE: schema transport distributions?

QBE: todo footnote uniform - The uniform distribution (p0=punifp_0 = p_{\text{unif}}): All tokens in the starting sequence are sampled uniformly across the vocabulary V\mathcal{V}.

QBE: decide what to do with this figure. Not sure it is cristal clear.

Flow matching: from continuous-space discrete-space data

Reminder on flow matching for continuous data

See the former blog post for a comprehensive explanation. In continuous-space flow matching, generated samples are obtained by solving the following Ordinary Differential Equation (ODE)

{x(0)=x0∂tx(t)=ut(x(t)),∀t∈[0,1]\begin{equation} \htmlData{equation-label=eq:flow-ode}{\htmlId{eq:flow-ode}{}} \begin{cases} x(0) = x_0 \\ \partial_t x(t) = u_t(x(t)), \quad \forall t \in [0,1] \end{cases} \end{equation}

which is driven by the so-called velocity field u:Rd×[0,1]→Rdu: \mathbb{R}^d \times [0, 1] \to \mathbb{R}^d.

From continuous-space to discrete-space

QBE: comparison Algorithm Euler continuous vs discrete? + pixel vs sequence

QBE: discussion “shape” of u

QBE todo rephrase. As solving an ODE on a discrete space is not possible (since at each time tt, the current state is xtx_t should be a discrete sequence), the generation process in discrete flow matching is different.

It is defined as

xt+h∼Cat(ext+hut(xt))+o(h),\begin{equation} \htmlData{equation-label=eq:euler-sampling}{\htmlId{eq:euler-sampling}{}} \mathbf{x}_{t + h} \sim \text{Cat}\left(\mathbf{e}_{\mathbf{x}_t} + h u_t(\mathbf{x}_t)\right ) + o(h), \end{equation}

where u:S×[0,1]→RSu : \mathcal{S} \times [0, 1] \to \mathbb{R}^S is the velocity field, ex∈R∣S∣\mathbf{e}_{\mathbf{x}} \in \mathbb{R}^{|\mathcal{S}|} is the one-hot vector corresponding to state x∈S\mathbf{x} \in \mathcal{S}, and Cat\text{Cat} denotes the categorical distribution. The velocity ut(x)u_t(\mathbf{x}) can be seen as the instantaneous rate at which the random variable XtX_t transitions from state x\mathbf{x} to state y\mathbf{y} at time tt. Below is a direct side by side analogy between the continuous and discrete flow matching generation processes.

Algorithm 1 — Continuous Flow Matching

Input: Initial image x0∈Rdx_0 \in \mathbb{R}^d, velocity utu_t, step size hh.

  1. For k=0,…,N−1k=0,\ldots,N-1, set t=kht=kh and update xk+1←xk+h ut(xk)x_{k+1} \leftarrow x_k + h\,u_t(x_k).
  2. Return the generated image xNx_N.
Algorithm 2 — Discrete Flow Matching

Input: Initial sequence x0∈S=VS\mathbf{x}_0 \in \mathcal{S}=\mathcal{V}^S, velocity utu_t, step size hh.

  1. For k=0,…,N−1k=0,\ldots,N-1, set t=kht=kh and sample xk+1∼Cat ⁣(exk+h ut(xk))\mathbf{x}_{k+1} \sim \mathrm{Cat}\!\left(\mathbf{e}_{\mathbf{x}_k}+h\,u_t(\mathbf{x}_k)\right).
  2. Return the generated sequence xN\mathbf{x}_N.
Formal definition of the velocity utu_t.
Definition 1 (velocity utu_t).

Let u:S×[0,1]→RSu : \mathcal{S} \times [0, 1] \to \mathbb{R}^S, let (Xt)t∈[0,1](X_t)_{t\in[0,1]} be random variables taking values in the space of sequences S\mathcal{S}, and having laws (pt)t∈[0,1](p_t)_{t \in [0, 1]}. Denote ut:=u(⋅,t)u_t := u(\cdot, t). In the discrete case, we say that uu generates the probability path (pt)t∈[0,1](p_t)_{t \in [0, 1]} if for every sequences x,y∈S\mathbf{x}, \mathbf{y} \in \mathcal{S},

P(Xt+h=y∣Xt=x)=I(x=y)+hut(x)y+o(h)\begin{equation} \htmlData{equation-label=eq:prob-velocity}{\htmlId{eq:prob-velocity}{}} \mathbb{P}(X_{t+h} = \mathbf{y} | X_t = \mathbf{x}) = \mathbb{I}(\mathbf{x} = \mathbf{y}) + h u_{t}(\mathbf{x})_{\mathbf{y}} + o(h) \end{equation}

If we index the state space as S={y1,…,y∣S∣}\mathcal{S} = \{\mathbf{y}_1, \dots, \mathbf{y}_{|\mathcal{S}|}\} and choose kk such that yk=x\mathbf{y}_k = \mathbf{x} (the current state), then the full transition-probability vector reads

P(Xt+h=⋅∣Xt=x)⏟∈R∣S∣=[hut(x)y1⋮hut(x)yk−11+hut(x)ykhut(x)yk+1⋮hut(x)y∣S∣]+o(h).\begin{equation} \htmlData{equation-label=eq:transition-vector}{\htmlId{eq:transition-vector}{}} \underbrace{\mathbb{P}(X_{t+h} = \cdot | X_t=\mathbf{x})}_{\in \mathbb{R}^{|\mathcal{S}|}} = \begin{bmatrix} h u_t(\mathbf{x})_{\mathbf{y}_1} \\ \vdots \\ h u_t(\mathbf{x})_{\mathbf{y}_{k-1}} \\ 1 + h u_t(\mathbf{x})_{\mathbf{y}_k} \\ h u_t(\mathbf{x})_{\mathbf{y}_{k+1}} \\ \vdots \\ h u_t(\mathbf{x})_{\mathbf{y}_{|\mathcal{S}|}} \end{bmatrix} + o(h). \end{equation}

These two equations mean that as tt increases to t+ht+h, the variable XtX_t stays in its current state x\mathbf{x} with probability 1+hut(x)x1 + h u_t(\mathbf{x})_{\mathbf{x}}, or moves to any other state y≠x\mathbf{y} \neq \mathbf{x} with probability hut(x)yh u_t(\mathbf{x})_{\mathbf{y}}.

A fundamental point is that unlike continuous FM, where sampling is deterministic once x0x_0 has been sampled from p0p_0, sampling in discrete flow matching is inherently stochastic at each step. This explains why we are allowed to take p0p_0 equal to a Dirac δm…m\delta_{m\ldots m} and still produce different final outputs, which would not be possible with a deterministic sampling.

Proposition 2 (Constraints on uu).

The velocity uu must preserve probability mass: for Eq. (?) to define a valid probability, for every t∈[0,1]t\in [0, 1] utu_t must satisfy:

  1. Positivity: ut(x)y≥0u_t(\mathbf{x})_{\mathbf{y}} \ge 0 for all y≠x\mathbf{y} \neq \mathbf{x}.
  2. Normalization: ∑y∈Sut(x)y=0\sum_{\mathbf{y} \in \mathcal{S}} u_t(\mathbf{x})_{\mathbf{y}} = 0 for all x∈S\mathbf{x} \in \mathcal{S} (and so ut(x)x≤0u_t(\mathbf{x})_{\mathbf{x}} \le 0).
Justification

Positivity guarantees nonnegative transition probabilities:

P(Xt+h=y∣Xt=x)=h ut(x)y+o(h)≥0,y≠x.\begin{equation} \htmlData{equation-label=eq:velocity-positivity-proof}{\htmlId{eq:velocity-positivity-proof}{}} \mathbb{P}(X_{t+h}=\mathbf{y}| X_t=\mathbf{x}) = h\,u_t(\mathbf{x})_{\mathbf{y}} + o(h) \ge 0, \qquad \mathbf{y}\neq\mathbf{x}. \end{equation}

Normalization guarantees total mass conservation:

∑y∈SP(Xt+h=y∣Xt=x)=1+h∑y∈Sut(x)y+o(h)=1+o(h).\begin{equation} \htmlData{equation-label=eq:velocity-normalization-proof}{\htmlId{eq:velocity-normalization-proof}{}} \sum_{\mathbf{y}\in\mathcal{S}} \mathbb{P}(X_{t+h}=\mathbf{y}| X_t=\mathbf{x}) = 1 + h\sum_{\mathbf{y}\in\mathcal{S}}u_t(\mathbf{x})_{\mathbf{y}} + o(h) = 1 + o(h). \end{equation}
Fundamental equation linking ptp_t and utu_t: Kolmogorov equation

In continuous flow matching, we have the guarantee that a velocity field utu_t generates a probability path (pt)t∈[0,1](p_t)_{t \in [0, 1]} if the pair (pt,ut)(p_t, u_t) satisfies the continuity equation ∂tpt+∇⋅(utpt)=0\partial_t p_t + \nabla \cdot (u_t p_t) = 0. The equivalent result for discrete data relies on the so-called Kolmogorov Equation:

Proposition 3 (Kolmogorov equation).

The velocity utu_t generates (pt)(p_t) in the sense of Eq. (?) if and only if the pair (ut,pt)(u_t, p_t) satisfies the Kolmogorov equation:

∀y∈S,ddtpt(y)=∑x∈Sut(x)y pt(x).\begin{equation} \htmlData{equation-label=eq:kolmogorov-equation}{\htmlId{eq:kolmogorov-equation}{}} \forall \mathbf{y} \in \mathcal{S}, \quad \frac{\mathrm{d}}{\mathrm{d}t} p_t(\mathbf{y}) = \sum_{\mathbf{x} \in \mathcal{S}} u_{t}(\mathbf{x})_{\mathbf{y}} \, p_t(\mathbf{x}) . \end{equation}
Proof

We can derive this directly by expanding the marginal probability at t+ht+h using the law of total probability and our velocity definition:

pt+h(y):=P(Xt+h=y)=∑x∈SP(Xt+h=y∣Xt=x) P(Xt=x)=∑x∈S(I(y=x)+h ut(x)y+o(h))pt(x)=pt(y)+h∑x∈Sut(x)y pt(x)+o(h)\begin{align} p_{t+h}(\mathbf{y}) &:= \mathbb{P}(X_{t+h} = \mathbf{y}) \notag \\ &= \sum_{\mathbf{x} \in \mathcal{S}} \mathbb{P}(X_{t+h} = \mathbf{y} | X_t = \mathbf{x})\, \mathbb{P}(X_t = \mathbf{x}) \htmlData{equation-label=eq:kolmogorov-proof-2}{\htmlId{eq:kolmogorov-proof-2}{}} \\ &= \sum_{\mathbf{x} \in \mathcal{S}} \left(\mathbb{I}(\mathbf{y} = \mathbf{x}) + h\,u_t(\mathbf{x})_{\mathbf{y}} + o(h)\right) p_t(\mathbf{x}) \htmlData{equation-label=eq:kolmogorov-proof-3}{\htmlId{eq:kolmogorov-proof-3}{}} \\ &= p_t(\mathbf{y}) + h \sum_{\mathbf{x} \in \mathcal{S}} u_t(\mathbf{x})_{\mathbf{y}}\, p_t(\mathbf{x}) + o(h) \htmlData{equation-label=eq:kolmogorov-proof-4}{\htmlId{eq:kolmogorov-proof-4}{}} \end{align}

Rearranging the terms and taking the limit as h→0h \to 0 gives the desired result.

For the reverse implication (if the equation holds, then uu generates ptp_t), let p~t\tilde{p}_t denote the probability path that the velocity field utu_t generates, starting from the initial distribution p~0=p0\tilde{p}_0 = p_0. By the forward implication proven above, p~t\tilde{p}_t satisfies the Kolmogorov equation. By hypothesis, the given probability path ptp_t also satisfies this exact same linear ordinary differential equation (ODE). Because both ptp_t and p~t\tilde{p}_t are solutions to the same first-order linear ODEs and share the identical initial condition (p0=p~0p_0 = \tilde{p}_0), the Picard-Lindelöf uniqueness theorem guarantees that pt(y)=p~t(y)p_t(\mathbf{y}) = \tilde{p}_t(\mathbf{y}) for all times tt and all states y∈S\mathbf{y} \in \mathcal{S}. Therefore, the vector field utu_t generates the probability path ptp_t.

Learning probability velocities taking values in the full sequence space S=VS\mathcal{S}=\mathcal{V}^S is cumbersome, as the cardinality of the latter is ∣V∣S|\mathcal{V}|^S, e.g. 108110^{81} for the sudoku example! To make computations tractable, discrete flow matching makes a factorization assumption: each transition is applied to every token of the sequence independently, according to a token-wise velocity uti:S×[0,1]→R∣V∣u_t^i : \mathcal{S} \times [0, 1] \to \mathbb{R}^{|\mathcal{V}|}. The quantity uti(xt)vu_t^i(\mathbf{x}_t)_v then predicts the rate of probability change from the current token xtix_t^i toward the token vv, that still depends on the whole noisy sequence xt\mathbf{x}_t. The proposition in the toogle formalizes this assumption and its consequences.

Proposition
Proposition 4 (Factorized velocity).

Let (Xt)(X_t) be random variables of laws ptp_t, and assume that the transition probabilities factorize over tokens, namely for x,y∈S\mathbf{x}, \mathbf{y} \in \mathcal{S}:

P(Xt+h=y∣Xt=x):=P(Xt+h1=y1,Xt+h2=y2,…,Xt+hS=yS∣Xt=x)=∏i=1SP(Xt+hi=yi∣Xt=x)\begin{align} \mathbb{P}(X_{t+h} = \mathbf{y} | X_t = \mathbf{x}) &:= \mathbb{P}(X_{t+h}^1 = y_1, X_{t+h}^2 = y_2, \dots, X_{t+h}^S = y_S | X_t = \mathbf{x}) \htmlData{equation-label=eq:factorized-path-1}{\htmlId{eq:factorized-path-1}{}} \\ &= \prod_{i=1}^S \mathbb{P}(X_{t+h}^i = y^i | X_t = \mathbf{x}) \htmlData{equation-label=eq:factorized-path-2}{\htmlId{eq:factorized-path-2}{}} \end{align}

Suppose that there is a velocity utu_t generating (pt)(p_t). Then, the velocity writes as a sum of SS tokenwise probability velocities utiu_t^i, from S\mathcal{S} to V\mathcal{V}:

ut(x)y=∑i=1SI(y≠i=x≠i)uti(x)yi\begin{equation} \htmlData{equation-label=eq:factorized-velocity}{\htmlId{eq:factorized-velocity}{}} u_t(\mathbf{x})_{\mathbf{y}} = \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t^i(\mathbf{x})_{y^i} \end{equation}

where x≠i∈VS−1\mathbf{x}^{\neq i} \in \mathcal{V}^{S-1} denotes the sequence except x\mathbf{x} except its ii-th element xix^i.

Proof

We first formally define the token-wise velocity utiu_t^i:

P(Xt+hi=yi∣Xt=x)=∑z∈SP(Xt+h=z∣Xt=x)I(zi=yi)=∑z∈S[I(x=z)+hut(x)z+o(h)]I(zi=yi)=I(xi=yi)+h∑z∈Sut(x)zI(zi=yi)⏟=:uti(x)yi+o(h)=I(xi=yi)+huti(x)yi+o(h).\begin{align} \mathbb{P}(X_{t+h}^i = y^i | X_t = \mathbf{x}) &= \sum_{\mathbf{z} \in \mathcal{S}} \mathbb{P}(X_{t+h} = \mathbf{z} | X_t = \mathbf{x}) \mathbb{I}(z^i = y^i) \\ &= \sum_{\mathbf{z} \in \mathcal{S}} \left[\mathbb{I}(\mathbf{x} = \mathbf{z}) + h u_t(\mathbf{x})_{\mathbf{z}} + o(h)\right] \mathbb{I}(z^i = y^i) \\ &= \mathbb{I}(x^i = y^i) + h \underbrace{\sum_{\mathbf{z} \in \mathcal{S}} u_t(\mathbf{x})_{\mathbf{z}}\mathbb{I}(z^i = y^i)}_{=: u_t^i(\mathbf{x})_{y^i}} + o(h) \\ &= \mathbb{I}(x^i = y^i) + h u_t^i(\mathbf{x})_{y^i} + o(h). \htmlData{equation-label=eq:token-transition}{\htmlId{eq:token-transition}{}} \end{align}

Substituting this into our factorized joint probability, we get:

P(Xt+h=y∣Xt=x)=∏i=1S[I(yi=xi)+huti(x)yi+o(h)]=∏i=1SI(yi=xi)+h∑i=1S[I(y≠i=x≠i)uti(x)yi]+o(h)=I(y=x)+h∑i=1SI(y≠i=x≠i)uti(x)yi+o(h)\begin{align} \mathbb{P}(X_{t+h} = \mathbf{y} | X_t = \mathbf{x}) &= \prod_{i=1}^S \left[ \mathbb{I}(y^i = x^i) + h u_t^i(\mathbf{x})_{y^i} + o(h) \right] \\ &\hspace{-8em}{}= \prod_{i=1}^S \mathbb{I}(y^i = x^i) + h \sum_{i=1}^S \left[ \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t^i(\mathbf{x})_{y^i} \right] + o(h) \\ &\hspace{-8em}{}= \mathbb{I}(\mathbf{y} = \mathbf{x}) + h \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t^i(\mathbf{x})_{y^i} + o(h) \htmlData{equation-label=eq:factorized-path-2-3}{\htmlId{eq:factorized-path-2-3}{}} \end{align}

where I(y≠i=x≠i)\mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) equals 1 if y\mathbf{y} and x\mathbf{x} differ at most at position ii, and we used ∏i=1SI(yi=xi)=I(y=x)\prod_{i=1}^S \mathbb{I}(y^i = x^i) = \mathbb{I}(\mathbf{y} = \mathbf{x}).

By comparing this result with the definition of the velocity (Eq. (?)), we directly identify:

ut(x)y=∑i=1SI(y≠i=x≠i)uti(x)yi\begin{equation} \htmlData{equation-label=eq:factorized-velocity-2}{\htmlId{eq:factorized-velocity-2}{}} u_t(\mathbf{x})_{\mathbf{y}} = \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t^i(\mathbf{x})_{y^i} \end{equation}
Example 5.

To understand Eq. (?), take the vocabulary V={A,B}\mathcal{V}=\{A,B\}, sequence length S=3S=3, and current sequence x=ABA\mathbf{x}=ABA. We represent the vector ut(x)u_t(\mathbf{x}) in R8\mathbb{R}^8. From Eq. (?), the sequence can only transition to 4 possible values (its current state, or state differing by a single token), and the velocity writes as:

ABA

State y\mathbf{y}Velocity ut(x)yu_t(\mathbf{x})_{\mathbf{y}}
AAAut2(x)Au_t^{\color{#dc2626}{2}}(\mathbf{x})_{\color{#dc2626}{A}}
AAB00
ABAut1(x)A+ut2(x)B+ut3(x)Au_t^{\color{#15803d}{1}}(\mathbf{x})_{\color{#15803d}{A}}+u_t^{\color{#dc2626}{2}}(\mathbf{x})_{\color{#dc2626}{B}}+u_t^{\color{#2563eb}{3}}(\mathbf{x})_{\color{#2563eb}{A}}
ABBut3(x)Bu_t^{\color{#2563eb}{3}}(\mathbf{x})_{\color{#2563eb}{B}}
BAA00
BAB00
BBAut1(x)Bu_t^{\color{#15803d}{1}}(\mathbf{x})_{\color{#15803d}{B}}
BBB00

While utu_t outputs a vector in R8\mathbb{R}^8, ut1,ut2u_t^1, u_t^2 and ut3u_t^3 output vectors in R2\mathbb{R}^2 (as ∣V∣=2|\mathcal{V}| = 2).

This modeling assumption has several important consequences:

  • for infinitesimally small time steps, a sequence x\mathbf{x} can only transition to states y\mathbf{y} differing by at most one token (even if we draw all tokens simultaneously, the probability of two or more tokens changing is o(h)o(h))
  • learning-wise, it implies a substantial computational gain: instead of learning one transition object uu on the full sequence space S=VS\mathcal{S}=\mathcal{V}^S (exponential in SS), we can learn SS local transition objects uiu^i, each on the vocabulary space V\mathcal{V} (linear in SS)
  • at each sampling step, we draw each token independently following:
xt+hi∼Cat(exti+huti(xt))\begin{equation} \htmlData{equation-label=eq:token-sampling}{\htmlId{eq:token-sampling}{}} x_{t+h}^i \sim \text{Cat}\left(\mathbf{e}_{x_t^i} + h u_t^i(\mathbf{x}_t)\right) \end{equation}

The following algorithms and figure illustrates the analogy between one Euler step in continuous and discrete flow matching, and makes explicit what this token-wise velocity represents and how to use it to sample sequences.

Algorithm 3 — Continuous Euler: pixel by pixel

Input: Initial image x0∈Rdx_0 \in \mathbb{R}^d, velocity utu_t, step size hh.

  1. For k=0,…,N−1k=0,\ldots,N-1, set t=kht=kh.
    • For each pixel j=1,…,dj=1,\ldots,d in parallel, set xk+1j←xkj+h [ut(xk)]jx_{k+1}^j \leftarrow x_k^j + h\,[u_t(x_k)]_j.
  2. Return the generated image xNx_N.
Algorithm 4 — Discrete Euler: token by token

Input: Initial sequence x0∈VS\mathbf{x}_0 \in \mathcal{V}^S, token-wise velocities utiu_t^i, step size hh.

  1. For k=0,…,N−1k=0,\ldots,N-1, set t=kht=kh.
    • For each token i=1,…,Si=1,\ldots,S in parallel, sample xk+1i∼Cat ⁣(exki+h uti(xk))x_{k+1}^i \sim \mathrm{Cat}\!\left(\mathbf{e}_{x_k^i}+h\,u_t^i(\mathbf{x}_k)\right).
  2. Return the generated sequence xN\mathbf{x}_N.
Continuous — an image x(t) ∈ Rd
x(t)
x(t+h) = x(t) + h ut(x(t))deterministic
x(t+h)
Discrete — a sequence xt ∈ S (here V = {A, B, m}, S = 4)
AmBm
xt
x3t+h ∼ Cat(ex3t + h u3t(xt))stochastic
AmBB
xt+h

Figure 4: One Euler step of size hh in continuous and discrete flow matching, on the samples and on the states (toggleable): the deterministic update x(t)+hut(x(t))x(t) + h u_t(x(t)) becomes a sampling step xt+hi∼Cat(exti+huti(xt))x_{t+h}^i \sim \text{Cat}(\mathbf{e}_{x_t^i} + h u_t^i(\mathbf{x}_t)) applied to each token in parallel for discrete data.

Now that we are equipped with adequate definitions of probability paths and velocities for the discrete case, together with a way to check that one is associated to the other, we can state the approach of discrete flow matching, which is in fact the same as for continuous flow matching:

  1. Build an explicit probability path (pt)(p_t) going from p0p_0 to p1p_1 (Eq. (?)) using a conditioning variable, conditional probability paths and conditional velocities.
  2. Build a velocity utu_t generating (pt)(p_t) (Eq. (?))
  3. Provide an explicit loss to learn utu_t with a neural network (Eq. (?))

Building the probability path

Similarly to continuous flow matching, there are infinitely many possible choices for a probability path (pt)(p_t) going from source p0p_0 to target p1p_1. To build a specific one, we borrow the core idea from continuous flow matching: we first choose a choose a conditioning variable z=x1\mathbf{z} = \mathbf{x_1} and a conditional probability path pt(⋅∣x1)p_t(\cdot | \mathbf{x}_1) for which the exact conditional velocity ut(⋅∣x1)u_t(\cdot | \mathbf{x}_1) that generates this path is known and easy to compute. Then, we show that the resulting global velocity (obtained by marginalizing the conditional velocities) is guaranteed to generate a probability path that transports p0p_0 to p1p_1. All that’s left is to learn the global velocity as a simple conditional expectation from data, which neural networks know how to do!

In order to have factorized velocities (simpler to learn), we chose a conditional path pt(⋅∣x1)p_t(\cdot | \mathbf{x}_1) to be factorized:

pt(x∣x1)=∏i=1S(tI(xi=x1i)+(1−t)I(xi=m)⏟:=qt(xj∣x1j))\begin{align} & p_t(\mathbf{x} | \mathbf{x_1}) = \prod_{i=1}^S \big( \underbrace{ t \mathbb{I}(x^i = x_1^i) + (1 - t) \mathbb{I}(x^i = m) } _{:= q_t(x^j | x_1^j)} \big) \htmlData{equation-label=eq:mask-path-1}{\htmlId{eq:mask-path-1}{}} \\ \end{align}

This choice is similar to the linear interpolation path used in continuous flow matching pt(x∣x0,x1)=tx0+(1−t)x1p_t(x | x_0, x_1) = t x_0 + (1 - t) x_1, unless we cannot interpolate between two discrete tokens. Instead, we use linear interpolation in probability space: at time tt, the ii-th token xtix^i_t equals the target token x1ix_1^i with probability tt, or the mask token mm with probability 1−t1 - t. Therefore, p0(⋅∣x1)p_0(\cdot | \mathbf{x}_1) is a Dirac at the all-masked sequence, while p1(⋅∣x1)p_1(\cdot | \mathbf{x}_1) is a Dirac at x1\mathbf{x}_1. The interest of this conditional probability path is that we can derive the associated velocity in closed-form.

Proposition 6 (Closed-form for conditional velocity).

Define the following token-wise conditional velocity:

ut(xi∣x1i)v:={11−tif v=x1i and xi=m,−11−tif v=xi=m,0otherwise.\begin{equation} \htmlData{equation-label=eq:mask-velocity}{\htmlId{eq:mask-velocity}{}} u_t(x^i | x_1^i)_v := \begin{cases} \frac{1}{1-t} & \text{if } v = x_1^i \text{ and } x^i = m, \\[0.3cm] -\frac{1}{1-t} & \text{if } v = x^i = m, \\[0.3cm] 0 & \text{otherwise}. \end{cases} \end{equation}

Then, the velocity field

ut(x∣x1)y:=∑i=1SI(y≠i=x≠i)ut(xi∣x1i)yi\begin{equation} u_t(\mathbf{x} | \mathbf{x}_1)_{\mathbf{y}} := \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t(x^i | x_1^i)_{y^i} \end{equation}

generates the conditional path pt(x∣x1)p_t(\mathbf{x} | \mathbf{x}_1) in Eq. (?)

Note: compared to Eq. (?), one may be surprised that uiu^i in Eq. (?) depends only on xix_i and not on x\mathbf{x}. As the proof will show, this is a byproduct of the conditional probability paths factorizing over each token of the conditioning sequence x1\mathbf{x}_1.

Example 7 (Example of conditional velocity).

The velocity ut(xi∣x1i)u_t(x^i | x_1^i) progressively removes mass from mm and transfers it to the target token x1ix_1^i. If xtix^i_t is already x1ix_1^i, then the conditional velocity is 00: the token remains at its value until the end. As an example, for V={A,B,C,m}\mathcal{V} = \{A, B, C, m\}, and x1i=Bx_1^i = B, then the conditional velocity field is given by:

ut(xi∣x1i=B)v=xi╲vABCmA0000B00011−tC0000m000−11−tu_t(x^i | x_1^i = B)_v = \begin{array}{c|cccc} \begin{matrix} x^i \\[-2pt] \diagdown \\[-2pt] v \end{matrix} & A & B & C & m \\ \hline A & 0 & 0 & 0 & 0 \\[0.1cm] B & 0 & 0 & 0 & \tfrac{1}{1-t} \\[0.1cm] C & 0 & 0 & 0 & 0 \\[0.1cm] m & 0 & 0 & 0 & -\tfrac{1}{1-t} \end{array}
Proof of proposition 6

We will proceed in two steps:

  1. For the masked source, we show that the token-wise velocity ut(xi∣x1i)u_t(x^i | x_1^i) in Eq. (?) generates the token-wise conditional path qt(xi∣x1i)q_t(x^i | x_1^i) appearing in Eq. (?), in the sense that it satisfies the token-wise Kolmogorov equation
ddtqt(yi∣x1i)=∑v∈Vut(v∣x1i)yi qt(v∣x1i)\begin{equation} \htmlData{equation-label=eq:token-kolmogorov}{\htmlId{eq:token-kolmogorov}{}} \frac{\mathrm{d}}{\mathrm{d}t} q_t(y^{i} | x_1^{i}) = \sum_{v \in \mathcal{V} } u_{t}(v | x_1^{i})_{y^{i}} \, q_t(v | x_1^{i}) \end{equation}

for all yi∈Vy^i \in \mathcal{V} and all i∈{1,…,S}i \in \{1, \dots, S\}.

  1. Once Eq. (?) holds, we show that the velocity
ut(x∣x1)y:=∑i=1SI(y≠i=x≠i)ut(xi∣x1i)yi\begin{equation} u_t(\mathbf{x} | \mathbf{x}_1)_{\mathbf{y}} := \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i}) u_t(x^i | x_1^i)_{y^i} \end{equation}

generates the conditional path pt(x∣x1)p_t(\mathbf{x} | \mathbf{x}_1), as per Eq. (?).

We start with the first statement. Since qt(yi∣x1i):=tI(yi=x1i)+(1−t)I(yi=m)q_t(y^i | x_1^i) := t \mathbb{I}(y^i = x_1^i) + (1 - t) \mathbb{I}(y^i = m), we have

ddtqt(yi∣x1i)=I(yi=x1i)−I(yi=m).\begin{equation} \htmlData{equation-label=eq:mask-path-derivative}{\htmlId{eq:mask-path-derivative}{}} \frac{\mathrm{d}}{\mathrm{d}t} q_t(y^{i} | x_1^{i}) = \mathbb{I}(y^{i} = x_1^{i}) - \mathbb{I}(y^{i} = m). \end{equation}

Equivalently, the velocity in Eq. (?) can be written as ut(v∣x1i)yi=11−t(I(yi=x1i)−I(yi=m))I(v=m)u_{t}(v | x_1^{i})_{y^{i}} = \frac{1}{1 - t} \left( \mathbb{I}(y^{i} = x_1^{i}) - \mathbb{I}(y^{i} = m) \right) \mathbb{I}(v = m). Therefore, the right-hand side of Eq. (?) is

∑v∈Vut(v∣x1i)yi qt(v∣x1i)=∑v∈V11−t(I(yi=x1i)−I(yi=m))I(v=m) qt(v∣x1i)=11−t(I(yi=x1i)−I(yi=m))qt(m∣x1i)=I(yi=x1i)−I(yi=m),\begin{align} &\sum_{v \in \mathcal{V} } u_t(v | x_1^i)_{y^i} \, q_t(v | x_1^{i}) \htmlData{equation-label=eq:mask-velocity-rhs-1}{\htmlId{eq:mask-velocity-rhs-1}{}} \\ &= \sum_{v \in \mathcal{V} } \tfrac{1}{1 - t} \left( \mathbb{I}(y^{i} = x_1^{i}) - \mathbb{I}(y^{i} = m) \right) \mathbb{I}(v = m) \, q_t(v | x_1^{i}) \htmlData{equation-label=eq:mask-velocity-rhs-2}{\htmlId{eq:mask-velocity-rhs-2}{}} \\ &= \tfrac{1}{1 - t} \left( \mathbb{I}(y^{i} = x_1^{i}) - \mathbb{I}(y^{i} = m) \right) q_t(m | x_1^{i}) \htmlData{equation-label=eq:mask-velocity-rhs-3}{\htmlId{eq:mask-velocity-rhs-3}{}} \\ &= \mathbb{I}(y^{i} = x_1^{i}) - \mathbb{I}(y^{i} = m), \htmlData{equation-label=eq:mask-velocity-rhs-4}{\htmlId{eq:mask-velocity-rhs-4}{}} \end{align}

since qt(m∣x1i)=1−tq_t(m | x_1^{i}) = 1-t. This matches Eq. (?), so (ut(⋅∣x1i),qt(⋅∣x1i))(u_t(\cdot | x_1^i), q_t(\cdot | x_1^i)) satisfies the token-wise Kolmogorov equation.

We now show that, using Eq. (?), the pair (pt(⋅∣x1),ut(⋅∣x1))(p_t(\cdot | \mathbf{x}_1), u_t(\cdot | \mathbf{x}_1)) satisfies the Kolmogorov equation Eq. (?). Since the conditional path is factorized, we have:

pt(y∣x1)=∏i=1Sqt(yi∣x1i).\begin{equation} \htmlData{equation-label=eq:conditional-factorized-path}{\htmlId{eq:conditional-factorized-path}{}} p_t(\mathbf{y} | \mathbf{x}_1) = \prod_{i=1}^S q_t(y^i | x_1^i). \end{equation}

Differentiating this product gives:

ddtpt(y∣x1)=ddt∏i=1Sqt(yi∣x1i)=∑i=1S(ddtqt(yi∣x1i))∏j≠iqt(yj∣x1j).\begin{align} \frac{\mathrm{d}}{\mathrm{d}t}p_t(\mathbf{y} | \mathbf{x}_1) &= \frac{\mathrm{d}}{\mathrm{d}t}\prod_{i=1}^S q_t(y^i | x_1^i) \htmlData{equation-label=eq:global-kolmogorov-proof-1}{\htmlId{eq:global-kolmogorov-proof-1}{}} \\ &= \sum_{i=1}^S \left(\frac{\mathrm{d}}{\mathrm{d}t}q_t(y^i | x_1^i)\right) \prod_{j\neq i} q_t(y^j | x_1^j). \htmlData{equation-label=eq:global-kolmogorov-proof-2}{\htmlId{eq:global-kolmogorov-proof-2}{}} \end{align}

Using the token-wise Kolmogorov equation Eq. (?), this becomes:

ddtpt(y∣x1)=∑i=1S[∑v∈Vut(v∣x1i)yi qt(v∣x1i)]∏j≠iqt(yj∣x1j).\begin{align} \frac{\mathrm{d}}{\mathrm{d}t}p_t(\mathbf{y} | \mathbf{x}_1) &= \sum_{i=1}^S \left[ \sum_{v\in\mathcal{V}} u_t(v | x_1^i)_{y^i}\,q_t(v | x_1^i) \right] \prod_{j\neq i} q_t(y^j | x_1^j). \htmlData{equation-label=eq:global-kolmogorov-proof-3}{\htmlId{eq:global-kolmogorov-proof-3}{}} \end{align}

We now compute the right-hand side of the global Kolmogorov equation using the factorized velocity Eq. (?):

∑x∈Sut(x∣x1)y pt(x∣x1)=∑x∈S[∑i=1SI(y≠i=x≠i) ut(xi∣x1i)yi]∏j=1Sqt(xj∣x1j)=∑i=1S∑x∈SI(y≠i=x≠i) ut(xi∣x1i)yi∏j=1Sqt(xj∣x1j).\begin{align} &\sum_{\mathbf{x}\in\mathcal{S}} u_t(\mathbf{x} | \mathbf{x}_1)_{\mathbf{y}}\,p_t(\mathbf{x} | \mathbf{x}_1) \htmlData{equation-label=eq:global-kolmogorov-proof-4}{\htmlId{eq:global-kolmogorov-proof-4}{}} \\ &= \sum_{\mathbf{x}\in\mathcal{S}} \left[ \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i}=\mathbf{x}^{\neq i})\,u_t(x^i | x_1^i)_{y^i} \right] \prod_{j=1}^S q_t(x^j | x_1^j) \htmlData{equation-label=eq:global-kolmogorov-proof-5}{\htmlId{eq:global-kolmogorov-proof-5}{}} \\ &= \sum_{i=1}^S \sum_{\mathbf{x}\in\mathcal{S}} \mathbb{I}(\mathbf{y}^{\neq i}=\mathbf{x}^{\neq i})\,u_t(x^i | x_1^i)_{y^i} \prod_{j=1}^S q_t(x^j | x_1^j). \htmlData{equation-label=eq:global-kolmogorov-proof-6}{\htmlId{eq:global-kolmogorov-proof-6}{}} \end{align}

For a fixed coordinate ii, the indicator I(y≠i=x≠i)\mathbb{I}(\mathbf{y}^{\neq i}=\mathbf{x}^{\neq i}) forces xj=yjx^j=y^j for every j≠ij\neq i. Therefore, the sum over x\mathbf{x} reduces to a sum over the single free token xi=vx^i=v:

∑x∈SI(y≠i=x≠i) ut(xi∣x1i)yi∏j=1Sqt(xj∣x1j)=∑v∈Vut(v∣x1i)yi qt(v∣x1i)∏j≠iqt(yj∣x1j).\begin{align} &\sum_{\mathbf{x}\in\mathcal{S}} \mathbb{I}(\mathbf{y}^{\neq i}=\mathbf{x}^{\neq i})\,u_t(x^i | x_1^i)_{y^i} \prod_{j=1}^S q_t(x^j | x_1^j) \htmlData{equation-label=eq:global-kolmogorov-proof-7}{\htmlId{eq:global-kolmogorov-proof-7}{}} \\ &= \sum_{v\in\mathcal{V}} u_t(v | x_1^i)_{y^i}\,q_t(v | x_1^i) \prod_{j\neq i} q_t(y^j | x_1^j). \htmlData{equation-label=eq:global-kolmogorov-proof-8}{\htmlId{eq:global-kolmogorov-proof-8}{}} \end{align}

Plugging this back into Eq. (?) gives exactly Eq. (?). Hence:

ddtpt(y∣x1)=∑x∈Sut(x∣x1)y pt(x∣x1).\begin{equation} \htmlData{equation-label=eq:global-kolmogorov-proof-9}{\htmlId{eq:global-kolmogorov-proof-9}{}} \frac{\mathrm{d}}{\mathrm{d}t}p_t(\mathbf{y} | \mathbf{x}_1) = \sum_{\mathbf{x}\in\mathcal{S}} u_t(\mathbf{x} | \mathbf{x}_1)_{\mathbf{y}}\,p_t(\mathbf{x} | \mathbf{x}_1). \end{equation}

The pair (pt(⋅∣x1),ut(⋅∣x1))(p_t(\cdot | \mathbf{x}_1), u_t(\cdot | \mathbf{x}_1)) satisfies the Kolmogorov equation.

Values of conditional velocities for and uniform source and interpolation between an arbitrary p0p_0 and p1p_1

Source-Target Conditioning: Here, we condition on both the start and end points, so zi=(x0i,x1i)z^i = (x_0^i, x_1^i). We choose qtq_t as:

qt(xi∣x0i,x1i)=tI(xi=x1i)+(1−t)I(xi=x0i)\begin{equation} \htmlData{equation-label=eq:pair-path}{\htmlId{eq:pair-path}{}} q_t(x^i | x_0^i, x_1^i) = t \mathbb{I}(x^i = x_1^i) + (1 - t) \mathbb{I}(x^i = x_0^i) \end{equation}

It means at time tt, the ii-th token xtix_t^i equals the target token x1ix_1^i with probability tt, or the source token x0ix_0^i with probability 1−t1 - t. Therefore, p0(⋅∣x0,x1)p_0(\cdot | \mathbf{x}_0, \mathbf{x}_1) is a Dirac at x0\mathbf{x}_0, while p1(⋅∣x0,x1)p_1(\cdot | \mathbf{x}_0, \mathbf{x}_1) is a Dirac at x1\mathbf{x}_1.

The conditional velocity field driving this transition is:

ut(xi∣x0i,x1i)v={11−tif v=x1i and xi=x0i,−11−tif v=xi=x0i,0otherwise.\begin{equation} \htmlData{equation-label=eq:pair-velocity}{\htmlId{eq:pair-velocity}{}} u_t(x^i | x_0^i, x_1^i)_v = \begin{cases} \tfrac{1}{1 - t} & \text{if } v = x_1^i \text{ and } x^i = x_0^i, \\ -\tfrac{1}{1 - t} & \text{if } v = x^i = x_0^i, \\ 0 & \text{otherwise}. \end{cases} \end{equation}

Here, mass moves directly from the source token x0ix_0^i toward the target token x1ix_1^i. All rows except the source row are identically zero: once a token is already at state x1ix_1^i, no transition occurs. Concretely, if V={A,B,C}\mathcal{V} = \{A, B, C\}, x0i=Ax_0^i = A, and x1i=Bx_1^i = B:

ut(xi∣x0i=A, x1i=B)v=xi╲vABCA−11−t11−t0B000C000u_t(x^i | x_0^i = A,\, x_1^i = B)_v = \begin{array}{c|ccc} \begin{matrix} x^i \\[-2pt] \diagdown \\[-2pt] v \end{matrix} & A & B & C \\ \hline A & -\tfrac{1}{1-t} & \tfrac{1}{1-t} & 0 \\[0.3cm] B & 0 & 0 & 0 \\[0.3cm] C & 0 & 0 & 0 \end{array}

Uniform Source: In this case, we choose qtq_t as:

qt(xi∣x1i)=tI(xi=x1i)+(1−t)1∣V∣\begin{equation} \htmlData{equation-label=eq:uniform-path}{\htmlId{eq:uniform-path}{}} q_t(x^i | x_1^i) = t \mathbb{I}(x^i = x_1^i) + (1 - t) \frac{1}{|\mathcal{V}|} \end{equation}

It means that at time tt, the ii-th token xtix_t^i equals the target token x1ix_1^i with probability t+(1−t)1∣V∣t + (1 - t)\frac{1}{|\mathcal{V}|}, while each non-target token in the vocabulary V\mathcal{V} has probability (1−t)1∣V∣(1 - t)\frac{1}{|\mathcal{V}|}. Therefore, p0(⋅∣x1)p_0(\cdot | \mathbf{x}_1) is the uniform distribution over sequences, while p1(⋅∣x1)p_1(\cdot | \mathbf{x}_1) is a Dirac at x1\mathbf{x}_1.

The conditional velocity field driving this transition is:

ut(xi∣x1i)v={11−tif v=x1i and xi≠x1i−11−tif v=xi≠x1i0otherwise\begin{equation} \htmlData{equation-label=eq:uniform-velocity}{\htmlId{eq:uniform-velocity}{}} u_t(x^i | x_1^i)_v = \begin{cases} \tfrac{1}{1-t} & \text{if } v = x_1^i \text{ and } x^i \neq x_1^i \\[0.3cm] -\tfrac{1}{1-t} & \text{if } v = x^i \neq x_1^i \\[0.3cm] 0 & \text{otherwise} \end{cases} \end{equation}

Unlike the mask source, every non-target token can transition toward x1ix_1^i, since the uniform source places initial mass everywhere. Concretely, if V={A,B,C}\mathcal{V} = \{A, B, C\} and x1i=Bx_1^i = B:

ut(xi∣x1i=B)v=xi╲vABCA−11−t11−t0B000C011−t−11−tu_t(x^i | x_1^i = B)_v = \begin{array}{c|ccc} \begin{matrix} x^i \\[-2pt] \diagdown \\[-2pt] v \end{matrix} & A & B & C \\ \hline A & -\tfrac{1}{1-t} & \tfrac{1}{1-t} & 0 \\[0.1cm] B & 0 & 0 & 0 \\[0.1cm] C & 0 & \tfrac{1}{1-t} & -\tfrac{1}{1-t} \end{array}

Figure 5: Top: evolution of the conditional path pt(⋅∣x1)p_t(\cdot | \mathbf{x}_1) defined in Eq. (?), where the vocabulary is restricted to the characters in x1∪{m}\mathbf{x}_1 \cup \{m\}. In each cell, white indicates probability zero for sampling that token, while a fully colored cell indicates probability one. Bottom: for a given time tt, five samples xt∣x1\mathbf{x}_t | \mathbf{x}_1 drawn from the conditional probability path.

Building the target velocity

Now that we have defined our conditional probability paths and velocities, we can use them to build global, unconditional ones. The overall distribution ptp_t is obtained by marginalizing the conditional paths over target samples x1\mathbf{x}_1 drawn from p1p_1:

pt(x):=∑x1pt(x∣x1)p1(x1)\begin{equation} \htmlData{equation-label=eq:marginal-path}{\htmlId{eq:marginal-path}{}} p_t(\mathbf{x}) := \sum_{\mathbf{x}_1} p_t(\mathbf{x} | \mathbf{x}_1) p_1(\mathbf{x}_1) \end{equation}

As the proof below shows, the path defined by marginalization indeed goes from p0p_0 to p1p_1.

Proof that path (pt)(p_t) does go from p0p_0 to p1p_1

We verify the two boundary conditions separately:

At t=0t=0: Recall the conditional path the mask source:

q0(xi∣x1i)=I(xi=m).\begin{equation} q_0(x^i | x_1^i) = \mathbb{I}(x^i = m). \end{equation}

The value of x1ix_1^i plays no role, so p0(x∣x1)p_0(\mathbf{x} | \mathbf{x}_1) does not depend on x1\mathbf{x}_1:

p0(x∣x1)=∏j=1SI(xj=m)=δm…m(x)=p0(x).\begin{equation} p_0(\mathbf{x} | \mathbf{x}_1) = \prod_{j=1}^S \mathbb{I}(x^j = m) = \delta_{m\ldots m}(\mathbf{x}) = p_0(\mathbf{x}). \end{equation}

Marginalizing over x1\mathbf{x}_1 then gives:

pt=0(x)=∑x1p0(x∣x1) p1(x1)=p0(x)∑x1p1(x1)=p0(x).\begin{equation} p_{t=0}(\mathbf{x}) = \sum_{\mathbf{x}_1} p_0(\mathbf{x} | \mathbf{x}_1)\,p_1(\mathbf{x}_1) = p_0(\mathbf{x})\sum_{\mathbf{x}_1} p_1(\mathbf{x}_1) = p_0(\mathbf{x}). \end{equation}

At t=1t=1: We have:

q1(xi∣x1i)=I(xi=x1i)p1(x∣x1)=∏j=1SI(xj=x1j)=I(x=x1)\begin{align} q_1(x^i | x_1^i) &= \mathbb{I}(x^i = x_1^i) \htmlData{equation-label=eq:endpoint-path-1}{\htmlId{eq:endpoint-path-1}{}} \\ p_1(\mathbf{x} | \mathbf{x}_1) &= \prod_{j=1}^S \mathbb{I}(x^j = x_1^j) = \mathbb{I}(\mathbf{x} = \mathbf{x}_1) \htmlData{equation-label=eq:endpoint-path-2}{\htmlId{eq:endpoint-path-2}{}} \end{align}

We conclude:

pt=1(x)=∑x1p1(x∣x1) p1(x1)=∑x1I(x=x1) p1(x1)=p1(x).\begin{align} p_{t=1}(\mathbf{x}) &= \sum_{\mathbf{x}_1} p_1(\mathbf{x} | \mathbf{x}_1)\,p_1(\mathbf{x}_1) \\ &= \sum_{\mathbf{x}_1} \mathbb{I}(\mathbf{x} = \mathbf{x}_1)\, p_1(\mathbf{x}_1) \\ &= p_1(\mathbf{x}). \end{align}

We now arrive to the heart of discrete flow matching: building a velocity that transports p0p_0 to p1p_1.

Theorem 8 (Fundamental theorem of discrete FM).

The velocity obtained by taking the conditional expectation of the conditional velocities,

ut(x)y:=E ⁣[ut(Xt∣X1)y∣Xt=x]=∑x1ut(x∣x1)y P(X1=x1∣Xt=x)\begin{align} u_t(\mathbf{x})_{\mathbf{y}} := \mathbb{E}\!\left[u_t(X_t|X_1)_{\mathbf{y}} | X_t = \mathbf{x}\right] &= \sum_{\mathbf{x}_1} u_t(\mathbf{x}|\mathbf{x}_1)_{\mathbf{y}}\,\mathbb{P}(X_1 = \mathbf{x}_1 | X_t = \mathbf{x}) \htmlData{equation-label=eq:marginal-velocity-def}{\htmlId{eq:marginal-velocity-def}{}} \end{align}

generates the probability path pt(x)=∑x1pt(x∣x1) p1(x1)p_t(\mathbf{x}) = \sum_{\mathbf{x}_1} p_t(\mathbf{x}|\mathbf{x}_1)\,p_1(\mathbf{x}_1).

Proof

We want to show

P(Xt+h=y∣Xt=x)=I(x=y)+h ut(x)y+o(h).\begin{equation} \htmlData{equation-label=eq:marginal-velocity}{\htmlId{eq:marginal-velocity}{}} \mathbb{P}(X_{t+h}=\mathbf{y}| X_t=\mathbf{x}) = \mathbb{I}(\mathbf{x}=\mathbf{y}) + h\,u_t(\mathbf{x})_{\mathbf{y}} + o(h). \end{equation}

Introducing X1X_1 and using the law of total probability,

P(Xt+h=y∣Xt=x)=∑x1P(Xt+h=y,X1=x1∣Xt=x)=∑x1P(Xt+h=y∣Xt=x,X1=x1) P(X1=x1∣Xt=x)=∑x1(I(x=y)+h ut(x∣x1)y+o(h)) P(X1=x1∣Xt=x)=I(x=y)+h∑x1ut(x∣x1)y P(X1=x1∣Xt=x)+o(h)=I(x=y)+h ut(x)y+o(h).\begin{align} \mathbb{P}(X_{t+h}=\mathbf{y}| X_t=\mathbf{x}) \htmlData{equation-label=eq:marginal-velocity-proof-1}{\htmlId{eq:marginal-velocity-proof-1}{}} &= \sum_{\mathbf{x}_1} \mathbb{P}(X_{t+h}=\mathbf{y}, X_1=\mathbf{x}_1| X_t=\mathbf{x}) \htmlData{equation-label=eq:marginal-velocity-proof-2}{\htmlId{eq:marginal-velocity-proof-2}{}} \\ &\hspace{-8em}{}= \sum_{\mathbf{x}_1} \mathbb{P}(X_{t+h}=\mathbf{y}| X_t=\mathbf{x}, X_1=\mathbf{x}_1)\,\mathbb{P}(X_1=\mathbf{x}_1| X_t=\mathbf{x}) \htmlData{equation-label=eq:marginal-velocity-proof-3}{\htmlId{eq:marginal-velocity-proof-3}{}} \\ &\hspace{-8em}{}= \sum_{\mathbf{x}_1}\Big(\mathbb{I}(\mathbf{x}=\mathbf{y}) + h\,u_t(\mathbf{x}|\mathbf{x}_1)_{\mathbf{y}} + o(h)\Big)\,\mathbb{P}(X_1=\mathbf{x}_1| X_t=\mathbf{x}) \htmlData{equation-label=eq:marginal-velocity-proof-4}{\htmlId{eq:marginal-velocity-proof-4}{}} \\ &\hspace{-8em}{}= \mathbb{I}(\mathbf{x}=\mathbf{y}) + h\sum_{\mathbf{x}_1}u_t(\mathbf{x}|\mathbf{x}_1)_{\mathbf{y}}\,\mathbb{P}(X_1=\mathbf{x}_1| X_t=\mathbf{x}) + o(h) \htmlData{equation-label=eq:marginal-velocity-proof-5}{\htmlId{eq:marginal-velocity-proof-5}{}} \\ &\hspace{-8em}{}= \mathbb{I}(\mathbf{x}=\mathbf{y}) + h\,u_t(\mathbf{x})_{\mathbf{y}} + o(h). \htmlData{equation-label=eq:marginal-velocity-proof-6}{\htmlId{eq:marginal-velocity-proof-6}{}} \end{align}

where we have used in Eq. (?) the fact that ut(⋅∣x1)u_t(\cdot | \mathbf{x}_1) generates pt(⋅∣x1)p_t(\cdot | \mathbf{x}_1).

Alternative proof: apply the Kolmogorov equation to each conditional process and average over x1\mathbf{x}_1:

ddtpt(y)=∑x1p1(x1) ddtpt(y∣x1)=∑x1p1(x1)∑xut(x∣x1)y pt(x∣x1)=∑x(∑x1ut(x∣x1)y P(X1=x1∣Xt=x))pt(x)=∑xut(x)y pt(x).\begin{align} \frac{\mathrm{d}}{\mathrm{d}t}p_t(\mathbf{y}) \htmlData{equation-label=eq:marginal-kolmogorov-1}{\htmlId{eq:marginal-kolmogorov-1}{}} &= \sum_{\mathbf{x}_1} p_1(\mathbf{x}_1)\,\frac{\mathrm{d}}{\mathrm{d}t}p_t(\mathbf{y}|\mathbf{x}_1) \htmlData{equation-label=eq:marginal-kolmogorov-2}{\htmlId{eq:marginal-kolmogorov-2}{}} \\ &= \sum_{\mathbf{x}_1}p_1(\mathbf{x}_1)\sum_{\mathbf{x}}u_t(\mathbf{x}|\mathbf{x}_1)_{\mathbf{y}}\,p_t(\mathbf{x}|\mathbf{x}_1) \htmlData{equation-label=eq:marginal-kolmogorov-3}{\htmlId{eq:marginal-kolmogorov-3}{}} \\ &= \sum_{\mathbf{x}}\left(\sum_{\mathbf{x}_1}u_t(\mathbf{x}|\mathbf{x}_1)_{\mathbf{y}}\,\mathbb{P}(X_1=\mathbf{x}_1| X_t=\mathbf{x})\right)p_t(\mathbf{x}) \htmlData{equation-label=eq:marginal-kolmogorov-4}{\htmlId{eq:marginal-kolmogorov-4}{}} \\ &= \sum_{\mathbf{x}} u_t(\mathbf{x})_{\mathbf{y}}\,p_t(\mathbf{x}). \htmlData{equation-label=eq:marginal-kolmogorov-5}{\htmlId{eq:marginal-kolmogorov-5}{}} \end{align}

So utu_t satisfies the Kolmogorov equation for ptp_t and therefore generates ptp_t.

This theorem follows the exact same logic as in continuous FM, and has the same practical consequence: since the target field is identified as a conditional expectation, it can be learned through a regression problem.

In continuous spaces, this is typically introduced via the L2L^2 projection view, as the conditional expectation solves

ut(x)=argmin⁡ut measurable E ⁣[∥ut(Xt∣X1)−u(Xt)∥2].\begin{equation} \htmlData{equation-label=eq:l2-proj}{\htmlId{eq:l2-proj}{}} u_t(\mathbf{x}) = \underset{u_t \text{ measurable}}{\operatorname{argmin}}\ \mathbb{E}\!\left[\left\|u_t(X_t | X_1) - u(X_t)\right\|^2 \right] . \end{equation}

In discrete spaces, since we compare nonneg­ative rate vectors that behave like local probabilities, a Kullback-Leibler style objective is more natural. More generally, this conditional expectation is the minimizer for any Bregman divergence, and KL is the Bregman choice adapted to our setting:

ut(x)=argmin⁡u E ⁣[KL(u(Xt∣X1),u(Xt))]\begin{equation} \htmlData{equation-label=eq:kl-proj}{\htmlId{eq:kl-proj}{}} u_t(\mathbf{x}) ={} \underset{u}{\operatorname{argmin}}\ \mathbb{E}\!\left[ \mathrm{KL} \left(u(X_t | X_1), u(X_t)\right) \right] \end{equation}

The exact conditional expectation of Eq. (?) is approximated by a neural network uθ,tu_{\theta,t}, trained by minimizing over θ\theta:

LCDFM(θ)=Et∼U(0,1)x1∼p1xt∼pt(⋅∣x1)[KL(ut(xt∣x1),uθ,t(xt))]=Et∼U(0,1)x1∼p1xt∼pt(⋅∣x1)[∑i=1SKL(ut(xti∣x1i),uθ,ti(xt))]\begin{align} L_{\text{CDFM}}(\theta) &= \mathbb{E}_{\substack{t \sim \mathcal{U}(0,1) \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x}_t \sim p_t( \cdot | \mathbf{x}_1)}}\left[ \mathrm{KL}\left(u_t(\mathbf{x}_t | \mathbf{x}_1), u_{\theta,t}(\mathbf{x}_t)\right) \right] \htmlData{equation-label=eq:cdfm-2}{\htmlId{eq:cdfm-2}{}} \\ & =\mathbb{E}_{\substack{t \sim \mathcal{U}(0,1) \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x}_t \sim p_t( \cdot | \mathbf{x}_1)}}\left[ \sum_{i=1}^S \mathrm{KL}\left( u_t(x^i_t | x_1^i), u_{\theta,t}^i(\mathbf{x}_t) \right) \right] \htmlData{equation-label=eq:cdfm-3}{\htmlId{eq:cdfm-3}{}} \end{align}

Learning with denoiser parameterization

With straight interpolation paths xt:=(1−t)x0+tx1x_t := (1-t) x_0 + tx_1, learning the ideal velocity E[X1−X0∣Xt=x]\mathbb{E}[X_1 - X_0 | X_t=x] is mathematically equivalent to learning the ideal denoiser E[X1∣Xt=x]\mathbb{E}[X_1 | X_t = x], since the two are linked via E[X1−X0∣Xt=x]=11−t(E[X1∣Xt=x]−x)\mathbb{E}[X_1 - X_0 | X_t=x] = \frac{1}{1 - t} ( \mathbb{E}[X_1 | X_t = x] - x). The denoiser can be understood as predicting the most plausible clean image x1x_1 given a noisy image xtx_t at time tt. It turns out the same type of denoiser-velocity equivalence holds in the discrete case:

uti(x)v=11−t(P(X1i=v∣Xt=x)−I(v=xi)).\begin{equation} \htmlData{equation-label=eq:velocity-posterior}{\htmlId{eq:velocity-posterior}{}} u_t^i(\mathbf{x})_v = \frac{1}{1 - t} \left( \mathbb{P}(X_1^i = v | X_t = \mathbf{x}) - \mathbb{I}(v = x^i) \right) . \end{equation}

In this equation, the function x↦P(X1i=v∣Xt=x)\mathbf{x} \mapsto \mathbb{P}(X_1^i = v | X_t = \mathbf{x}) can be interpreted as a denoiser: it gives the probability of the ii-th token in the clean sequence x1\mathbf{x}_1 being vv, given the full noisy sequence xt\mathbf{x}_t.

Proof of velocity-denoiser equivalence

We write the proof for the masked source and start from Eq. (?). In a compact form, it can be rewritten as:

uti(xi∣x1i)v=11−t I(xi=m)(I(v=x1i)−I(v=m)).\begin{equation} \htmlData{equation-label=eq:mask-velocity-token}{\htmlId{eq:mask-velocity-token}{}} u_t^i(x^i | x_1^i)_v = \frac{1}{1-t}\,\mathbb{I}(x^i = m)\left(\mathbb{I}(v = x_1^i) - \mathbb{I}(v = m)\right). \end{equation}

Case 1: xi≠mx^i \neq m (token already unmasked).

The indicator I(xi=m)=0\mathbb{I}(x^i = m)=0, so uti(xi∣x1i)v=0u_t^i(x^i | x_1^i)_v = 0 for all x1i,vx_1^i, v and hence uti(x)v=0u_t^i(x)_v = 0.

It remains to check that Eq. (?) also gives zero. By Bayes’ rule,

P(X1i=v∣Xt=x)=P(Xt=x∣X1i=v) P(X1i=v)P(Xt=x).\begin{equation} \htmlData{equation-label=eq:posterior-bayes}{\htmlId{eq:posterior-bayes}{}} \mathbb{P}(X_1^i = v | X_t = \mathbf{x}) = \frac{\mathbb{P}(X_t = \mathbf{x} | X_1^i = v)\,\mathbb{P}(X_1^i = v)} {\mathbb{P}(X_t = \mathbf{x})}. \end{equation}

Under the conditional probability path Eq. (?),

qt(xi∣x1i)=t I(xi=x1i)+(1−t) I(xi=m)⏟=0=t I(xi=x1i)\begin{equation} \htmlData{equation-label=eq:mask-token-path}{\htmlId{eq:mask-token-path}{}} q_t(x^i | x_1^i) = t\,\mathbb{I}(x^i = x_1^i) + \underbrace{(1-t)\,\mathbb{I}(x^i = m)}_{=0} = t\,\mathbb{I}(x^i = x_1^i) \end{equation}

since xi≠mx^i \neq m. Therefore, if v≠xiv \neq x^i, then

P(Xt=x∣X1i=v)=qt(xi∣v) P(Xt≠i=x≠i∣X1i=v)=0.\begin{align} \mathbb{P}(X_t = \mathbf{x} |X_1^i = v) \htmlData{equation-label=eq:posterior-zero-1}{\htmlId{eq:posterior-zero-1}{}} &= \htmlData{equation-label=eq:posterior-zero-2}{\htmlId{eq:posterior-zero-2}{}} q_t(x^i | v)\,\mathbb{P}(X_t^{\neq i} = \mathbf{x}^{\neq i} |X_1^i = v) \htmlData{equation-label=eq:posterior-zero-3}{\htmlId{eq:posterior-zero-3}{}} \\ &= 0. \htmlData{equation-label=eq:posterior-zero-4}{\htmlId{eq:posterior-zero-4}{}} \end{align}

and hence P(X1i=v∣Xt=x)=0\mathbb{P}(X_1^i = v |X_t = \mathbf{x})=0. Since the conditional probabilities sum to one over vv , we conclude that

P(X1i=v∣Xt=x)=I(v=xi).\begin{equation} \htmlData{equation-label=eq:posterior-copy}{\htmlId{eq:posterior-copy}{}} \mathbb{P}(X_1^i = v |X_t = \mathbf{x})=\mathbb{I}(v = x^i). \end{equation}

Substituting Eq. (?) into Eq. (?) gives

11−t(P(X1i=v∣Xt=x)−I(v=xi))=0.\begin{equation} \htmlData{equation-label=eq:velocity-zero}{\htmlId{eq:velocity-zero}{}} \frac{1}{1-t} \left( \mathbb{P}(X_1^i = v |X_t = \mathbf{x}) - \mathbb{I}(v = x^i) \right) = 0. \end{equation}

Thus both expressions coincide in the case xi≠mx^i \neq m.

Case 2: xi=mx^i = m (token is masked). Taking the expectation over x1ix_1^i:

uti(x)v=Ex1i ⁣[11−t(I(v=x1i)−I(v=m))]=11−t(P(X1i=v∣Xt=x)−I(v=m))=11−t(P(X1i=v∣Xt=x)−I(v=xi)),\begin{align} u_t^i(\mathbf{x})_v \htmlData{equation-label=eq:velocity-posterior-proof-1}{\htmlId{eq:velocity-posterior-proof-1}{}} &= \mathbb{E}_{x_1^i}\!\left[\frac{1}{1-t}\left(\mathbb{I}(v = x_1^i) - \mathbb{I}(v = m)\right)\right] \htmlData{equation-label=eq:velocity-posterior-proof-2}{\htmlId{eq:velocity-posterior-proof-2}{}} \\ &= \frac{1}{1-t}\left(\mathbb{P}(X_1^i = v | X_t = \mathbf{x}) - \mathbb{I}(v = m)\right) \htmlData{equation-label=eq:velocity-posterior-proof-3}{\htmlId{eq:velocity-posterior-proof-3}{}} \\ &= \frac{1}{1-t}\left(\mathbb{P}(X_1^i = v | X_t = \mathbf{x}) - \mathbb{I}(v = x^i)\right), \htmlData{equation-label=eq:velocity-posterior-proof-4}{\htmlId{eq:velocity-posterior-proof-4}{}} \end{align}

where the last equality uses xi=mx^i = m. Both cases match the claimed formula.

Because the term I(v=xi)\mathbb{I}(v = x^i) is a known constant given the current state, learning the velocity field uu is mathematically exactly equivalent to learning the denoiser probability P(X1i=v∣Xt=x)\mathbb{P}(X_1^i = v | X_t = \mathbf{x}). Consequently, we can train a denoiser Pθ,tP_{\theta, t} directly. Using the KL divergence between the true clean token distribution and the learned one, the loss simplifies to the standard cross-entropy [2, 3]:

LCDM(θ)=−Et∼U(0,1)x1∼p1x∼pt(⋅∣x1)[∑i=1Slog⁡Pθ,t(X1i=x1i∣Xt=x)]\begin{equation} \htmlData{equation-label=eq:cdm-loss}{\htmlId{eq:cdm-loss}{}} L_{\text{CDM}}(\theta) = -\mathbb{E}_{\substack{t \sim \mathcal{U}(0,1) \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x} \sim p_t( \cdot | \mathbf{x}_1)}} \left[ \sum_{i=1}^S \log P_{\theta,t}(X_1^i = x_1^i | X_t = \mathbf{x}) \right] \end{equation}
Derivation

By the same argument as in Eq. (?), the true denoiser is the KL projection of the conditional clean-token distribution: Pt(X1i∣Xt=x)P_t(X_1^i | X_t = \mathbf{x}) minimizes in PP

Ex1∼p1x∼pt(⋅∣x1) ⁣[KL(Pt(X1i∣Xt=x, x1), P(X1i∣Xt=x))]\begin{equation} \htmlData{equation-label=eq:denoiser-kl-proj}{\htmlId{eq:denoiser-kl-proj}{}} \mathbb{E}_{\substack{\mathbf{x}_1 \sim p_1 \\ \mathbf{x} \sim p_t(\cdot | \mathbf{x}_1)}} \!\left[ \mathrm{KL}\left(P_t(X_1^i | X_t = \mathbf{x},\, \mathbf{x}_1),\, P(X_1^i | X_t = \mathbf{x})\right) \right] \end{equation}

Thus, we want to minimize:

L(θ)≡Et∼U(0,1)x1∼p1x∼pt(⋅∣x1)[∑i=1SKL(Pt(X1i∣Xt=x, x1), Pθ,t(X1i∣Xt=x))]\begin{equation} \htmlData{equation-label=eq:posterior-kl-cond}{\htmlId{eq:posterior-kl-cond}{}} L(\theta) \equiv \mathbb{E}_{\substack{t \sim \mathcal{U}(0,1) \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x} \sim p_t( \cdot | \mathbf{x}_1)}} \left[ \sum_{i=1}^S \mathrm{KL}\left(P_t(X_1^i | X_t = \mathbf{x},\, \mathbf{x}_1),\, P_{\theta,t}(X_1^i | X_t = \mathbf{x})\right) \right] \end{equation}

Given x1\mathbf{x}_1, the true conditional posterior is a one-hot: Pt(X1i∣Xt=x,x1)=ex1iP_t(X_1^i | X_t = \mathbf{x}, \mathbf{x}_1) = \mathbf{e}_{x_1^i}. The KL between a one-hot and any distribution reduces to a single log term:

KL(ex1i, Pθ,t(X1i∣x))=−log⁡Pθ,t(X1i=x1i∣x)\begin{equation} \htmlData{equation-label=eq:onehot-kl}{\htmlId{eq:onehot-kl}{}} \mathrm{KL}\left(\mathbf{e}_{x_1^i},\, P_{\theta,t}(X_1^i | \mathbf{x})\right) = -\log P_{\theta,t}(X_1^i = x_1^i | \mathbf{x}) \end{equation}

which gives directly:

LCDM(θ)=−Et∼U(0,1)x1∼p1x∼pt(⋅∣x1)[∑i=1Slog⁡Pθ,t(X1i=x1i∣Xt=x)]\begin{equation} \htmlData{equation-label=eq:cdm-loss-2}{\htmlId{eq:cdm-loss-2}{}} L_{\text{CDM}}(\theta) = -\mathbb{E}_{\substack{t \sim \mathcal{U}(0,1) \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x} \sim p_t( \cdot | \mathbf{x}_1)}} \left[ \sum_{i=1}^S \log P_{\theta,t}(X_1^i = x_1^i | X_t = \mathbf{x}) \right] \end{equation}

Discrete Flow Matching Sampling

S=4, 𝒱={A, B, m}, mask source, 10 Euler steps (dt=0.100) · sample #1

Step 1/10t = 0.00
m
pos 1
m
pos 2
m
pos 3
m
pos 4
velocity ut(xt)
pos 10.17A0.83B-1.00m
pos 20.30A0.69B-1.00m
pos 30.51A0.49B-1.00m
pos 40.52A0.48B-1.00m
exit + h uit(xt)
pos 10.02A0.08B0.90m
pos 20.03A0.07B0.90m
pos 30.05A0.05B0.90m
pos 40.05A0.05B0.90m
steps
seed
slowfast
A
B
m (mask)

Figure 6: Generation process of a sequence of length S=4S=4 with a learned velocity uθ,tu_{\theta,t} or denoiser Pθ,t(X1i∣Xt)P_{\theta,t}(X_1^i | X_t). Key facts: 1) At each step, all tokens are updated independently 2) Different samples can be generated from the same initial sequence (change the seed!), because sampling is stochastic at each step. Key empirical observations: 3) The probability of drawing the mask token mm decreases at each step, while the probability of drawing other tokens increases. 4) Once a token is unmasked, it stays at its current value until the end.

To wrap up, we end this section with a table summarizing the important steps in discrete flow matching, put in parallel with their equivalent for continuous flow matching.

Table 7: Continuous and discrete flow matching side by side.
Continuous flow matchingDiscrete flow matching
1. Define a conditioning variable z\mathbf{z} with known distribution π(z)\pi(\mathbf{z})

z=(x0,x1)\mathbf{z}=(\mathbf{x}_0, \mathbf{x}_1) with π(z)=p0×p1\pi(\mathbf{z}) = p_0 \times p_1

z=x1\mathbf{z}=\mathbf{x}_1 with π(z)=p1\pi(\mathbf{z}) = p_1
(our choice for simplicity; z=(x0,x1)\mathbf{z} = (\mathbf{x}_0, \mathbf{x}_1) is also possible)

2. Define a simple conditional distribution pt(x∣z)p_t(\mathbf{x} | \mathbf{z})

pt(x∣z)=δ(1−t)x0+tx1(x)p_t(\mathbf{x} | \mathbf{z}) = \delta_{(1 - t)\mathbf{x}_0 + t\mathbf{x}_1}(\mathbf{x})

pt(x∣z)=∏j=1Sqt(xj∣x1j)p_t(\mathbf{x} | \mathbf{z}) = \prod_{j=1}^S q_t(x^j | x_1^j)
where qt=Cat((1−t)em+tex1j)q_t = \text{Cat}((1 - t) \mathbf{e}_{m} + t \mathbf{e}_{x_1^j} )

3. Compute an associated conditional velocity field ut(x∣z)u_t(\mathbf{x} | \mathbf{z})

ut(x∣z)=x1−x0u_t(\mathbf{x} | \mathbf{z}) = \mathbf{x}_1 - \mathbf{x}_0

ut(x∣z)y=∑i=1SI(y≠i=x≠i) ut(xi∣x1i)yiu_t(\mathbf{x} | \mathbf{z})_{\mathbf{y}} = \sum_{i=1}^S \mathbb{I}(\mathbf{y}^{\neq i} = \mathbf{x}^{\neq i})\, u_t(x^i | x_1^i)_{y^i}
with ut(xi∣x1i)=11−tI(xi=m)(ex1i−em)u_t(x^i | x_1^i) = \frac{1}{1-t}\mathbb{I}(x^i = m)\left(\mathbf{e}_{x_1^i} - \mathbf{e}_{m}\right)

4. Training objective

Use L2L^2:
min⁡θEt∼U[0,1]z∼πxt∼pt(⋅∣z) ⁣[∥uθ,t(xt)−(x1−x0)∥2]\min_\theta \mathbb{E}_{\substack{t \sim \mathcal{U}_{[0,1]} \\ \mathbf{z} \sim \pi \\ \mathbf{x}_t \sim p_t(\cdot | \mathbf{z})}}\!\left[\Vert u_{\theta, t}(\mathbf{x}_t) - (\mathbf{x}_1 - \mathbf{x}_0) \Vert^2\right]

Use KL:
min⁡θEt∼U[0,1]x1∼p1xt∼pt(⋅∣x1) ⁣[−∑i=1Slog⁡Pθ,t(X1i=x1i∣xt)]\min_\theta \mathbb{E}_{\substack{t \sim \mathcal{U}_{[0,1]} \\ \mathbf{x}_1 \sim p_1 \\ \mathbf{x}_t \sim p_t(\cdot | \mathbf{x}_1)}}\!\left[-\sum_{i=1}^S \log P_{\theta,t}(X_1^i = x_1^i | \mathbf{x}_t)\right]

5. Sampling
Sample x0∼p0\mathbf{x}_0 \sim p_0, integration scheme for k=0,…,N−1k=0,\ldots,N-1

Numerical Integration (Euler ODE):
xk+1=xk+1Nuθ,k/N(xk)\mathbf{x}_{k+1} = \mathbf{x}_k + \frac{1}{N} u_{\theta,k/N}(\mathbf{x}_k)
If learned denoiser, use:
uθ,t(x)=11−t ⁣(Eθ[X1∣Xt=x]−x)u_{\theta,t}(\mathbf{x}) = \frac{1}{1-t}\!\left(\mathbb{E}_\theta[X_1 | X_t = \mathbf{x}] - \mathbf{x}\right)

Continuous Time Markov Chain:
xk+1i∼Cat ⁣(exki+1Nuθ,k/Ni(xk))x_{k+1}^i \sim \text{Cat}\!\left(\mathbf{e}_{x_k^i} + \frac{1}{N} u_{\theta,k/N}^i(\mathbf{x}_k)\right)
If learned denoiser, use:
uθ,ti(x)=11−t ⁣(Pθ,t(X1i∣x)−exi)u_{\theta,t}^i(\mathbf{x}) = \frac{1}{1-t}\!\left(P_{\theta,t}(X_1^i | \mathbf{x}) - \mathbf{e}_{x^i}\right)

6. Master Equation

Continuity Equation:
∂tpt+∇(utpt)=0\partial_t p_t + \nabla (u_t p_t) = 0

Kolmogorov Equation:
ddtpt(y)=∑x∈Sut(x)y pt(x)\frac{\mathrm{d}}{\mathrm{d}t} p_t(\mathbf{y}) = \sum_{\mathbf{x} \in \mathcal{S}} u_t(\mathbf{x})_{\mathbf{y}} \, p_t(\mathbf{x})

To go further: planners in masked flow-matching sampling

Notes before reading this section:

  1. We note the denoiser Dθ,t(xt):=Pθ,t(X1∣Xt=xt)D_{\theta,t}(\mathbf{x}_t) := P_{\theta,t}(X_1 | X_t = \mathbf{x}_t).
  2. Because the noise level tt in masked flow-matching can be easily inferred from the number of masked tokens in xt\mathbf{x}_t, the denoiser does not need to know the current time in its predictions. Therefore, for any time tt and any given sequence x\mathbf{x}, we write Dθ,t(x)=Dθ(x)D_{\theta,t}(\mathbf{x}) = D_{\theta}(\mathbf{x}).

Sampling with a planner

With step size hh, vanilla masked flow-matching sampling Eq. (?) uses 1/h1/h time steps. Across a sequence of length SS, this corresponds to S/hS/h draws from probability vectors over the vocabulary ∣V∣|\mathcal{V}|. For h=0.01h = 0.01 and S=200S = 200, generating one sample therefore involves 20,00020,000 such draws, which is computationally expensive. Moreover, some steps t→t+ht \to t+h can keep the current sequence xt\mathbf{x}_t unchanged, implying computational waste (it can be easily observed in figure 6).

To make generation more efficient, the standard approach used for large masked flow-matching models is planner-guided sampling. Instead of relying on infinitesimal time steps, we fix the total generation steps NN and directly use the denoiser to reveal a fixed number of tokens at each step. For S=200S = 200 and N=50N = 50, we have NS=50×200=10,000NS = 50 \times 200 = 10,000 draws to do, which is half the cost of the previous example.

Definition 9 (Planner GϕG_\phi).

A planner GϕG_\phi maps a partially masked sequence xk\mathbf{x}_k and a denoised candidate z∼Dθ(xk)\mathbf{z} \sim D_\theta(\mathbf{x}_k) to a distribution over positions to reveal. At step kk, with Mk={i:xki=m}\mathcal{M}_k = \{i : x_k^i = m\} the set of masked positions in xk\mathbf{x}_k, we write:

Gϕ(z,xk)∈ΔS,Gϕ(z,xk)i=0 for i∉Mk.\begin{equation} \htmlData{equation-label=eq:planner-definition}{\htmlId{eq:planner-definition}{}} G_\phi(\mathbf{z}, \mathbf{x}_k) \in \Delta_S,\qquad G_\phi(\mathbf{z}, \mathbf{x}_k)_i = 0 \text{ for } i \notin \mathcal{M}_k. \end{equation}

In other words, the planner indicates, for each position ii in the noisy sequence xk\mathbf{x}_k, the probability of denoising xkix_k^i into ziz^i. If xki≠mx_k^i \neq m, this probability is zero. For example, if xk=(m,A,m)\mathbf{x}_k=(m,A,m) and z=(B,A,A)\mathbf{z}=(B,A,A), then a possible value of Gϕ(z,xk)G_\phi(\mathbf{z}, \mathbf{x}_k) is (0.7,0,0.3)(0.7,0,0.3), which means revealing position 11 into z1=Bz^1 = B with probability 70%70\% and position 33 into z3=Az^3 = A with probability 30%30\%.

Algorithm 5 — Planner-Guided Sampling

Input: Planner GϕG_\phi, trained denoiser DθD_\theta, total number of sampling steps NN, schedule ff mapping step index to number of tokens to reveal at that step, e.g., f(k)=S/Nf(k) = S/N for all kk when NN divides SS.

  1. Initialize: x0←(m,…,m)\mathbf{x}_0 \leftarrow (m, \dots, m) (a sequence of SS mask tokens).
  2. For k=0,1,…,N−1k = 0, 1, \dots, N - 1:
    • Plan: Sample candidate tokens z∼Dθ(xk)\mathbf{z} \sim D_\theta(\mathbf{x}_k).
    • Select:
      1. Initialize I←∅\mathcal{I}\leftarrow \varnothing.
      2. For ℓ=1,…,f(k)\ell=1,\ldots,f(k):
        • Sample one position iℓi_\ell from Gϕ(z,xk)G_\phi(\mathbf{z}, \mathbf{x}_k), restricted to positions not already in I\mathcal{I}.
        • Add it to the set: I←I∪{iℓ}\mathcal{I}\leftarrow \mathcal{I}\cup\{i_\ell\}.
    • Denoise: Create xk+1\mathbf{x}_{k+1} by setting xk+1i=zix_{k+1}^i = z^i for all i∈Ii \in \mathcal{I}, and leaving all other positions unchanged.
  3. Return fully generated sequence xN\mathbf{x}_N.
Proposition 10 (Sampling-scheme equivalence).

If we choose the uniform random planner that selects positions uniformly at random among the masked tokens, i.e. G(z,xk)i=1∣Mk∣G(\mathbf{z}, \mathbf{x}_k)_i = \frac{1}{|\mathcal{M}_k|} for each i∈Mki \in \mathcal{M}_k, then planner-guided sampling with N=SN = S steps and f(k)=1f(k) = 1 token per step is exactly equivalent to the Euler sampling procedure given in Eq. (?) as h→0h \to 0.

However, we rarely decide to unmask tokens by picking a random position at each step. Instead, we can use heuristic or learned planners that rank positions according to how reliable or informative they seem to reveal.

A simple and widely used strategy in this direction is the soft greedy planner. Instead of unmasking tokens at random, it selects the positions where the denoiser is most confident in its predictions. We then relax this strict selection into a soft probability distribution using a softmax function with a temperature parameter τ\tau:

Gτ(z,xk)t∝exp⁡(1τlog⁡Dθj(xk)zj)\begin{equation} \htmlData{equation-label=eq:planner}{\htmlId{eq:planner}{}} G_\tau(\mathbf{z}, \mathbf{x}_k)_t \propto \exp\left(\frac{1}{\tau} \log D_\theta^j(\mathbf{x}_k)_{z^j}\right) \end{equation}

As τ→∞\tau \to \infty, this reduces to uniform random sampling. As τ→0\tau \to 0, it converges to a strict, hard selection of only the most confident token in the sampled sequence z\mathbf{z}.

Other planning strategies

Entropy planner. Another heuristic is to score each position by the negative entropy of the denoiser distribution. Low entropy means the denoiser is concentrated on a few tokens, so the position is treated as more reliable:

si(xk)=∑v∈VDθi(xk)vlog⁡Dθi(xk)v.\begin{equation} s^i(\mathbf{x}_k) = \sum_{v \in \mathcal{V}} D_\theta^i(\mathbf{x}_k)_v \log D_\theta^i(\mathbf{x}_k)_v. \end{equation}

The planner then applies a softmax over the still-masked positions:

Gτent(z,xk)i∝exp⁡(si(xk)τ)\begin{equation} \htmlData{equation-label=eq:entropy-planner}{\htmlId{eq:entropy-planner}{}} G_\tau^{\mathrm{ent}}(\mathbf{z}, \mathbf{x}_k)_i \propto \exp\left(\frac{s^i(\mathbf{x}_k)}{\tau}\right) \end{equation}

Unlike soft greedy, this planner does not use the sampled token ziz^i directly; it only uses the shape of the denoiser distribution at position ii.

Learned planner. With a pretrained denoiser, one can also train a separate planner offline. This can be done with a cross-entropy objective of the form:

LG(ϕ)=E ⁣[∑i=1SI(xki=m)11−tCE ⁣(Gϕi(xk,z), I[zi=x1i])].\begin{equation} \mathcal{L}_{G}(\phi) = \mathbb{E}\!\left[ \sum_{i=1}^{S} \mathbb{I}(x_k^i=m) \frac{1}{1-t} \mathrm{CE}\!\left(G_\phi^i(\mathbf{x}_k,\mathbf{z}),\, \mathbb{I}[z^i=x_1^i]\right) \right]. \end{equation}

The learned planner can then be interpreted as a consistency scorer: positions whose sampled token looks reliable under the current partially denoised context receive more planner mass.

Example: one sampling step with a soft greedy planner

To illustrate one sampling step, take the vocabulary V={A,B,m}\mathcal{V}=\{A,B,m\} and sequences of length S=3S=3. Suppose that after one planner step (k=1k=1), the current sequence is

x1=(A,m,m),\begin{equation} \htmlData{equation-label=eq:planner-example-current}{\htmlId{eq:planner-example-current}{}} \mathbf{x}_1 = (A,m,m), \end{equation}

so positions 22 and 33 are still masked. The denoiser proposes a full candidate sequence by sampling token-wise:

z∼Dθ(x1),for example z=(A,A,B).\begin{equation} \htmlData{equation-label=eq:planner-example-candidate}{\htmlId{eq:planner-example-candidate}{}} \mathbf{z} \sim D_\theta(\mathbf{x}_1), \qquad \text{for example } \mathbf{z}=(A,A,B). \end{equation}

For this sampled candidate, the planner only looks at the denoiser confidence assigned to the proposed token at each still-masked position, and assigns zero mass to positions that are already unmasked.

G~(z,x1):=(0Dθ2(x1)z2=ADθ3(x1)z3=B)=(00.60.7).\begin{align} \widetilde{G}(\mathbf{z}, \mathbf{x}_1) \htmlData{equation-label=eq:planner-example-confidence-1}{\htmlId{eq:planner-example-confidence-1}{}} &:= \begin{pmatrix} 0 \\ D_\theta^2(\mathbf{x}_1)_{z^2 = A} \\ D_\theta^3(\mathbf{x}_1)_{z^3 = B} \end{pmatrix} \htmlData{equation-label=eq:planner-example-confidence-2}{\htmlId{eq:planner-example-confidence-2}{}} \\ &= \begin{pmatrix} 0 \\ 0.6 \\ 0.7 \end{pmatrix}. \htmlData{equation-label=eq:planner-example-confidence-3}{\htmlId{eq:planner-example-confidence-3}{}} \end{align}

Setting the temperature to τ=1/3\tau = 1/3, the planner scales these scores by a power of 1/τ=31/\tau = 3 and normalizes them:

G1/3(z,x1)=10.63+0.73(00.630.73)≈(00.3860.614).\begin{align} G_{1/3}(\mathbf{z}, \mathbf{x}_1) \htmlData{equation-label=eq:planner-example-prob-1}{\htmlId{eq:planner-example-prob-1}{}} &= \frac{1}{0.6^3 + 0.7^3} \begin{pmatrix} 0 \\ 0.6^3 \\ 0.7^3 \end{pmatrix} \htmlData{equation-label=eq:planner-example-prob-2}{\htmlId{eq:planner-example-prob-2}{}} \\ &\approx \begin{pmatrix} 0 \\ 0.386 \\ 0.614 \end{pmatrix}. \htmlData{equation-label=eq:planner-example-prob-3}{\htmlId{eq:planner-example-prob-3}{}} \end{align}

This means that the planner is more likely to reveal position 33, because the sampled token z3=Bz^3=B received higher denoiser confidence than z2=Az^2=A. If we take the limit cases for the temperature, we get:

G0(z,x1)=(001),G∞(z,x1)=(01212).\begin{align} G_{0}(\mathbf{z}, \mathbf{x}_1) &= \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}, \qquad G_{\infty}(\mathbf{z}, \mathbf{x}_1) &= \begin{pmatrix} 0 \\ \frac{1}{2} \\ \frac{1}{2} \end{pmatrix}. \end{align}

If the planner samples position 33, then the next sequence is obtained by copying only that proposed token:

x2=(A,m,B).\begin{equation} \htmlData{equation-label=eq:planner-example-next}{\htmlId{eq:planner-example-next}{}} \mathbf{x}_2 = (A,m,B). \end{equation}

The figure below illustrates the sampling with a planner.

Discrete Flow Matching Sampling

S=4, 𝒱={A, B, m}, mask source, 4 planner steps (dt=0.250) · sample #1

Step 1/4t = 0.25
m
pos 1
m
pos 2
m
pos 3
m
pos 4
P(x1|xt)
pos 10.79A0.21B0.00m
pos 20.86A0.14B0.00m
pos 30.67A0.33B0.00m
pos 40.60A0.40B0.00m
Planner Gφdemasking 1 position (S/N = 4/4)
A
z1
A
z2
A
z3
A
z4
Gφ(τ=1) selection prob.0.27p10.29p20.23p30.21p4
steps(max S)
seed
τ
slowfast
A
B
m (mask)

Figure 8: Flow-matching sampling with the soft greedy planner with Algorithm 5. Try changing the temperature τ\tau to make the selection more diffuse or more sharply confidence-based.

Exposure bias

Introducing a planner-aware sampling process creates a mismatch between training and inference. During training, the standard objective masks tokens uniformly at random across all positions and orderings. During inference, the planner reveals tokens along a specific, confidence-guided trajectory.

This difference matters because uniform masking can put training weight on mask patterns that the planner would almost never visit in practice. For example, in a structured sequence where the last token is only predictable after the first two have been revealed, uniform masking may still train the model to predict that last token from (m,m,m)(m,m,m) or from (m,m,B)(m,m,B), while a confidence-based planner would first reveal easier positions and avoid asking for that token with so little context. These hard denoising tasks can inject extra error into the learned denoiser, and those errors can then be amplified during sampling when early wrong predictions are irreversible.

A fix is to reweight the denoising loss Eq. (?) toward the positions the planner would select. This gives the Planner-Aware Path Learning (PAPL) objective [4]:

LPAPL(θ)=−Et,x1,xt[∑i=1SI(xti=m)(1+αsg⁡[wi])log⁡Pθ,ti(X1i=x1i∣xt)]\begin{equation} \htmlData{equation-label=eq:papl-loss}{\htmlId{eq:papl-loss}{}} \mathcal{L}_{\text{PAPL}}(\theta) = - \mathbb{E}_{t,\mathbf{x}_1,\mathbf{x}_t} \left[ \sum_{i=1}^S \mathbb{I}(x_t^i = m)(1 + \alpha \operatorname{sg}[w^i]) \log P_{\theta,t}^i(X_1^i = x_1^i | \mathbf{x}_t) \right] \end{equation}

Here, wi=Gϕ(z,xt)iw^i = G_\phi(\mathbf{z}, \mathbf{x}_t)_i is the normalized planner weight for position ii, and α\alpha controls the strength of this guidance. The stop-gradient sg⁡[⋅]\operatorname{sg}[\cdot] detaches these weights: for example, soft greedy weights depend on θ\theta through softmax⁡i(1τlog⁡Pθ,t(X1i=zi∣Xt=xt))\operatorname{softmax}_i\left(\frac{1}{\tau}\log P_{\theta,t}(X_1^i = z^i | X_t = \mathbf{x}_t)\right), but gradients are not propagated through this dependence.

References

  1. Structured Denoising Diffusion Models in Discrete State-Spaces [PDF]
    Jacob Austin, Daniel D. Johnson, Jonathan Ho, Daniel Tarlow, Rianne van den Berg. NeurIPS 2021.
  1. Generative Flows on Discrete State-Spaces: Enabling Multimodal Flows with Applications to Protein Co-Design [PDF]
    Andrew Campbell, Jason Yim, Regina Barzilay, Tom Rainforth, Tommi Jaakkola. ICML 2024.
  1. Discrete Flow Matching [PDF]
    Itai Gat, Tal Remez, Neta Shaul, Felix Kreuk, Ricky T. Q. Chen, Gabriel Synnaeve, Yossi Adi, Yaron Lipman. NeurIPS 2024.
  1. Planner Aware Path Learning in Diffusion Language Models Training [PDF]
    Fred Zhangzhi Peng, Zachary Bezemek, Jarrid Rector-Brooks, Shuibai Zhang, Anru R. Zhang, Michael Bronstein, Avishek Joey Bose, Alexander Tong. ICLR 2026.
  1. DiGress: Discrete Denoising diffusion for graph generation [PDF]
    Clement Vignac, Igor Krawczuk, Antoine Siraudin, Bohan Wang, Volkan Cevher, Pascal Frossard. ICLR 2023.
  1. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis [PDF]
    Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, Dustin Podell, Tim Dockhorn, Zion English, Kyle Lacey, Alex Goodwin, Yannik Marek, Robin Rombach. ICML 2024.
  1. Stable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets [PDF]
    Andreas Blattmann, Tim Dockhorn, Sumith Kulal, Daniel Mendelevitch, Maciej Kilian, Dominik Lorenz, Yam Levi, Zion English, Vikram Voleti, Adam Letts, Varun Jampani, Robin Rombach. Arxiv 2023.

Notes

Here KL\mathrm{KL} denotes the generalized KL divergence between two positive vectors a,b∈R+da,b \in \mathbb{R}_+^d, KL(a,b)=∑j=1dajlog⁡(aj/bj)−aj+bj\mathrm{KL}(a,b) = \sum_{j=1}^d a_j \log(a_j/b_j) - a_j + b_j.

When applying it to probability velocities, we only compare the off-diagonal entries of ut(x)u_t(\mathbf{x}), i.e. the rates ut(x)yu_t(\mathbf{x})_{\mathbf{y}} for y≠x\mathbf{y}\neq\mathbf{x}. These vectors are indeed positive, and we can skip the diagonal entry since its value is determined by all the other ones due to the zero-sum constraint (Proposition 2).

This exact equivalence relies on the masked source, but does not hold for an arbitrary source distribution p0p_0. However, learning a denoiser is still sufficient to recover the velocity field using Eq. (?), and therefore to generate data samples.