Papers · Training · 2015

Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift

Sergey Ioffe, Christian Szegedy

The notation of the Batch norm paper, explained: its 19 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

Batch normalization: normalize each feature over the mini-batch, then let the network rescale and shift it, which made deep networks much easier to train.

B={x1,…,xm}\mathcal{B} = \{x_1, \ldots, x_m\} is the mini-batch, and the calligraphic B\mathcal{B} in μB\mu_\mathcal{B} and σB2\sigma_\mathcal{B}^2 says these are batch statistics. x^i\widehat{x}_i is the normalized value; the hat marks a transformed version, not an estimate. γ\gamma and β\beta are learned (and are not the β\beta of Adam), and ϵ\epsilon is a small constant for numerical safety.

Read from arXiv's HTML version: 19 displayed equations and 126 pieces of inline math. 46 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. Θ=arg⁡min⁡Θ1N∑i=1Nℓ(xi,Θ)\Theta=\arg\min_{\Theta}\frac{1}{N}\sum_{i=1}^{N}\ell(\mathrm{x}_{i},\Theta)
    Decode →
  2. 1m∂ℓ(xi,Θ)∂Θ.\frac{1}{m}\frac{\partial\ell(\mathrm{x}_{i},\Theta)}{\partial\Theta}.
    Decode →
  3. ℓ=F2(F1(u,Θ1),Θ2)\ell=F_{2}(F_{1}(\mathrm{u},\Theta_{1}),\Theta_{2})
    Decode →
  4. ℓ=F2(x,Θ2).\ell=F_{2}(\mathrm{x},\Theta_{2}).
    Decode →
  5. Θ2←Θ2−αm∑i=1m∂F2(xi,Θ2)∂Θ2\Theta_{2}\leftarrow\Theta_{2}-\frac{\alpha}{m}\sum_{i=1}^{m}\frac{\partial F_{2}(\mathrm{x}_{i},\Theta_{2})}{\partial\Theta_{2}}
    Decode →
  6. x^=Norm(x,X)\widehat{\mathrm{x}}=\text{Norm}(\mathrm{x},\mathcal{X})
    Decode →
  7. ∂Norm(x,X)∂x  and  ∂Norm(x,X)∂X;\frac{\partial\text{Norm}(\mathrm{x},\mathcal{X})}{\partial\mathrm{x}}\text{\, and\, }\frac{\partial\text{Norm}(\mathrm{x},\mathcal{X})}{\partial\mathcal{X}};
    Decode →
  8. x^(k)=x(k)−E[x(k)]Var[x(k)]\widehat{x}^{(k)}=\frac{x^{(k)}-\text{E}[x^{(k)}]}{\sqrt{\text{Var}[x^{(k)}]}}
    Decode →
  9. y(k)=γ(k)x^(k)+β(k).y^{(k)}=\gamma^{(k)}\widehat{x}^{(k)}+\beta^{(k)}.
    Decode →
  10. B={x1…m}.\mathcal{B}=\{x_{1\ldots m}\}.
    Decode →
  11. BNγ,β:x1…m→y1…m\text{BN}_{\gamma,\beta}:x_{1\ldots m}\rightarrow y_{1\ldots m}
    Decode →
  12. μB←1m∑i=1mxiσB2←1m∑i=1m(xi−μB)2x^i←xi−μBσB2+ϵyi←γx^i+β≡BNγ,β(xi)\begin{gathered}\mu_{\mathcal{B}} \leftarrow\frac{1}{m}\sum_{i=1}^{m}x_{i} \\ \sigma_{\mathcal{B}}^{2} \leftarrow\frac{1}{m}\sum_{i=1}^{m}(x_{i}-\mu_{\mathcal{B}})^{2} \\ \widehat{x}_{i} \leftarrow\frac{x_{i}-\mu_{\mathcal{B}}}{\sqrt{\sigma_{\mathcal{B}}^{2}+\epsilon}} \\ y_{i} \leftarrow\gamma\widehat{x}_{i}+\beta\equiv\text{BN}_{\gamma,\beta}(x_{i})\end{gathered}
    Decode →

Famous equations in this paper

Symbols, by category

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

