Papers · Generative models · 2022

Flow Matching for Generative Modeling

Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu and others

The notation of the Flow matching paper, explained: its 78 displayed equations, then every symbol it uses, grouped by category and shown the way the paper writes it.

Read the paper on arXiv

Reading this paper

Flow matching: train a network to output a velocity field that carries noise to data, by regressing onto simple per-example target velocities.

The direction of time is the opposite of diffusion papers: here p0p_0 is the noise and p1p_1 (approximately) the data, so samples are made by integrating from t=0t = 0 to t=1t = 1. vtv_t is the learned vector field, ut(x∣x1)u_t(\mathbf{x} \mid \mathbf{x}_1) the target for one data point x1\mathbf{x}_1, and ψt\psi_t the flow (the map that moves points along).

Read from arXiv's HTML version: 78 displayed equations and 160 pieces of inline math. 52 symbols and constructs from the catalog.

The paper's displayed equations

Open any of them in the decoder for a symbol-by-symbol reading.

  1. (1)
    ddtϕt(x)=vt(ϕt(x))\frac{d}{dt}\phi_{t}(x) =v_{t}(\phi_{t}(x))
    Decode →
  2. (2)
    ϕ0(x)=x\phi_{0}(x) =x
    Decode →
  3. (3)
    pt=[ϕt]∗p0p_{t}=[\phi_{t}]_{*}p_{0}
    Decode →
  4. (4)
    [ϕt]∗p0(x)=p0(ϕt−1(x))det⁡[∂ϕt−1∂x(x)].[\phi_{t}]_{*}p_{0}(x)=p_{0}(\phi_{t}^{-1}(x))\det\left[\frac{\partial\phi_{t}^{-1}}{\partial x}(x)\right].
    Decode →
  5. (5)
    LFM(θ)=Et,pt(x)∥vt(x)−ut(x)∥2,\mathcal{L}_{\scriptscriptstyle\text{FM}}(\theta)=\mathbb{E}_{t,p_{t}(x)}\|v_{t}(x)-u_{t}(x)\|^{2},
    Decode →
  6. (6)
    pt(x)=∫pt(x∣x1)q(x1)dx1,p_{t}(x)=\int p_{t}(x|x_{1})q(x_{1})dx_{1},
    Decode →
  7. (7)
    p1(x)=∫p1(x∣x1)q(x1)dx1≈q(x).p_{1}(x)=\int p_{1}(x|x_{1})q(x_{1})dx_{1}\approx q(x).
    Decode →
  8. (8)
    ut(x)=∫ut(x∣x1)pt(x∣x1)q(x1)pt(x)dx1,u_{t}(x)=\int u_{t}(x|x_{1})\frac{p_{t}(x|x_{1})q(x_{1})}{p_{t}(x)}dx_{1},
    Decode →
  9. (9)
    LCFM(θ)=Et,q(x1),pt(x∣x1)∥vt(x)−ut(x∣x1)∥2,\mathcal{L}_{\scriptscriptstyle\text{CFM}}(\theta)=\mathbb{E}_{t,q(x_{1}),p_{t}(x|x_{1})}\big\|v_{t}(x)-u_{t}(x|x_{1})\big\|^{2},
    Decode →
  10. (10)
    pt(x∣x1)=N(x ∣ μt(x1),σt(x1)2I),p_{t}(x|x_{1})={\mathcal{N}}(x\,|\,\mu_{t}(x_{1}),\sigma_{t}(x_{1})^{2}I),
    Decode →
  11. (11)
    ψt(x)=σt(x1)x+μt(x1).\psi_{t}(x)=\sigma_{t}(x_{1})x+\mu_{t}(x_{1}).
    Decode →
  12. (12)
    [ψt]∗p(x)=pt(x∣x1).\left[\psi_{t}\right]_{*}p(x)=p_{t}(x|x_{1}).
    Decode →

Symbols, by category

Most used first. The examples are written as the paper writes them.

Notation conventions

  1. tt, xx, vv

    Italic letters (variables) 869 uses

    A plain italic letter is a variable; conventions say what kind (x input, y target, W weights…).

  2. ϕt\phi_{t}, vtv_{t}, ϕ0\phi_{0}

    Subscript (index or label) 714 uses

    A subscript picks an element (xᵢ), a time step (h_t), a named copy (W_q), or the parameters (p_θ).

  3. (x1)2(x_{1})^{2}, σ1−t2\sigma_{1-t}^{2}, α1−t2\alpha_{1-t}^{2}

    Superscript (power or label) 28 uses

    Usually a power (x² = x·x), but a capital or a word up there is often just a label (W^Q).

  4. f~\tilde{f}, p~\tilde{p}, w~\tilde{w}

    Tilde accent 15 uses

    A modified version of the variable: noisy, corrupted, proposed or intermediate.

  5. ∗*, ⋆\star

    Star (optimal) 11 uses

    As a superscript, the optimal value: θ* is the best θ. Between two terms, convolution.

  6. L\mathcal{L}

    Loss (ℒ) 10 uses

    The loss: the number training tries to make small. Also written L, J(θ) or ℓ.

  7. …\ldots

    Dots (ellipsis) 2 uses

    “And so on”: continue the pattern.

