Papers · Generative models · 2020

Denoising Diffusion Probabilistic Models

Jonathan Ho, Ajay Jain, Pieter Abbeel

The notation of the DDPM 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

Reading this paper

DDPM: generate images by learning to undo a process that adds Gaussian noise step by step. The training loss turns out to be a simple squared error on the noise.

The schedule is a set of variances β1,…,βT\beta_1, \ldots, \beta_T. The paper then defines αt:=1−βt\alpha_t := 1 - \beta_t and αˉt:=∏s=1tαs\bar{\alpha}_t := \prod_{s=1}^{t} \alpha_s; the bar here is a cumulative product, not an average. x0\mathbf{x}_0 is the data and x1:T\mathbf{x}_{1:T} the increasingly noisy versions; qq is the fixed forward process and pθp_\theta the learned reverse one. ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) is the network: it predicts the noise in xt\mathbf{x}_t.

Read from arXiv's HTML version: 26 displayed equations and 183 pieces of inline math. 49 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)
    pθ(x0:T)≔p(xT)∏t=1Tpθ(xt−1∣xt),pθ(xt−1∣xt)≔N(xt−1;μθ(xt,t),Σθ(xt,t))p_{\theta}(\mathbf{x}_{0:T}) \coloneqq p(\mathbf{x}_{T})\prod_{t=1}^{T}p_{\theta}(\mathbf{x}_{t-1}|\mathbf{x}_{t}),\qquad p_{\theta}(\mathbf{x}_{t-1}|\mathbf{x}_{t})\coloneqq\mathcal{N}(\mathbf{x}_{t-1};{\boldsymbol{\mu}}_{\theta}(\mathbf{x}_{t},t),{\boldsymbol{\Sigma}}_{\theta}(\mathbf{x}_{t},t))
    Decode →
  2. (2)
    q(x1:T∣x0)≔∏t=1Tq(xt∣xt−1),q(xt∣xt−1)≔N(xt;1−βtxt−1,βtI)q(\mathbf{x}_{1:T}|\mathbf{x}_{0}) \coloneqq\prod_{t=1}^{T}q(\mathbf{x}_{t}|\mathbf{x}_{t-1}),\qquad q(\mathbf{x}_{t}|\mathbf{x}_{t-1})\coloneqq\mathcal{N}(\mathbf{x}_{t};\sqrt{1-\beta_{t}}\mathbf{x}_{t-1},\beta_{t}\mathbf{I})
    Decode →
  3. (3)
    E[−log⁡pθ(x0)]≤Eq ⁣[−log⁡pθ(x0:T)q(x1:T∣x0)]=Eq[−log⁡p(xT)−∑t≥1log⁡pθ(xt−1∣xt)q(xt∣xt−1)]≕L\mathbb{E}\left[-\log p_{\theta}(\mathbf{x}_{0})\right]\leq\mathbb{E}_{q}\!\left[-\log\frac{p_{\theta}(\mathbf{x}_{0:T})}{q(\mathbf{x}_{1:T}|\mathbf{x}_{0})}\right]=\mathbb{E}_{q}\bigg[-\log p(\mathbf{x}_{T})-\sum_{t\geq 1}\log\frac{p_{\theta}(\mathbf{x}_{t-1}|\mathbf{x}_{t})}{q(\mathbf{x}_{t}|\mathbf{x}_{t-1})}\bigg]\eqqcolon L
    Decode →
  4. (4)
    q(xt∣x0)=N(xt;αˉtx0,(1−αˉt)I)q(\mathbf{x}_{t}|\mathbf{x}_{0})=\mathcal{N}(\mathbf{x}_{t};\sqrt{\bar{\alpha}_{t}}\mathbf{x}_{0},(1-\bar{\alpha}_{t})\mathbf{I})
    Decode →
  5. (5)
    Eq[DKL ⁣(q(xT∣x0) ∥ p(xT))⏟LT+∑t>1DKL ⁣(q(xt−1∣xt,x0) ∥ pθ(xt−1∣xt))⏟Lt−1−log⁡pθ(x0∣x1)⏟L0]\mathbb{E}_{q}\bigg[\underbrace{D_{\mathrm{KL}}\!\left(q(\mathbf{x}_{T}|\mathbf{x}_{0})~\|~p(\mathbf{x}_{T})\right)}_{L_{T}}+\sum_{t>1}\underbrace{D_{\mathrm{KL}}\!\left(q(\mathbf{x}_{t-1}|\mathbf{x}_{t},\mathbf{x}_{0})~\|~p_{\theta}(\mathbf{x}_{t-1}|\mathbf{x}_{t})\right)}_{L_{t-1}}\underbrace{-\log p_{\theta}(\mathbf{x}_{0}|\mathbf{x}_{1})}_{L_{0}}\bigg]
    Decode →
  6. (6)
    q(xt−1∣xt,x0)=N(xt−1;μ~t(xt,x0),β~tI),q(\mathbf{x}_{t-1}|\mathbf{x}_{t},\mathbf{x}_{0}) =\mathcal{N}(\mathbf{x}_{t-1};\tilde{\boldsymbol{\mu}}_{t}(\mathbf{x}_{t},\mathbf{x}_{0}),\tilde{\beta}_{t}\mathbf{I}),
    Decode →
  7. (7)
    whereμ~t(xt,x0)≔αˉt−1βt1−αˉtx0+αt(1−αˉt−1)1−αˉtxtandβ~t≔1−αˉt−11−αˉtβt\text{where}\quad\tilde{\boldsymbol{\mu}}_{t}(\mathbf{x}_{t},\mathbf{x}_{0}) \coloneqq\frac{\sqrt{\bar{\alpha}_{t-1}}\beta_{t}}{1-\bar{\alpha}_{t}}\mathbf{x}_{0}+\frac{\sqrt{\alpha_{t}}(1-\bar{\alpha}_{t-1})}{1-\bar{\alpha}_{t}}\mathbf{x}_{t}\quad\text{and}\quad\tilde{\beta}_{t}\coloneqq\frac{1-\bar{\alpha}_{t-1}}{1-\bar{\alpha}_{t}}\beta_{t}
    Decode →
  8. (8)
    Lt−1=Eq ⁣[12σt2∥μ~t(xt,x0)−μθ(xt,t)∥2]+CL_{t-1}=\mathbb{E}_{q}\!\left[\frac{1}{2\sigma_{t}^{2}}\|\tilde{\boldsymbol{\mu}}_{t}(\mathbf{x}_{t},\mathbf{x}_{0})-{\boldsymbol{\mu}}_{\theta}(\mathbf{x}_{t},t)\|^{2}\right]+C
    Decode →
  9. (9)
    Lt−1−C=Ex0,ϵ ⁣[12σt2∥μ~t ⁣(xt(x0,ϵ),1αˉt(xt(x0,ϵ)−1−αˉtϵ))−μθ(xt(x0,ϵ),t)∥2]L_{t-1}-C =\mathbb{E}_{\mathbf{x}_{0},{\boldsymbol{\epsilon}}}\!\left[\frac{1}{2\sigma_{t}^{2}}\left\|\tilde{\boldsymbol{\mu}}_{t}\!\left(\mathbf{x}_{t}(\mathbf{x}_{0},{\boldsymbol{\epsilon}}),\frac{1}{\sqrt{\bar{\alpha}_{t}}}(\mathbf{x}_{t}(\mathbf{x}_{0},{\boldsymbol{\epsilon}})-\sqrt{1-\bar{\alpha}_{t}}{\boldsymbol{\epsilon}})\right)-{\boldsymbol{\mu}}_{\theta}(\mathbf{x}_{t}(\mathbf{x}_{0},{\boldsymbol{\epsilon}}),t)\right\|^{2}\right]
    Decode →
  10. (10)
    =Ex0,ϵ ⁣[12σt2∥1αt(xt(x0,ϵ)−βt1−αˉtϵ)−μθ(xt(x0,ϵ),t)∥2]=\mathbb{E}_{\mathbf{x}_{0},{\boldsymbol{\epsilon}}}\!\left[\frac{1}{2\sigma_{t}^{2}}\left\|\frac{1}{\sqrt{\alpha_{t}}}\left(\mathbf{x}_{t}(\mathbf{x}_{0},{\boldsymbol{\epsilon}})-\frac{\beta_{t}}{\sqrt{1-\bar{\alpha}_{t}}}{\boldsymbol{\epsilon}}\right)-{\boldsymbol{\mu}}_{\theta}(\mathbf{x}_{t}(\mathbf{x}_{0},{\boldsymbol{\epsilon}}),t)\right\|^{2}\right]
    Decode →
  11. (11)
    μθ(xt,t)=μ~t ⁣(xt,1αˉt(xt−1−αˉtϵθ(xt)))=1αt(xt−βt1−αˉtϵθ(xt,t)){\boldsymbol{\mu}}_{\theta}(\mathbf{x}_{t},t)=\tilde{\boldsymbol{\mu}}_{t}\!\left(\mathbf{x}_{t},\frac{1}{\sqrt{\bar{\alpha}_{t}}}(\mathbf{x}_{t}-\sqrt{1-\bar{\alpha}_{t}}{\boldsymbol{\epsilon}}_{\theta}(\mathbf{x}_{t}))\right)=\frac{1}{\sqrt{\alpha_{t}}}\left(\mathbf{x}_{t}-\frac{\beta_{t}}{\sqrt{1-\bar{\alpha}_{t}}}{\boldsymbol{\epsilon}}_{\theta}(\mathbf{x}_{t},t)\right)
    Decode →
  12. (12)
    Ex0,ϵ ⁣[βt22σt2αt(1−αˉt)∥ϵ−ϵθ(αˉtx0+1−αˉtϵ,t)∥2]\mathbb{E}_{\mathbf{x}_{0},{\boldsymbol{\epsilon}}}\!\left[\frac{\beta_{t}^{2}}{2\sigma_{t}^{2}\alpha_{t}(1-\bar{\alpha}_{t})}\left\|{\boldsymbol{\epsilon}}-{\boldsymbol{\epsilon}}_{\theta}(\sqrt{\bar{\alpha}_{t}}\mathbf{x}_{0}+\sqrt{1-\bar{\alpha}_{t}}{\boldsymbol{\epsilon}},t)\right\|^{2}\right]
    Decode →

