Papers · Generative models · 2020

Score-Based Generative Modeling through Stochastic Differential Equations

Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma and others

The notation of the Score SDE paper, explained: its 73 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

Diffusion models as stochastic differential equations: noise the data with an SDE, then generate by solving the reverse-time SDE, which needs only the score ∇xlog⁡pt(x)\nabla_{\mathbf{x}} \log p_t(\mathbf{x}).

dx=f(x,t) dt+g(t) dw\mathrm{d}\mathbf{x} = \mathbf{f}(\mathbf{x}, t)\,\mathrm{d}t + g(t)\,\mathrm{d}\mathbf{w} reads: in a short time dt\mathrm{d}t, x\mathbf{x} drifts by f dt\mathbf{f}\,\mathrm{d}t and gets a random kick scaled by g(t)g(t); w\mathbf{w} is Brownian motion. In the reverse SDE, wˉ\bar{\mathbf{w}} is Brownian motion run backwards in time; the bar is not a mean. sθ(x,t)\mathbf{s}_\theta(\mathbf{x}, t) is the network that learns the score.

Read from arXiv's HTML version: 73 displayed equations and 296 pieces of inline math. 67 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)
    θ∗=arg min⁡θ∑i=1Nσi2Epdata(x)Epσi(x~∣x)[∥sθ(x~,σi)−∇x~log⁡pσi(x~∣x)∥22].{\boldsymbol{\theta}}^{*} =\argmin_{\boldsymbol{\theta}}\sum_{i=1}^{N}\sigma_{i}^{2}\mathbb{E}_{p_{\mathrm{data}}(\mathbf{x})}\mathbb{E}_{p_{\sigma_{i}}(\tilde{\mathbf{x}}\mid\mathbf{x})}\big[\left\lVert\mathbf{s}_{\boldsymbol{\theta}}(\tilde{\mathbf{x}},\sigma_{i})-\nabla_{\tilde{\mathbf{x}}}\log p_{\sigma_{i}}(\tilde{\mathbf{x}}\mid\mathbf{x})\right\rVert_{2}^{2}\big].
    Decode →
  2. (2)
    xim=xim−1+ϵisθ∗(xim−1,σi)+2ϵizim,m=1,2,⋯ ,M,\mathbf{x}_{i}^{m}=\mathbf{x}_{i}^{m-1}+\epsilon_{i}\mathbf{s}_{{\boldsymbol{\theta}}^{*}}(\mathbf{x}_{i}^{m-1},\sigma_{i})+\sqrt{2\epsilon_{i}}\mathbf{z}_{i}^{m},\quad m=1,2,\cdots,M,
    Decode →
  3. (3)
    θ∗=arg min⁡θ∑i=1N(1−αi)Epdata(x)Epαi(x~∣x)[∥sθ(x~,i)−∇x~log⁡pαi(x~∣x)∥22].{\boldsymbol{\theta}}^{*} =\argmin_{\boldsymbol{\theta}}\sum_{i=1}^{N}(1-\alpha_{i})\mathbb{E}_{p_{\mathrm{data}}(\mathbf{x})}\mathbb{E}_{p_{\alpha_{i}}(\tilde{\mathbf{x}}\mid\mathbf{x})}[\left\lVert\mathbf{s}_{\boldsymbol{\theta}}(\tilde{\mathbf{x}},i)-\nabla_{\tilde{\mathbf{x}}}\log p_{\alpha_{i}}(\tilde{\mathbf{x}}\mid\mathbf{x})\right\rVert_{2}^{2}].
    Decode →
  4. (4)
    xi−1=11−βi(xi+βisθ∗(xi,i))+βizi,i=N,N−1,⋯ ,1.\mathbf{x}_{i-1}=\frac{1}{\sqrt{1-\beta_{i}}}(\mathbf{x}_{i}+\beta_{i}\mathbf{s}_{{\boldsymbol{\theta}}^{*}}(\mathbf{x}_{i},i))+\sqrt{\beta_{i}}\mathbf{z}_{i},\quad i=N,N-1,\cdots,1.
    Decode →
  5. (5)
    dx=f(x,t)dt+g(t)dw,\mathrm{d}\mathbf{x}=\mathbf{f}(\mathbf{x},t)\mathrm{d}t+{g}(t)\mathrm{d}\mathbf{w},
    Decode →
  6. (6)
    dx=[f(x,t)−g(t)2∇xlog⁡pt(x)]dt+g(t)dwˉ,\mathrm{d}\mathbf{x}=[\mathbf{f}(\mathbf{x},t)-g(t)^{2}\nabla_{\mathbf{x}}\log p_{t}(\mathbf{x})]\mathrm{d}t+g(t)\mathrm{d}\bar{\mathbf{w}},
    Decode →
  7. (7)
    θ∗=arg min⁡θEt{λ(t)Ex(0)Ex(t)∣x(0)[∥sθ(x(t),t)−∇x(t)log⁡p0t(x(t)∣x(0))∥22]}.{\boldsymbol{\theta}}^{*}=\argmin_{\boldsymbol{\theta}}\mathbb{E}_{t}\Big\{\lambda(t)\mathbb{E}_{\mathbf{x}(0)}\mathbb{E}_{\mathbf{x}(t)\mid\mathbf{x}(0)}\big[\left\lVert\mathbf{s}_{\boldsymbol{\theta}}(\mathbf{x}(t),t)-\nabla_{\mathbf{x}(t)}\log p_{0t}(\mathbf{x}(t)\mid\mathbf{x}(0))\right\rVert_{2}^{2}\big]\Big\}.
    Decode →
  8. (8)
    xi=xi−1+σi2−σi−12zi−1,i=1,⋯ ,N,\mathbf{x}_{i}=\mathbf{x}_{i-1}+\sqrt{\sigma_{i}^{2}-\sigma_{i-1}^{2}}\mathbf{z}_{i-1},\quad i=1,\cdots,N,
    Decode →
  9. (9)
    dx=d[σ2(t)]dtdw.\mathrm{d}\mathbf{x}=\sqrt{\frac{\mathrm{d}\left[\sigma^{2}(t)\right]}{\mathrm{d}t}}\mathrm{d}\mathbf{w}.
    Decode →
  10. (10)
    xi=1−βixi−1+βizi−1,i=1,⋯ ,N.\mathbf{x}_{i}=\sqrt{1-\beta_{i}}\mathbf{x}_{i-1}+\sqrt{\beta_{i}}\mathbf{z}_{i-1},\quad i=1,\cdots,N.
    Decode →
  11. (11)
    dx=−12β(t)x dt+β(t) dw.\mathrm{d}\mathbf{x}=-\frac{1}{2}\beta(t)\mathbf{x}~\mathrm{d}t+\sqrt{\beta(t)}~\mathrm{d}\mathbf{w}.
    Decode →
  12. (12)
    dx=−12β(t)x dt+β(t)(1−e−2∫0tβ(s)ds)dw.\mathrm{d}\mathbf{x}=-\frac{1}{2}\beta(t)\mathbf{x}~\mathrm{d}t+\sqrt{\beta(t)(1-e^{-2\int_{0}^{t}\beta(s)\mathrm{d}s})}\mathrm{d}\mathbf{w}.
    Decode →

