Papers · Generative models · 2021

High-Resolution Image Synthesis with Latent Diffusion Models

Robin Rombach, Andreas Blattmann, Dominik Lorenz and others

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

Read the paper on arXiv

Read from arXiv's HTML version: 26 displayed equations and 205 pieces of inline math. 55 symbols and constructs from the catalog, read as probability and statistics.

The paper's displayed equations

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

  1. (1)
    LDM=Ex,ϵ∼N(0,1),t[∥ϵ−ϵθ(xt,t)∥22] ,L_{DM}=\mathbb{E}_{x,\epsilon\sim\mathcal{N}(0,1),t}\Big[\|\epsilon-\epsilon_{\theta}(x_{t},t)\|_{2}^{2}\Big]\,,
    Decode →
  2. (2)
    LLDM:=EE(x),ϵ∼N(0,1),t[∥ϵ−ϵθ(zt,t)∥22] .L_{LDM}:=\mathbb{E}_{\mathcal{E}(x),\epsilon\sim\mathcal{N}(0,1),t}\Big[\|\epsilon-\epsilon_{\theta}(z_{t},t)\|_{2}^{2}\Big]\,.
    Decode →
  3. Q=WQ(i)⋅φi(zt),  K=WK(i)⋅τθ(y),  V=WV(i)⋅τθ(y).Q=W^{(i)}_{Q}\cdot\varphi_{i}(z_{t}),\;K=W^{(i)}_{K}\cdot\tau_{\theta}(y),\;V=W^{(i)}_{V}\cdot\tau_{\theta}(y).
    Decode →
  4. (3)
    LLDM:=EE(x),y,ϵ∼N(0,1),t[∥ϵ−ϵθ(zt,t,τθ(y))∥22] ,L_{LDM}:=\mathbb{E}_{\mathcal{E}(x),y,\epsilon\sim\mathcal{N}(0,1),t}\Big[\|\epsilon-\epsilon_{\theta}(z_{t},t,\tau_{\theta}(y))\|_{2}^{2}\Big]\,,
    Decode →
  5. (4)
    q(xt∣x0)=N(xt∣αtx0,σt2I)q(x_{t}|x_{0})=\mathcal{N}(x_{t}|\alpha_{t}x_{0},\sigma_{t}^{2}\mathbb{I})
    Decode →
  6. (5)
    q(xt∣xs)=N(xt∣αt∣sxs,σt∣s2I)q(x_{t}|x_{s}) =\mathcal{N}(x_{t}|\alpha_{t|s}x_{s},\sigma_{t|s}^{2}\mathbb{I})
    Decode →
  7. (6)
    αt∣s=αtαs\alpha_{t|s} =\frac{\alpha_{t}}{\alpha_{s}}
    Decode →
  8. (7)
    σt∣s2=σt2−αt∣s2σs2\sigma_{t|s}^{2} =\sigma_{t}^{2}-\alpha_{t|s}^{2}\sigma_{s}^{2}
    Decode →
  9. (8)
    p(x0)=∫zp(xT)∏t=1Tp(xt−1∣xt)p(x_{0})=\int_{z}p(x_{T})\prod_{t=1}^{T}p(x_{t-1}|x_{t})
    Decode →
  10. (9)
    −log⁡p(x0)≤KL(q(xT∣x0)∣p(xT))+∑t=1TEq(xt∣x0)KL(q(xt−1∣xt,x0)∣p(xt−1∣xt))-\log p(x_{0})\leq\mathbb{KL}(q(x_{T}|x_{0})|p(x_{T}))+\sum_{t=1}^{T}\mathbb{E}_{q(x_{t}|x_{0})}\mathbb{KL}(q(x_{t-1}|x_{t},x_{0})|p(x_{t-1}|x_{t}))
    Decode →
  11. (10)
    p(xt−1∣xt)≔q(xt−1∣xt,xθ(xt,t))p(x_{t-1}|x_{t}) \coloneqq q(x_{t-1}|x_{t},x_{\theta}(x_{t},t))
    Decode →
  12. (11)
    =N(xt−1∣μθ(xt,t),σt∣t−12σt−12σt2I),=\mathcal{N}(x_{t-1}|\mu_{\theta}(x_{t},t),\sigma_{t|t-1}^{2}\frac{\sigma_{t-1}^{2}}{\sigma_{t}^{2}}\mathbb{I}),
    Decode →