Notation conventions

  1. NN, xx, mm

    Italic letters (variables) 261 uses

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

  2. xi\mathrm{x}_{i}, F2F_{2}, F1F_{1}

    Subscript (index or label) 98 uses

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

  3. x^(k)\widehat{x}^{(k)}, x(k)x^{(k)}, y(k)y^{(k)}

    Superscript in parentheses 40 uses

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

  4. X\mathcal{X}, B\mathcal{B}

    Calligraphic letters 39 uses

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

  5. σB2\sigma_{\mathcal{B}}^{2}, (xi−μB)2(x_{i}-\mu_{\mathcal{B}})^{2}, (σB2+ϵ)−3/2(\sigma_{\mathcal{B}}^{2}+\epsilon)^{-3/2}

    Superscript (power or label) 34 uses

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

  6. x^\widehat{\mathrm{x}}, x^\widehat{x}, z^\widehat{\mathrm{z}}

    Hat (estimate) 31 uses

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

  7. ℓ\ell

    Loss (ℒ) 22 uses

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

  8. …\ldots

    Dots (ellipsis) 12 uses

    “And so on”: continue the pattern.

Greek letters

  1. γ\gamma

    Gamma 24 uses

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

  2. Θ\Theta

    Theta 22 uses

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

  3. β\beta

    Beta 21 uses

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

  4. μ\mu

    Mu 11 uses

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

  5. σ\sigma

    Sigma (lowercase) 11 uses

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

  6. ϵ\epsilon

    Epsilon 10 uses

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

  7. Δ\Delta

    Delta (capital) 4 uses

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

  8. α\alpha

    Alpha 2 uses

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

Vectors and matrices

  1. ×\times

    Times (cross) 46 uses

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

  2. ⋅\cdot, (⋅)(\cdot)

    Centre dot 22 uses

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

  3. tr\mathrm{tr}

    Trace 6 uses

    The sum of the diagonal entries of a square matrix.

  4. xT\mathrm{x}^{T}, [x]T[\mathrm{x}]^{T}, JTJ^{T}

    Transpose 5 uses

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

  5. KK

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

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

  6. ∣x∣|x|, ∣B∣|\mathcal{B}|

    Absolute value (bars) 2 uses

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

Calculus and gradients

  1. ∂ℓ∂x^i\frac{\partial\ell}{\partial\widehat{x}_{i}}, ∂ℓ∂yi\frac{\partial\ell}{\partial y_{i}}, ∂ℓ∂μB\frac{\partial\ell}{\partial\mu_{\mathcal{B}}}

    Partial derivative 25 uses

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

  2. g′g^{\prime}, m′m^{\prime}

    Prime 2 uses

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

Probability and statistics

  1. E\text{E}, EB\text{E}_{\mathcal{B}}, Ex∈X\text{E}_{\mathrm{x}\in\mathcal{X}}

    Expectation 16 uses

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

  2. Var\text{Var}

    Variance 7 uses

    How spread out a random quantity is: the expected squared distance from its mean, σ².

  3. Cov\text{Cov}

    Covariance 4 uses

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

  4. pp, qq

    Probability p(x) 4 uses

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

  5. exp⁡\exp

    Exponential 2 uses

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

  6. ;;

    Semicolon (parameterized by) 1 use

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

  7. ∝\propto

    Proportional to 1 use

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

Functions and operators

  1. 1N\frac{1}{N}, 1m\frac{1}{m}, αm\frac{\alpha}{m}

    Fraction 23 uses

    Division: the top divided by the bottom.

  2. ∑i=1N\sum_{i=1}^{N}, ∑i=1m\sum_{i=1}^{m}

    Summation 12 uses

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

  3. ←\leftarrow

    Assignment arrow 10 uses

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

  4. Var[x(k)]\sqrt{\text{Var}[x^{(k)}]}, σB2+ϵ\sqrt{\sigma_{\mathcal{B}}^{2}+\epsilon}, Var[x]+ϵ\sqrt{\text{Var}[x]+\epsilon}

    Square root 8 uses

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

  5. ::, →\rightarrow

    Arrow (maps to) 2 uses

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

  6. arg⁡min⁡Θ\arg\min_{\Theta}

    Argmin 1 use

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

  7. ReLUReLU

    ReLU 1 use

    The rectified linear unit: keeps positive inputs, replaces negative ones with 0.

  8. max⁡\max

    Max and min 1 use

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

Reinforcement learning

  1. JJ

    Objective J 8 uses

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

Sets, shapes and definitions

  1. {x1…m}\{x_{1\ldots m}\}, {x1…N}\{x_{1\ldots N}\}, {yi=BNγ,β(xi)}\{y_{i}=\text{BN}_{\gamma,\beta}(x_{i})\}

    Set braces 7 uses

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

  2. ≡\equiv

    Identically equal 4 uses

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

  3. ∈\in

    Element of 1 use

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

  4. >>

    Inequalities 1 use

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

  5. ∪\cup

    Union and intersection 1 use

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

  6. ≈\approx

    Approximately equal 1 use

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

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 training papers