Symbols, by category

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

Notation conventions

  1. mm, MM, ii

    Italic letters (variables) 848 uses

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

  2. σi2\sigma_{i}^{2}, pdatap_{\mathrm{data}}, pσip_{\sigma_{i}}

    Subscript (index or label) 793 uses

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

  3. σi2\sigma_{i}^{2}, xim\mathbf{x}_{i}^{m}, xim−1\mathbf{x}_{i}^{m-1}

    Superscript (power or label) 163 uses

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

  4. wˉ\bar{\mathbf{w}}, βˉ\bar{\beta}, Ωˉ\bar{\Omega}

    Bar (mean) 56 uses

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

  5. θ∗{\boldsymbol{\theta}}^{*}, θ∗{\boldsymbol{\theta}}^{\ast}, ∗*

    Star (optimal) 37 uses

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

  6. x~\tilde{\mathbf{x}}, f~\tilde{f}, f~\tilde{\mathbf{f}}

    Tilde accent 34 uses

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

  7. ⋯\cdots

    Dots (ellipsis) 29 uses

    “And so on”: continue the pattern.

  8. Ω^\hat{\Omega}, y^\hat{\mathbf{y}}

    Hat (estimate) 14 uses

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

  9. Underbrace and overbrace 1 use

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

Greek letters

  1. σ\sigma

    Sigma (lowercase) 132 uses

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

  2. β\beta

    Beta 119 uses

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

  3. θ\theta

    Theta 84 uses

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

  4. ϵ\epsilon

    Epsilon 45 uses

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

  5. Ω\Omega

    Omega 45 uses

    A frequency ω (positional encodings, Fourier features) or a weight; capital Ω is a regularizer, a sample space or big-Omega.

  6. Δ\Delta

    Delta (capital) 23 uses

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

  7. Σ\Sigma

    Sigma (capital) 18 uses

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

  8. α\alpha

    Alpha 17 uses

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

  9. λ\lambda

    Lambda 5 uses

    Usually the strength of a regularization term; also eigenvalues.

  10. μ\mu

    Mu 5 uses

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

  11. τ\tau

    Tau 4 uses

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

