Papers · Training · 2019

Root Mean Square Layer Normalization

Biao Zhang, Rico Sennrich

The notation of the RMSNorm paper, explained: its 10 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: 10 displayed equations and 50 pieces of inline math. 31 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)
    ai=∑j=1mwijxj,yi=f(ai+bi),a_{i}=\sum_{j=1}^{m}{w_{ij}x_{j}},\quad y_{i}=f\left(a_{i}+b_{i}\right),
    Decode →
  2. (2)
    aˉi=ai−μσgi,yi=f(aˉi+bi),\bar{a}_{i}=\frac{a_{i}-\mu}{\sigma}g_{i},\quad y_{i}=f\left(\bar{a}_{i}+b_{i}\right),
    Decode →
  3. (3)
    μ=1n∑i=1nai,σ=1n∑i=1n(ai−μ)2.\mu=\frac{1}{n}\sum_{i=1}^{n}a_{i},\quad\sigma=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(a_{i}-\mu)^{2}}.
    Decode →
  4. (4)
    aˉi=aiRMS(a)gi,where  RMS(a)=1n∑i=1nai2.\begin{split}&\bar{a}_{i}=\frac{a_{i}}{\text{RMS}(\mathbf{a})}g_{i},\quad\text{where}~~\text{RMS}(\mathbf{a})=\sqrt{\frac{1}{n}\sum_{i=1}^{n}a_{i}^{2}}.\end{split}
    Decode →
  5. (5)
    y=f(WxRMS(a)⊙g+b),\mathbf{y}=f\left(\frac{\mathbf{Wx}}{\text{RMS}(\mathbf{a})}\odot\mathbf{g}+\mathbf{b}\right),
    Decode →
  6. (6)
    RMS(αx)=αRMS(x),\text{RMS}(\alpha\mathbf{x})=\alpha\text{RMS}(\mathbf{x}),
    Decode →
  7. (7)
    y′=f(W′xRMS(a′)⊙g+b)=f(δWxδRMS(a)⊙g+b)=y.\small\begin{split}\mathbf{y}^{\prime}=f\left(\frac{\mathbf{W^{\prime}x}}{\text{RMS}(\mathbf{a}^{\prime})}\odot\mathbf{g}+\mathbf{b}\right)=f\left(\frac{\delta\mathbf{Wx}}{\delta\text{RMS}(\mathbf{a})}\odot\mathbf{g}+\mathbf{b}\right)=\mathbf{y}.\end{split}
    Decode →
  8. (8)
    ∂L∂b=∂L∂v,∂L∂g=∂L∂v⊙WxRMS(a),\frac{\partial\mathcal{L}}{\partial\mathbf{b}}=\frac{\partial\mathcal{L}}{\partial\mathbf{v}},\quad\frac{\partial\mathcal{L}}{\partial\mathbf{g}}=\frac{\partial\mathcal{L}}{\partial\mathbf{v}}\odot\frac{\mathbf{Wx}}{\text{RMS}(\mathbf{a})},
    Decode →
  9. (9)
    ∂L∂W=∑i=1n[xT⊗(diag(g⊙∂L∂v)×R)]i,where  R=1RMS(a)(I−(Wx)(Wx)TnRMS(a)2),\small\begin{split}&\frac{\partial\mathcal{L}}{\partial\mathbf{W}}=\sum_{i=1}^{n}\left[\mathbf{x}^{T}\otimes\left(\text{diag}\left(\mathbf{g}\odot\frac{\partial\mathcal{L}}{\partial\mathbf{v}}\right)\times\mathbf{R}\right)\right]_{i},\text{where}~~\mathbf{R}=\frac{1}{{\text{RMS}(\mathbf{a})}}\left(\mathbf{I}-\frac{\left(\mathbf{Wx}\right)\left(\mathbf{Wx}\right)^{T}}{n\text{RMS}(\mathbf{a})^{2}}\right),\end{split}
    Decode →
  10. (10)
    R′=1δRMS(a)(I−(δWx)(δWx)Tnδ2RMS(a)2)=1δR.\small\begin{split}\mathbf{R}^{\prime}&=\frac{1}{{\delta\text{RMS}(\mathbf{a})}}\left(\mathbf{I}-\frac{\left(\mathbf{\delta Wx}\right)\left(\mathbf{\delta Wx}\right)^{T}}{n\delta^{2}\text{RMS}(\mathbf{a})^{2}}\right)=\frac{1}{\delta}\mathbf{R}.\\ \end{split}
    Decode →