Famous equations in this paper

Symbols, by category

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

Notation conventions

  1. LL, xx, tt

    Italic letters (variables) 283 uses

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

  2. LDML_{DM}, ϵθ\epsilon_{\theta}, xtx_{t}

    Subscript (index or label) 213 uses

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

  3. σt2\sigma_{t}^{2}, σt∣s2\sigma_{t|s}^{2}, αt∣s2\alpha_{t|s}^{2}

    Superscript (power or label) 68 uses

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

  4. E\mathcal{E}, Z\mathcal{Z}

    Calligraphic letters 29 uses

    A script capital usually names a set, a space, a distribution or a loss.

  5. D\mathcal{D}

    Dataset (𝒟) 14 uses

    The dataset: usually N input-label pairs.

  6. WQ(i)W^{(i)}_{Q}, WK(i)W^{(i)}_{K}, WV(i)W^{(i)}_{V}

    Superscript in parentheses 6 uses

    An index in a superscript: x⁽ⁱ⁾ is the i-th training example, W⁽ˡ⁾ the weights of layer l. Not a power.

  7. ϵ^\hat{\epsilon}, σ^\hat{\sigma}, μ^\hat{\mu}

    Hat (estimate) 6 uses

    A hat marks an estimate or prediction: ŷ is the model’s guess for y.

  8. …\dots

    Dots (ellipsis) 3 uses

    “And so on”: continue the pattern.

  9. x~\tilde{x}

    Tilde accent 1 use

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

  10. ∗^{*}

    Star (optimal) 1 use

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

Greek letters

  1. θ\theta

    Theta 37 uses

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

  2. ϵ\epsilon, ε\varepsilon

    Epsilon 29 uses

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

  3. σ\sigma

    Sigma (lowercase) 26 uses

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

  4. τ\tau

    Tau 20 uses

    A temperature that sharpens or flattens a softmax; in RL, a trajectory.

  5. ζ\zeta

    Zeta 17 uses

    A spare letter: an auxiliary variable, a noise term, or the Riemann zeta function ζ(s).

  6. α\alpha

    Alpha 16 uses

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

  7. η\eta

    Eta 8 uses

    The learning rate in most gradient-descent papers.

  8. φ\varphi, Φ\Phi

    Phi 7 uses

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

  9. μ\mu

    Mu 6 uses

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

  10. ψ\psi

    Psi 3 uses

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

  11. κ\kappa

    Kappa 2 uses

    A condition number κ(A), a kernel function κ(x, x′), or a concentration parameter.

Vectors and matrices

  1. ×\times

    Times (cross) 97 uses

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

  2. ⋅\cdot

    Centre dot 15 uses

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

  3. ∥ϵ−ϵθ(xt,t)∥22\|\epsilon-\epsilon_{\theta}(x_{t},t)\|_{2}^{2}, ∥ϵ−ϵθ(zt,t)∥22\|\epsilon-\epsilon_{\theta}(z_{t},t)\|_{2}^{2}, ∥y−T(D(z0(zt)))∥22\|y-T(\mathcal{D}(z_{0}(z_{t})))\|^{2}_{2}

    Norm 7 uses

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

  4. ∣Z∣|\mathcal{Z}|

    Absolute value (bars) 7 uses

    Absolute value of a number; for a set, its size; for a matrix, sometimes its determinant.

  5. KTK^{T}, (αt)t=1T(\alpha_{t})_{t=1}^{T}, (σt)t=1T(\sigma_{t})_{t=1}^{T}

    Transpose 3 uses

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

  6. †\dagger

    Dagger / pseudo-inverse 1 use

    The Moore–Penrose pseudo-inverse A⁺ (written A† in many ML papers); in physics, the conjugate transpose.