Vectors and matrices

  1. θ\boldsymbol{\theta}, x\mathbf{x}, s\mathbf{s}

    Bold lowercase (vector) 1122 uses

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

  2. G\mathbf{G}, Σ\mathbf{\Sigma}

    Bold uppercase (matrix) 96 uses

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

  3. I\mathbf{I}

    Identity matrix 48 uses

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

  4. ⋅\cdot, (⋅)(\cdot)

    Centre dot 37 uses

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

  5. ×\times

    Times (cross) 22 uses

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

  6. ∥z∥2\left\lVert\mathbf{z}\right\rVert_{2}, ∥⋅∥2\left\lVert\cdot\right\rVert_{2}, ∥g∥2\left\lVert\mathbf{g}\right\rVert_{2}

    Norm 17 uses

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

  7. {x(t)}t=0T\{\mathbf{x}(t)\}_{t=0}^{T}, {pt(x)}t=0T\{p_{t}(\mathbf{x})\}_{t=0}^{T}

    Transpose 3 uses

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

  8. 0+0^{+}

    Dagger / pseudo-inverse 3 uses

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

Calculus and gradients

  1. d\mathrm{d}

    Derivative (d/dx) 97 uses

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

  2. ∇x~\nabla_{\tilde{\mathbf{x}}}, ∇x\nabla_{\mathbf{x}}, ∇x(t)\nabla_{\mathbf{x}(t)}

    Nabla (gradient) 78 uses

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

  3. ∂pt(x)∂t\frac{\partial p_{t}(\mathbf{x})}{\partial t}, ∂∂xi\frac{\partial}{\partial x_{i}}, ∂\partial

    Partial derivative 22 uses

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

  4. ∫0t\int_{0}^{t}, ∫0T\int_{0}^{T}, ∫\int

    Integral 16 uses

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

  5. ∞\infty

    Infinity 15 uses

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

  6. xi′\mathbf{x}_{i}^{\prime}, sθ′\mathbf{s}_{\boldsymbol{\theta}}^{\prime}

    Prime 7 uses

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

  7. lim⁡t→∞\lim_{t\to\infty}, lim⁡t→0+\lim_{t\to 0^{+}}

    Limit 4 uses

    The value an expression approaches as a variable approaches something.