Famous equations in this paper

Symbols, by category

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

Notation conventions

  1. aa, ww, xx

    Italic letters (variables) 56 uses

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

  2. aia_{i}, wijw_{ij}, xjx_{j}

    Subscript (index or label) 26 uses

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

  3. L\mathcal{L}

    Loss (ℒ) 14 uses

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

  4. aˉ\bar{a}, RMS‾\overline{\text{RMS}}

    Bar (mean) 8 uses

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

  5. (ai−μ)2(a_{i}-\mu)^{2}, ai2a_{i}^{2}, (a)2(\mathbf{a})^{2}

    Superscript (power or label) 7 uses

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

Greek letters

  1. δ\delta

    Delta (lowercase) 14 uses

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

  2. μ\mu

    Mu 4 uses

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

  3. σ\sigma

    Sigma (lowercase) 3 uses

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

  4. α\alpha

    Alpha 3 uses

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

  5. β\beta

    Beta 2 uses

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

Vectors and matrices

  1. a\mathbf{a}, y\mathbf{y}, g\mathbf{g}

    Bold lowercase (vector) 54 uses

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

  2. W\mathbf{W}, R\mathbf{R}

    Bold uppercase (matrix) 17 uses

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

  3. ⊙\odot

    Hadamard (elementwise) product 6 uses

    Multiply two arrays of the same shape entry by entry.

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

    Centre dot 4 uses

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

  5. xT\mathbf{x}^{T}, (Wx)T\left(\mathbf{Wx}\right)^{T}, (δWx)T\left(\mathbf{\delta Wx}\right)^{T}

    Transpose 3 uses

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

  6. I\mathbf{I}

    Identity matrix 3 uses

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

  7. ⊗\otimes

    Tensor / Kronecker product 2 uses

    An outer, Kronecker or tensor product: every entry of one times every entry of the other.

  8. diag\text{diag}

    Diag 2 uses

    Build a diagonal matrix from a vector, or pull out the diagonal of a matrix.

  9. ×\times

    Times (cross) 2 uses

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

Calculus and gradients

  1. ∂L∂b\frac{\partial\mathcal{L}}{\partial\mathbf{b}}, ∂L∂v\frac{\partial\mathcal{L}}{\partial\mathbf{v}}, ∂L∂g\frac{\partial\mathcal{L}}{\partial\mathbf{g}}

    Partial derivative 18 uses

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

  2. y′\mathbf{y}^{\prime}, W′W^{\prime}, a′\mathbf{a}^{\prime}

    Prime 9 uses

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

Probability and statistics

  1. pp

    Probability p(x) 41 uses

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

  2. ∼\sim

    Distributed as (tilde) 7 uses

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

  3. e−4e^{-4}, e−5e^{-5}, e−3e^{-3}

    Exponential 3 uses

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

Functions and operators

  1. ±\pm

    Plus or minus 33 uses

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

  2. ai−μσ\frac{a_{i}-\mu}{\sigma}, 1n\frac{1}{n}, aiRMS(a)\frac{a_{i}}{\text{RMS}(\mathbf{a})}

    Fraction 21 uses

    Division: the top divided by the bottom.

  3. ∑j=1m\sum_{j=1}^{m}, ∑i=1n\sum_{i=1}^{n}, ∑i=1k\sum_{i=1}^{k}

    Summation 6 uses

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

  4. 1n∑i=1n(ai−μ)2\sqrt{\frac{1}{n}\sum_{i=1}^{n}(a_{i}-\mu)^{2}}, 1n∑i=1nai2\sqrt{\frac{1}{n}\sum_{i=1}^{n}a_{i}^{2}}, n\sqrt{n}

    Square root 5 uses

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

  5. ⌈n⋅p⌉\lceil n\cdot p\rceil

    Floor and ceiling 1 use

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

Sets, shapes and definitions

  1. ∈\in

    Element of 5 uses

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

  2. Rm\mathbb{R}^{m}, Rn\mathbb{R}^{n}

    Tensor shapes 5 uses

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

1 thing the catalog has no entry for yet
  • \small \small 3

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