Famous equations in this paper

Symbols, by category

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

Notation conventions

  1. pθp_{\theta}, x0:T\mathbf{x}_{0:T}, xT\mathbf{x}_{T}

    Subscript (index or label) 504 uses

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

  2. tt, LL, CC

    Italic letters (variables) 122 uses

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

  3. αˉ\bar{\alpha}, xˉ\bar{\mathbf{x}}

    Bar (mean) 34 uses

    A bar usually marks an average: x̄ is the mean of the x values.

  4. σt2\sigma_{t}^{2}, βt2\beta_{t}^{2}, x0ix_{0}^{i}

    Superscript (power or label) 22 uses

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

  5. μ~\tilde{\boldsymbol{\mu}}, β~\tilde{\beta}, ϵ~\tilde{\boldsymbol{\epsilon}}

    Tilde accent 17 uses

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

  6. …\dotsc, ⋯\cdots

    Dots (ellipsis) 11 uses

    “And so on”: continue the pattern.

  7. x^\hat{\mathbf{x}}

    Hat (estimate) 5 uses

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

  8. Underbrace and overbrace 3 uses

    A horizontal brace under or over part of a formula labels that part. It adds no math.

Greek letters

  1. θ\theta

    Theta 78 uses

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

  2. α\alpha

    Alpha 41 uses

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

  3. ϵ\epsilon

    Epsilon 41 uses

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

  4. β\beta

    Beta 30 uses

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

  5. μ\mu

    Mu 27 uses

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

  6. σ\sigma

    Sigma (lowercase) 13 uses

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

  7. Σ\Sigma

    Sigma (capital) 9 uses

    A covariance matrix, or the diagonal matrix of singular values in an SVD. Not the summation sign.

  8. δ\delta

    Delta (lowercase) 4 uses

    A small change, or the error signal δ = ∂L/∂z in backpropagation.

  9. λ\lambda

    Lambda 3 uses

    Usually the strength of a regularization term; also eigenvalues.