Probability and statistics

  1. pp, qq

    Probability p(x) 205 uses

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

  2. ∣\mid, ∣|

    Given (conditional bar) 106 uses

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

  3. log⁡\log

    Logarithm 62 uses

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

  4. ∼\sim

    Distributed as (tilde) 37 uses

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

  5. N\mathcal{N}

    Normal distribution 35 uses

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

  6. Epdata(x)\mathbb{E}_{p_{\mathrm{data}}(\mathbf{x})}, Et\mathbb{E}_{t}, Ex(0)\mathbb{E}_{\mathbf{x}(0)}

    Expectation 23 uses

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

  7. ;;

    Semicolon (parameterized by) 17 uses

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

  8. e−2∫0tβ(s)dse^{-2\int_{0}^{t}\beta(s)\mathrm{d}s}, e∫0t−β(s)dse^{\int_{0}^{t}-\beta(s)\mathrm{d}s}, e−∫0tβ(s)dse^{-\int_{0}^{t}\beta(s)\mathrm{d}s}

    Exponential 13 uses

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

  9. ∝\propto

    Proportional to 4 uses

    Equal up to a constant factor that does not depend on the variable of interest.

  10. Cov⁡\operatorname{Cov}

    Covariance 4 uses

    How two random quantities vary together; positive when they rise together.

  11. DKLD_{\text{KL}}, ∥\|

    KL divergence 2 uses

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

  12. U\mathcal{U}

    Uniform distribution 1 use

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

Functions and operators

  1. 11−βi\frac{1}{\sqrt{1-\beta_{i}}}, 12\frac{1}{2}, βˉiN\frac{\bar{\beta}_{i}}{N}

    Fraction 76 uses

    Division: the top divided by the bottom.

  2. min\text{min}, max\text{max}

    Max and min 58 uses

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

  3. 2ϵi\sqrt{2\epsilon_{i}}, 1−βi\sqrt{1-\beta_{i}}, βi\sqrt{\beta_{i}}

    Square root 50 uses

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

  4. ±\pm

    Plus or minus 43 uses

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

  5. ::, →\to, →\rightarrow

    Arrow (maps to) 41 uses

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

  6. ∑i=1N\sum_{i=1}^{N}, ∑i=1d\sum_{i=1}^{d}, ∑j=1d\sum_{j=1}^{d}

    Summation 28 uses

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

  7. ←\leftarrow

    Assignment arrow 20 uses

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

  8. arg min⁡θ\argmin_{\boldsymbol{\theta}}

    Argmin 4 uses

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

  9. ∏j=1i\prod_{j=1}^{i}, ∏i=1N\prod_{i=1}^{N}

    Product 3 uses

    Multiply the expression for every value of the index.

  10. Cases (piecewise) 1 use

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

  11. ⌊i/2⌋\lfloor i/2\rfloor

    Floor and ceiling 1 use

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

Sets, shapes and definitions

  1. {\{, {σi}\{\sigma_{i}\}, {x(t)}\{\mathbf{x}(t)\}

    Set braces 42 uses

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

  2. <<, >>, ≤\leq

    Inequalities 21 uses

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

  3. ∈\in

    Element of 19 uses

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

  4. ≈\approx

    Approximately equal 17 uses

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

  5. ≔\coloneqq, :=:=

    Defined as (:=) 11 uses

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

  6. Rd\mathbb{R}^{d}, Rd×d\mathbb{R}^{d\times d}, R+\mathbb{R}^{+}

    Tensor shapes 11 uses

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

  7. 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.

  8. ≠\neq

    Not equal 2 uses

    The two sides are different.

  9. ≡\equiv

    Identically equal 1 use

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

7 things the catalog has no entry for yet
  • \mkern \mkern 31
  • }\} \} 3
  • ↓\downarrow \downarrow 3
  • ↑\uparrow \uparrow 1
  • ≼\preccurlyeq \preccurlyeq 1
  • Predictor⁡\operatorname{Predictor} Predictor 1
  • Corrector⁡\operatorname{Corrector} Corrector 1

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