Papers · Generative models · 2020

Denoising Diffusion Implicit Models

Jiaming Song, Chenlin Meng, Stefano Ermon

The notation of the DDIM paper, explained: its 79 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

DDIM: the same trained model as DDPM, sampled with a non-random process that needs far fewer steps.

The trap: DDIM writes αt\alpha_t for what DDPM calls αˉt\bar{\alpha}_t, the cumulative product. The paper says so, but formulas copied between the two papers go wrong if you miss it. σt\sigma_t sets how random each step is: σt=0\sigma_t = 0 gives the deterministic DDIM sampler, and a particular larger choice recovers DDPM.

Read from arXiv's HTML version: 79 displayed equations and 173 pieces of inline math. 66 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)=∫pθ(x0:T)dx1:T,wherepθ(x0:T):=pθ(xT)∏t=1Tpθ(t)(xt−1∣xt)p_{\theta}({\bm{x}}_{0})=\int p_{\theta}({\bm{x}}_{0:T})\mathrm{d}{\bm{x}}_{1:T},\quad\text{where}\quad p_{\theta}({\bm{x}}_{0:T}):=p_{\theta}({\bm{x}}_{T})\prod_{t=1}^{T}p^{(t)}_{\theta}({\bm{x}}_{t-1}|{\bm{x}}_{t})
    Decode →
  2. (2)
    max⁡θEq(x0)[log⁡pθ(x0)]≤max⁡θEq(x0,x1,…,xT)[log⁡pθ(x0:T)−log⁡q(x1:T∣x0)]\max_{\theta}{\mathbb{E}}_{q({\bm{x}}_{0})}[\log p_{\theta}({\bm{x}}_{0})]\leq\max_{\theta}{\mathbb{E}}_{q({\bm{x}}_{0},{\bm{x}}_{1},\ldots,{\bm{x}}_{T})}\left[\log p_{\theta}({\bm{x}}_{0:T})-\log q({\bm{x}}_{1:T}|{\bm{x}}_{0})\right]
    Decode →
  3. (3)
    q(x1:T∣x0):=∏t=1Tq(xt∣xt−1),where q(xt∣xt−1):=N(αtαt−1xt−1,(1−αtαt−1)I)q({\bm{x}}_{1:T}|{\bm{x}}_{0}):=\prod_{t=1}^{T}q({\bm{x}}_{t}|{\bm{x}}_{t-1}),\text{where}\ q({\bm{x}}_{t}|{\bm{x}}_{t-1}):={\mathcal{N}}\left(\sqrt{\frac{\alpha_{t}}{\alpha_{t-1}}}{\bm{x}}_{t-1},\left(1-\frac{\alpha_{t}}{\alpha_{t-1}}\right){\bm{I}}\right)
    Decode →
  4. q(xt∣x0):=∫q(x1:t∣x0)dx1:(t−1)=N(xt;αtx0,(1−αt)I);q({\bm{x}}_{t}|{\bm{x}}_{0}):=\int q({\bm{x}}_{1:t}|{\bm{x}}_{0})\mathrm{d}{\bm{x}}_{1:(t-1)}={\mathcal{N}}({\bm{x}}_{t};\sqrt{\alpha_{t}}{\bm{x}}_{0},(1-\alpha_{t}){\bm{I}});
    Decode →
  5. (4)
    xt=αtx0+1−αtϵ,whereϵ∼N(0,I).{\bm{x}}_{t}=\sqrt{\alpha_{t}}{\bm{x}}_{0}+\sqrt{1-\alpha_{t}}\epsilon,\quad\text{where}\quad\epsilon\sim{\mathcal{N}}({\bm{0}},{\bm{I}}).
    Decode →
  6. (5)
    Lγ(ϵθ):=∑t=1TγtEx0∼q(x0),ϵt∼N(0,I)[∥ϵθ(t)(αtx0+1−αtϵt)−ϵt∥22]L_{\gamma}(\epsilon_{\theta}) :=\sum_{t=1}^{T}\gamma_{t}{\mathbb{E}}_{{\bm{x}}_{0}\sim q({\bm{x}}_{0}),\epsilon_{t}\sim{\mathcal{N}}({\bm{0}},{\bm{I}})}\left[{\lVert{\epsilon_{\theta}^{(t)}(\sqrt{\alpha_{t}}{\bm{x}}_{0}+\sqrt{1-\alpha_{t}}\epsilon_{t})-\epsilon_{t}}\rVert}_{2}^{2}\right]
    Decode →
  7. (6)
    qσ(x1:T∣x0):=qσ(xT∣x0)∏t=2Tqσ(xt−1∣xt,x0)q_{\sigma}({\bm{x}}_{1:T}|{\bm{x}}_{0}):=q_{\sigma}({\bm{x}}_{T}|{\bm{x}}_{0})\prod_{t=2}^{T}q_{\sigma}({\bm{x}}_{t-1}|{\bm{x}}_{t},{\bm{x}}_{0})
    Decode →
  8. (7)
    qσ(xt−1∣xt,x0)=N(αt−1x0+1−αt−1−σt2⋅xt−αtx01−αt,σt2I).q_{\sigma}({\bm{x}}_{t-1}|{\bm{x}}_{t},{\bm{x}}_{0})={\mathcal{N}}\left(\sqrt{\alpha_{t-1}}{\bm{x}}_{0}+\sqrt{1-\alpha_{t-1}-\sigma^{2}_{t}}\cdot{\frac{{\bm{x}}_{t}-\sqrt{\alpha_{t}}{\bm{x}}_{0}}{\sqrt{1-\alpha_{t}}}},\sigma_{t}^{2}{\bm{I}}\right).
    Decode →
  9. (8)
    qσ(xt∣xt−1,x0)=qσ(xt−1∣xt,x0)qσ(xt∣x0)qσ(xt−1∣x0),q_{\sigma}({\bm{x}}_{t}|{\bm{x}}_{t-1},{\bm{x}}_{0})=\frac{q_{\sigma}({\bm{x}}_{t-1}|{\bm{x}}_{t},{\bm{x}}_{0})q_{\sigma}({\bm{x}}_{t}|{\bm{x}}_{0})}{q_{\sigma}({\bm{x}}_{t-1}|{\bm{x}}_{0})},
    Decode →
  10. (9)
    fθ(t)(xt):=(xt−1−αt⋅ϵθ(t)(xt))/αt.f_{\theta}^{(t)}({\bm{x}}_{t}):=({\bm{x}}_{t}-\sqrt{1-\alpha_{t}}\cdot\epsilon_{\theta}^{(t)}({\bm{x}}_{t}))/\sqrt{\alpha_{t}}.
    Decode →
  11. (10)
    pθ(t)(xt−1∣xt)={N(fθ(1)(x1),σ12I)if t=1qσ(xt−1∣xt,fθ(t)(xt))otherwise,p_{\theta}^{(t)}({\bm{x}}_{t-1}|{\bm{x}}_{t})=\begin{cases}{\mathcal{N}}(f_{\theta}^{(1)}({\bm{x}}_{1}),\sigma_{1}^{2}{\bm{I}})&\text{if}\ t=1\\ q_{\sigma}({\bm{x}}_{t-1}|{\bm{x}}_{t},f_{\theta}^{(t)}({\bm{x}}_{t}))&\text{otherwise,}\end{cases}
    Decode →
  12. (11)
    Jσ(ϵθ):=Ex0:T∼qσ(x0:T)[log⁡qσ(x1:T∣x0)−log⁡pθ(x0:T)]J_{\sigma}(\epsilon_{\theta}):={\mathbb{E}}_{{\bm{x}}_{0:T}\sim q_{\sigma}({\bm{x}}_{0:T})}[\log q_{\sigma}({\bm{x}}_{1:T}|{\bm{x}}_{0})-\log p_{\theta}({\bm{x}}_{0:T})]
    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{\bm{x}}_{0}, x0:T{\bm{x}}_{0:T}

    Subscript (index or label) 1019 uses

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

  2. LL, ff, tt

    Italic letters (variables) 212 uses

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

  3. pθ(t)p^{(t)}_{\theta}, ϵθ(t)\epsilon_{\theta}^{(t)}, fθ(t)f_{\theta}^{(t)}

    Superscript in parentheses 70 uses

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

  4. xˉ\bar{{\bm{x}}}, τˉ\bar{\tau}, αˉ\bar{\alpha}

    Bar (mean) 45 uses

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

  5. σt2\sigma^{2}_{t}, σt2\sigma_{t}^{2}, σ12\sigma_{1}^{2}

    Superscript (power or label) 40 uses

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

  6. …\ldots

    Dots (ellipsis) 11 uses

    “And so on”: continue the pattern.

  7. σ^\hat{\sigma}

    Hat (estimate) 10 uses

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

  8. Underbrace and overbrace 7 uses

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

  9. X\mathcal{X}, Q\mathcal{Q}

    Calligraphic letters 4 uses

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

  10. μ~\tilde{\mu}

    Tilde accent 2 uses

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

Greek letters

  1. α\alpha

    Alpha 191 uses

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

  2. σ\sigma

    Sigma (lowercase) 167 uses

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

  3. τ\tau

    Tau 127 uses

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

  4. θ\theta

    Theta 115 uses

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

  5. ϵ\epsilon

    Epsilon 82 uses

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

  6. γ\gamma

    Gamma 21 uses

    The discount factor in reinforcement learning, or the learned scale in normalization layers.

  7. η\eta

    Eta 20 uses

    The learning rate in most gradient-descent papers.

  8. Δ\Delta

    Delta (capital) 17 uses

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

  9. β\beta

    Beta 9 uses

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

  10. μ\mu

    Mu 7 uses

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

  11. Σ\Sigma

    Sigma (capital) 2 uses

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

Vectors and matrices

  1. x\bm{x}, 0\bm{0}

    Bold lowercase (vector) 551 uses

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

  2. I\bm{I}

    Identity matrix 37 uses

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

  3. ×\times

    Times (cross) 23 uses

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

  4. ∥xT(0)∥\lVert{{\bm{x}}_{T}^{(0)}}\rVert, ∥xT(1)∥\lVert{{\bm{x}}_{T}^{(1)}}\rVert

    Norm 13 uses

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

  5. ⋅\cdot

    Centre dot 11 uses

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

  6. KK

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

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

  7. (0,1]T(0,1]^{T}, {ϵθ(t)}t=1T\{\epsilon_{\theta}^{(t)}\}_{t=1}^{T}, (xT(0))⊤({\bm{x}}_{T}^{(0)})^{\top}

    Transpose 3 uses

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

Calculus and gradients

  1. d\mathrm{d}, dxˉ(t)dt\frac{\mathrm{d}\bar{{\bm{x}}}(t)}{\mathrm{d}t}, dσ(t)dt\frac{\mathrm{d}\sigma(t)}{\mathrm{d}t}

    Derivative (d/dx) 17 uses

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

  2. ∇xˉ\nabla_{\bar{{\bm{x}}}}

    Nabla (gradient) 5 uses

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

  3. ∫\int, ∫xt\int_{{\bm{x}}_{t}}

    Integral 3 uses

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

  4. ∞\infty

    Infinity 1 use

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

Probability and statistics

  1. pp, qq

    Probability p(x) 151 uses

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

  2. ∣|

    Given (conditional bar) 98 uses

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

  3. N\mathcal{N}

    Normal distribution 35 uses

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

  4. ∼\sim

    Distributed as (tilde) 33 uses

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

  5. Eq(x0){\mathbb{E}}_{q({\bm{x}}_{0})}, E\mathbb{E}, Eq{\mathbb{E}}_{q}

    Expectation 24 uses

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

  6. log⁡\log

    Logarithm 24 uses

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

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

    KL divergence 18 uses

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

  8. 1\bm{1}

    Indicator function 14 uses

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

  9. Cat\mathrm{Cat}

    Categorical distribution 8 uses

    Cat(π) picks one of K classes, class k with probability πₖ. It is how a model samples the next token.

  10. ;;

    Semicolon (parameterized by) 2 uses

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

Functions and operators

  1. αtαt−1\sqrt{\frac{\alpha_{t}}{\alpha_{t-1}}}, αt\sqrt{\alpha_{t}}, 1−αt\sqrt{1-\alpha_{t}}

    Square root 99 uses

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

  2. αtαt−1\frac{\alpha_{t}}{\alpha_{t-1}}, xtαt\frac{{\bm{x}}_{t}}{\sqrt{\alpha_{t}}}, 1−αtαt\frac{1-\alpha_{t}}{\alpha_{t}}

    Fraction 63 uses

    Division: the top divided by the bottom.

  3. ::, →\to

    Arrow (maps to) 53 uses

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

  4. ∑t=1T\sum_{t=1}^{T}, ∑t=2T\sum_{t=2}^{T}, ∑t∈τˉ\sum_{t\in\bar{\tau}}

    Summation 12 uses

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

  5. ∏t=1T\prod_{t=1}^{T}, ∏t=2T\prod_{t=2}^{T}, ∏i=1S\prod_{i=1}^{S}

    Product 8 uses

    Multiply the expression for every value of the index.

  6. sin⁡\sin

    Sine 4 uses

    The sine function; in ML papers mostly inside positional encodings and rotary embeddings.

  7. max⁡θ\max_{\theta}

    Max and min 2 uses

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

  8. Cases (piecewise) 2 uses

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

  9. arg min⁡ft\argmin_{f_{t}}, arg min⁡gt\argmin_{g_{t}}

    Argmin 2 uses

    The input that makes the function smallest: θ* = argmin L(θ) is the best parameter setting.

  10. ⌊ci⌋\lfloor ci\rfloor, ⌊ci2⌋\lfloor ci^{2}\rfloor

    Floor and ceiling 2 uses

    Round down (floor ⌊x⌋) or round up (ceiling ⌈x⌉) to a whole number.

  11. arccos⁡\arccos

    Cosine 1 use

    The cosine function; in ML papers usually cosine similarity, a cosine schedule, or positional encodings.

Reinforcement learning

  1. JJ

    Objective J 13 uses

    J(θ) is the objective: the quantity to maximize, such as the expected return of a policy.

Sets, shapes and definitions

  1. :=:=

    Defined as (:=) 18 uses

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

  2. ∈\in

    Element of 16 uses

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

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

    Inequalities 14 uses

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

  4. ≡\equiv

    Identically equal 7 uses

    Identically equal (for every input), or “defined as”, depending on the author.

  5. {T}\{T\}, {ϵθ(t)}\{\epsilon_{\theta}^{(t)}\}, {1,…,T}\{1,\ldots,T\}

    Set braces 7 uses

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

  6. R\mathbb{R}

    Real numbers (ℝ) and shapes 6 uses

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

  7. ∀\forall

    For all 3 uses

    “For every”: the statement holds for each value. ∃ means “there exists”.

  8. R≥0T\mathbb{R}_{\geq 0}^{T}, R>0T\mathbb{R}_{>0}^{T}, RK\mathbb{R}^{K}

    Tensor shapes 3 uses

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

  9. ∪\cup

    Union and intersection 1 use

    Union ∪: in either set. Intersection ∩: in both.

  10. ≈\approx

    Approximately equal 1 use

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

  11. ∖\setminus

    Set difference 1 use

    A ∖ B: everything in A that is not in B.

  12. ∅\varnothing

    Empty set 1 use

    The set with nothing in it.

1 thing the catalog has no entry for yet
  • dim⁡\dim \dim 15

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