Papers · Architectures and attention · 2017

Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer

Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz and others

The notation of the Mixture of experts paper, explained: its 22 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: 22 displayed equations and 90 pieces of inline math. 30 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)
    y=∑i=1nG(x)iEi(x)y=\sum_{i=1}^{n}G(x)_{i}E_{i}(x)
    Decode →
  2. (2)
    Gσ(x)=Softmax(x⋅Wg)G_{\sigma}(x)=Softmax(x\cdot W_{g})
    Decode →
  3. (3)
    G(x)=Softmax(KeepTopK(H(x),k))G(x)=Softmax(KeepTopK(H(x),k))
    Decode →
  4. (4)
    H(x)i=(x⋅Wg)i+StandardNormal()⋅Softplus((x⋅Wnoise)i)H(x)_{i}=(x\cdot W_{g})_{i}+StandardNormal()\cdot Softplus((x\cdot W_{noise})_{i})
    Decode →
  5. (5)
    KeepTopK(v,k)i={viif vi is in the top k elements of v.−∞otherwise.KeepTopK(v,k)_{i}=\begin{cases}v_{i}&\text{if $v_{i}$ is in the top $k$ elements of $v$.}\\ -\infty&\text{otherwise.}\end{cases}
    Decode →
  6. (6)
    Importance(X)=∑x∈XG(x)Importance(X)=\sum_{x\in X}G(x)
    Decode →
  7. (7)
    Limportance(X)=wimportance⋅CV(Importance(X))2L_{importance}(X)=w_{importance}\cdot CV(Importance(X))^{2}
    Decode →
  8. (8)
    P(x,i)=Pr((x⋅Wg)i+StandardNormal()⋅Softplus((x⋅Wnoise)i)>kth_excluding(H(x),k,i))\begin{gathered}P(x,i)=Pr\Big((x\cdot W_{g})_{i}+StandardNormal()\cdot Softplus((x\cdot W_{noise})_{i}) \\ >kth\_excluding(H(x),k,i)\Big)\end{gathered}
    Decode →
  9. (9)
    P(x,i)=Φ((x⋅Wg)i−kth_excluding(H(x),k,i)Softplus((x⋅Wnoise)i))P(x,i)=\Phi\Big(\frac{(x\cdot W_{g})_{i}-kth\_excluding(H(x),k,i)}{Softplus((x\cdot W_{noise})_{i})}\Big)
    Decode →
  10. (10)
    Load(X)i=∑x∈XP(x,i)Load(X)_{i}=\sum_{x\in X}P(x,i)
    Decode →
  11. (11)
    Lload(X)=wload⋅CV(Load(X))2L_{load}(X)=w_{load}\cdot CV(Load(X))^{2}
    Decode →
  12. (12)
    yH=∑i=1a∑j=1bGprimary(x)i⋅Gi(x)j⋅Ei,j(x)y_{H}=\sum_{i=1}^{a}\sum_{j=1}^{b}G_{primary}(x)_{i}\cdot G_{i}(x)_{j}\cdot E_{i,j}(x)
    Decode →

Symbols, by category

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

Notation conventions

  1. yy, GG, xx

    Italic letters (variables) 504 uses

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

  2. (x)i(x)_{i}, EiE_{i}, GσG_{\sigma}

    Subscript (index or label) 132 uses

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

  3. (Importance(X))2(Importance(X))^{2}, (Load(X))2(Load(X))^{2}, kthk^{th}

    Superscript (power or label) 4 uses

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

  4. ∗*

    Star (optimal) 4 uses

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

  5. X(i)X^{(i)}

    Superscript in parentheses 3 uses

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

  6. hiddenhidden, meanmean

    Multi-letter names 3 uses

    A run of italic letters like pos or model is usually one name, not a product of single letters.

  7. ⋯\cdots

    Dots (ellipsis) 1 use

    “And so on”: continue the pattern.

Greek letters

  1. σ\sigma

    Sigma (lowercase) 9 uses

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

  2. Φ\Phi

    Phi 2 uses

    The parameters of a second model (often the encoder q_φ), or a feature map φ(x).

  3. β\beta

    Beta 1 use

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

Vectors and matrices

  1. ⋅\cdot

    Centre dot 16 uses

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

  2. KK, VV

    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.

  3. ∣X(i)∣|X^{(i)}|, ∣X∣|X|

    Absolute value (bars) 3 uses

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

  4. ×\times

    Times (cross) 2 uses

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

Calculus and gradients

  1. ∞\infty

    Infinity 2 uses

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

Probability and statistics

  1. pp, PP, PrPr

    Probability p(x) 45 uses

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

  2. HH

    Entropy and cross-entropy 4 uses

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

Functions and operators

  1. →\rightarrow

    Arrow (maps to) 23 uses

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

  2. ∑i=1n\sum_{i=1}^{n}, ∑x∈X\sum_{x\in X}, ∑i=1a\sum_{i=1}^{a}

    Summation 11 uses

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

  3. kbn\frac{kb}{n}, kbdn\frac{kbd}{n}, max(Load(X))mean(Load(X))\frac{max(Load(X))}{mean(Load(X))}

    Fraction 7 uses

    Division: the top divided by the bottom.

  4. SoftmaxSoftmax

    Softmax 4 uses

    Turns a vector of scores into probabilities: exponentiate each, then divide by the total.

  5. Cases (piecewise) 4 uses

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

  6. SoftplusSoftplus

    Softplus 3 uses

    log(1 + eˣ): a smooth ReLU whose output is always positive.

  7. tanhtanh

    Hyperbolic tangent 3 uses

    An S-shaped activation squashing any number into (−1, 1).

  8. maxmax

    Max and min 1 use

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

Reinforcement learning

  1. VV

    Value function V 2 uses

    V(s) is how much total discounted reward to expect from state s onward.

  2. aa

    State s and action a 2 uses

    sₜ is the state at step t, aₜ the action taken there; s′ is the next state.

  3. rr

    Reward r 1 use

    rₜ is the reward received at step t; R(s, a) is the reward function that hands it out.

Sets, shapes and definitions

  1. >>, ≪\ll

    Inequalities 4 uses

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

  2. ∈\in

    Element of 3 uses

    “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 architectures and attention papers