Greek letters

  1. ϕ\phi, φ\varphi

    Phi 57 uses

    The parameters of a second model (often the encoder q_φ), or a feature map φ(x).

  2. σ\sigma

    Sigma (lowercase) 50 uses

    Either the sigmoid function σ(z) = 1/(1+e⁻ᶻ) or a standard deviation. The context decides.

  3. ψ\psi

    Psi 32 uses

    The parameters of a third network (after θ and φ), a feature map, or the digamma function ψ(x).

  4. μ\mu

    Mu 23 uses

    A mean: the average of a distribution, a batch, or a layer’s features.

  5. β\beta

    Beta 18 uses

    Usually a decay rate (Adam’s β₁, β₂), a shift parameter in normalization, or a weight on a loss term.

  6. θ\theta

    Theta 17 uses

    The model’s parameters: all of its weights and biases, as one collection.

  7. α\alpha

    Alpha 12 uses

    Often a learning rate or step size; also attention weights αᵢⱼ or a mixing weight.

  8. ϵ\epsilon

    Epsilon 8 uses

    A tiny constant for numerical safety (10⁻⁸ in Adam), or noise ε ~ 𝒩(0, I).

  9. λ\lambda

    Lambda 4 uses

    Usually the strength of a regularization term; also eigenvalues.

  10. Δ\Delta

    Delta (capital) 2 uses

    A change or update: ΔW is the change to the weights W.

Vectors and matrices

  1. ×\times

    Times (cross) 27 uses

    Usually the “by” in a shape (n × d); also plain multiplication or a cross product.

  2. ϕt−1\phi_{t}^{-1}, ψ−1\psi^{-1}, ψt−1\psi_{t}^{-1}

    Inverse 21 uses

    The matrix inverse, A⁻¹A = I; for a function, its inverse function; for a number, 1/x.

  3. ∥vt(x)−ut(x)∥2\|v_{t}(x)-u_{t}(x)\|^{2}, ∥vt(x)−ut(x∣x1)∥2\|v_{t}(x)-u_{t}(x|x_{1})\big\|^{2}, ∥vt(x)∥2\left\|v_{t}(x)\right\|^{2}

    Norm 19 uses

    The length (size) of a vector. With subscript 2 or none, the Euclidean length √(Σxᵢ²).

  4. KK

    Q, K, V (query, key, value) 13 uses

    In attention: queries Q, keys K and values V, each a matrix with one row per token.

  5. Bold uppercase (matrix) 10 uses

    A bold capital letter is a matrix (or a higher-order tensor).

  6. ⟨vt(x),ut(x)⟩\left\langle v_{t}(x),u_{t}(x)\right\rangle

    Inner product (angle brackets) 7 uses

    The inner (dot) product of two vectors: multiply matching entries and add.

  7. det⁡\det

    Determinant 5 uses

    A number from a square matrix: how much it scales volume. Zero means it is not invertible.

  8. zTz^{T}, [ϕt(x),f(t)]T\left[\phi_{t}(x),f(t)\right]^{T}

    Transpose 5 uses

    Swap rows and columns. xᵀy is a dot product; xyᵀ is an outer product.

  9. ⋅\cdot

    Centre dot 4 uses

    A dot product between vectors, plain multiplication between numbers, or an empty slot f(·).

Calculus and gradients

  1. σt′\sigma^{\prime}_{t}, μt′\mu^{\prime}_{t}, σ1−t′\sigma^{\prime}_{1-t}

    Prime 25 uses

    Either a derivative, f′(x), or simply "another one": x′ is a second sample, s′ the next state.

  2. ∫\int, ∫0t\int_{0}^{t}, ∫01\int_{0}^{1}

    Integral 22 uses

    An integral: a continuous sum. In ML it is usually an expectation or a marginalization.

  3. ddt\frac{d}{dt}, dds\frac{d}{ds}, dptdt\frac{dp_{t}}{dt}

    Derivative (d/dx) 17 uses

    An ordinary derivative: the rate of change of one quantity with respect to one variable.

  4. ∇\nabla, ∇θ\nabla_{\theta}

    Nabla (gradient) 10 uses

    The gradient: the vector of partial derivatives. ∇_θ L is how the loss changes with each parameter.

  5. ∂ϕt−1∂x\frac{\partial\phi_{t}^{-1}}{\partial x}, ∂∂xi\frac{\partial}{\partial x^{i}}

    Partial derivative 2 uses

    A partial derivative: how one quantity changes when one input changes and the others are held fixed.

  6. ∞\infty

    Infinity 1 use

    Infinity; as a norm subscript, ‖x‖_∞ is the largest absolute entry.