Vectors and matrices

  1. x\mathbf{x}, μ\boldsymbol{\mu}, ϵ\boldsymbol{\epsilon}

    Bold lowercase (vector) 397 uses

    A bold lowercase letter is a vector: a list of numbers.

  2. ×\times

    Times (cross) 24 uses

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

  3. I\mathbf{I}

    Identity matrix 16 uses

    The matrix with 1s on the diagonal and 0s elsewhere; multiplying by it changes nothing.

  4. Σ\boldsymbol{\Sigma}

    Bold uppercase (matrix) 9 uses

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

  5. ∥x0−x^0∥2\|\mathbf{x}_{0}-\hat{\mathbf{x}}_{0}\|^{2}

    Norm 9 uses

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

  6. ⋅\cdot

    Centre dot 2 uses

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

Calculus and gradients

  1. x0′\mathbf{x}^{\prime}_{0}, xt′\mathbf{x}^{\prime}_{t}

    Prime 4 uses

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

  2. ∫\int

    Integral 2 uses

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

  3. ∞\infty

    Infinity 2 uses

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

  4. ∇θ\nabla_{\theta}

    Nabla (gradient) 1 use

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

Probability and statistics

  1. pp, qq

    Probability p(x) 134 uses

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

  2. ∣|

    Given (conditional bar) 71 uses

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

  3. DKLD_{\mathrm{KL}}, ∥\|

    KL divergence 26 uses

    How different distribution q is from p. Zero when they match; not symmetric.

  4. log⁡\log

    Logarithm 25 uses

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

  5. ∼\sim

    Distributed as (tilde) 21 uses

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

  6. E\mathbb{E}, Eq\mathbb{E}_{q}

    Expectation 20 uses

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

  7. N\mathcal{N}

    Normal distribution 18 uses

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

  8. ;;

    Semicolon (parameterized by) 9 uses

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

  9. HH

    Entropy and cross-entropy 2 uses

    H(p) is the entropy of a distribution: its average surprise. H(p, q) is the cross-entropy.

  10. Uniform\mathrm{Uniform}

    Uniform distribution 1 use

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