Calculus and gradients

  1. ∫z\int_{z}

    Integral 1 use

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

  2. ∇zt\nabla_{z_{t}}

    Nabla (gradient) 1 use

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

Probability and statistics

  1. QQ, qq, pp

    Probability p(x) 38 uses

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

  2. ∣|

    Given (conditional bar) 36 uses

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

  3. N\mathcal{N}

    Normal distribution 10 uses

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

  4. Ex,ϵ∼N(0,1),t\mathbb{E}_{x,\epsilon\sim\mathcal{N}(0,1),t}, Eq(xt∣x0)\mathbb{E}_{q(x_{t}|x_{0})}, EN(ϵ∣0,I)\mathbb{E}_{\mathcal{N}(\epsilon|0,\mathbb{I})}

    Expectation 6 uses

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

  5. ∼\sim

    Distributed as (tilde) 6 uses

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

  6. log⁡\log

    Logarithm 6 uses

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

  7. I\mathbb{I}

    Indicator function 4 uses

    1 when the condition inside is true, 0 when it is false.

  8. ;;

    Semicolon (parameterized by) 4 uses

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

Functions and operators

  1. ±\pm

    Plus or minus 122 uses

    Both signs at once: a ± b means a + b and a − b. In results tables, a mean and its spread.

  2. αtαs\frac{\alpha_{t}}{\alpha_{s}}, σt−12σt2\frac{\sigma_{t-1}^{2}}{\sigma_{t}^{2}}, 12\frac{1}{2}

    Fraction 14 uses

    Division: the top divided by the bottom.

  3. ←\leftarrow

    Assignment arrow 8 uses

    Assignment in an algorithm: replace the variable on the left with the value on the right.

  4. ∑t=1T\sum_{t=1}^{T}, ∑b,c,h,w\sum_{b,c,h,w}

    Summation 5 uses

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

  5. ::, →\rightarrow

    Arrow (maps to) 3 uses

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

  6. 1−αt2\sqrt{1-\alpha_{t}^{2}}, d\sqrt{d}

    Square root 2 uses

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

  7. MLP\text{MLP}

    Feed-forward network (FFN, MLP) 2 uses

    A small network applied to each position: a linear layer, an activation, and another linear layer.

  8. min⁡E,D\min_{\mathcal{E},\mathcal{D}}, max⁡ψ\max_{\psi}

    Max and min 2 uses

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

  9. ∏t=1T\prod_{t=1}^{T}

    Product 1 use

    Multiply the expression for every value of the index.

  10. ∘\circ

    Composition (circle) 1 use

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

  11. softmax\text{softmax}

    Softmax 1 use

    Turns a vector of scores into probabilities: exponentiate each, then divide by the total.

  12. Cases (piecewise) 1 use

    A piecewise definition: the value on each line applies when that line’s condition holds.

Sets, shapes and definitions

  1. RH×W×3\mathbb{R}^{H\times W\times 3}, Rh×w×c\mathbb{R}^{h\times w\times c}, RM×dτ\mathbb{R}^{M\times d_{\tau}}

    Tensor shapes 18 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. {1,…,T}\{1,\dots,T\}, {\{, {10,20,50,100,200}\{10,20,50,100,200\}

    Set braces 9 uses

    A set: a collection of items. {x | condition} is every x that satisfies the condition.

  4. :=:=, ≔\coloneqq

    Defined as (:=) 4 uses

    “Is defined as”: introduces a new name for the expression on the other side.

  5. ≤\leq, >>, <<

    Inequalities 4 uses

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

  6. N\mathbb{N}

    Real numbers (ℝ) and shapes 1 use

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

4 things the catalog has no entry for yet
  • ↑\uparrow \uparrow 29
  • ↓\downarrow \downarrow 19
  • }\} \} 5
  • KL\mathbb{KL} KL 4

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