Probability and statistics

  1. pp, qq

    Probability p(x) 215 uses

    A probability or probability density; p is usually the true or model distribution, q an approximation.

  2. ∣|

    Given (conditional bar) 87 uses

    “Given”: p(y | x) is the probability of y given that x is known.

  3. log⁡\log

    Logarithm 40 uses

    A logarithm, almost always the natural log (base e) in ML papers.

  4. Et,pt(x)\mathbb{E}_{t,p_{t}(x)}, Et,q(x1),pt(x∣x1)\mathbb{E}_{t,q(x_{1}),p_{t}(x|x_{1})}, Et,q(x1),p(x0)\mathbb{E}_{t,q(x_{1}),p(x_{0})}

    Expectation 19 uses

    The expected value: the average of what is inside, weighted by the probabilities in the subscript.

  5. e−12T(t)e^{-\frac{1}{2}T(t)}, e−T(1−t)e^{-T(1-t)}, e−12T(1−t)e^{-\frac{1}{2}T(1-t)}

    Exponential 15 uses

    The exponential function eˣ, with e ≈ 2.718. Always positive.

  6. N\mathcal{N}

    Normal distribution 12 uses

    The normal (Gaussian) distribution with the given mean and variance.

  7. ∼\sim

    Distributed as (tilde) 7 uses

    “Is drawn from” or “is distributed as”: x ~ p means x is a sample from the distribution p.

  8. U\mathcal{U}

    Uniform distribution 3 uses

    𝒰(a, b) is the uniform distribution: every value between a and b is equally likely.

  9. ;;

    Semicolon (parameterized by) 1 use

    In p(x; θ), the semicolon separates the variable x from fixed parameters θ.

Functions and operators

  1. pt(x∣x1)q(x1)pt(x)\frac{p_{t}(x|x_{1})q(x_{1})}{p_{t}(x)}, σ1−t′σ1−t\frac{\sigma^{\prime}_{1-t}}{\sigma_{1-t}}, 12\frac{1}{2}

    Fraction 46 uses

    Division: the top divided by the bottom.

  2. ::, →\rightarrow

    Arrow (maps to) 24 uses

    Maps to (f: X → Y), tends to (x → 0), or implies (⇒).

  3. min\text{min}, min⁡\min, max⁡\max

    Max and min 14 uses

    The largest (or smallest) value, over the arguments or over the range in the subscript.

  4. ddtσt2\sqrt{\frac{d}{dt}\sigma_{t}^{2}}, T′(t)\sqrt{T^{\prime}(t)}, T′(s)\sqrt{T^{\prime}(s)}

    Square root 6 uses

    The square root. In attention, dividing by √d_k keeps dot products at a sensible scale.

  5. ∑k=1K\sum_{k=1}^{K}, ∑i=1d\sum_{i=1}^{d}

    Summation 2 uses

    Add up the expression for every value of the index, from the bottom limit to the top.

  6. ∘\circ

    Composition (circle) 1 use

    Function composition: (f ∘ g)(x) = f(g(x)). Some papers use it for elementwise products.

Sets, shapes and definitions

  1. Rd\mathbb{R}^{d}, Rp\mathbb{R}^{p}

    Tensor shapes 23 uses

    ℝ with a superscript of sizes joined by × declares an array’s shape: ℝ^{B×T×d} is a 3-axis tensor.

  2. ∈\in

    Element of 12 uses

    “Is in” or “belongs to”: x ∈ S says x is a member of the set S.

  3. >>, ≫\gg, ≤\leq

    Inequalities 8 uses

    Less than / greater than (or equal). ≪ means “much smaller than”.

  4. R\mathbb{R}

    Real numbers (ℝ) and shapes 3 uses

    The real numbers. ℝⁿˣᵈ is the set of n × d arrays of reals: it states a shape.

  5. ≈\approx

    Approximately equal 2 uses

    Approximately equal: often a Monte Carlo estimate or a Taylor approximation.

5 things the catalog has no entry for yet
  • div\mathrm{div} div 19
  • ↓\downarrow \downarrow 12
  • id\mathrm{id} id 4
  • ↑\uparrow \uparrow 3
  • BPD\mathrm{BPD} BPD 2

Formulas from arXiv's HTML version of the paper, © their authors; the explanations are this site's. Title and authors as arXiv lists them.

More generative models papers