Functions and operators

  1. 1−αˉt−11−αˉt\frac{1-\bar{\alpha}_{t-1}}{1-\bar{\alpha}_{t}}, 12σt2\frac{1}{2\sigma_{t}^{2}}, 1αˉt\frac{1}{\sqrt{\bar{\alpha}_{t}}}

    Fraction 38 uses

    Division: the top divided by the bottom.

  2. 1−βt\sqrt{1-\beta_{t}}, αˉt\sqrt{\bar{\alpha}_{t}}, αˉt−1\sqrt{\bar{\alpha}_{t-1}}

    Square root 30 uses

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

  3. ∑t≥1\sum_{t\geq 1}, ∑t>1\sum_{t>1}

    Summation 12 uses

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

  4. ::

    Arrow (maps to) 11 uses

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

  5. ±\pm

    Plus or minus 10 uses

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

  6. ∏t=1T\prod_{t=1}^{T}, ∏i=1D\prod_{i=1}^{D}, ∏s=1t\prod_{s=1}^{t}

    Product 4 uses

    Multiply the expression for every value of the index.

  7. Cases (piecewise) 2 uses

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

Sets, shapes and definitions

  1. ≤\leq, ≥\geq, >>

    Inequalities 22 uses

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

  2. ≔\coloneqq, ≕\eqqcolon

    Defined as (:=) 11 uses

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

  3. ≈\approx

    Approximately equal 4 uses

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

  4. {1,…,T}\{1,\dotsc,T\}, {0,1,…,255}\{0,1,\dotsc,255\}, {0.1,0.2,0.3,0.4}\{0.1,0.2,0.3,0.4\}

    Set braces 4 uses

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

  5. ∈\in

    Element of 1 use

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

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