Attention Is All You Need
Notation sheet
Every symbol the paper uses, in the order you meet them: what it means, its value in the paper's base model and in our miniature, and where the lab explains it. Print it and keep it beside the paper.
| Symbol | Meaning | The paper | Our model | Explained in |
|---|---|---|---|---|
| \(N\) | identical layers in each stack | 6 | 2 | Ch. 16 · § 3.1 |
| \(d_{\text{model}}\) | numbers in every vector between sub-layers, and in the embeddings | 512 | 64 | Ch. 5 · § 3.1 |
| \(h\) | heads, run side by side | 8 | 4 | Ch. 11 · § 3.2.2 |
| \(d_k\) | numbers in each query and key | 64 | 16 | Ch. 9 · § 3.2.1 |
| \(d_v\) | numbers in each value | 64 | 16 | Ch. 9 · § 3.2.1 |
| \(d_{ff}\) | numbers inside the network, between the two layers | 2048 | 256 | Ch. 13 · § 3.3 |
| \(Q,\ K,\ V\) | queries, keys and values: one row per token, made from its vector by W^Q, W^K and W^V | rows of 64 numbers per head | rows of 16 numbers per head | Ch. 8 · § 3.2 |
| \(W^{Q}_i,\ W^{K}_i,\ W^{V}_i\) | head i's own projection matrices, d_model × d_k each | 512 × 64 | 64 × 16 | Ch. 8 · § 3.2.2 |
| \(W^{O}\) | the output matrix that mixes the joined heads, h·d_v × d_model | 512 × 512 | 64 × 64 | Ch. 11 · § 3.2.2 |
| \(\sqrt{d_k}\) | what every score is divided by | 8 | 4 | Ch. 9 · § 3.2.1 |
| \(-\infty\) | the score given to a forbidden position before the softmax; its weight becomes e^{−∞} = 0 | decoder self-attention only | the same | Ch. 10 · § 3.2.3 |
| \(\mathrm{LayerNorm}(x + \mathrm{Sublayer}(x))\) | the output of every sub-layer: the residual sum, normalised | after every sub-layer (post-normalisation) | the same | Ch. 14 · § 3.1 |
| \(W_1,\ b_1\) | the first linear layer: widens the vector | 512 × 2048, and 2048 biases | 64 × 256, and 256 biases | Ch. 13 · § 3.3 |
| \(W_2,\ b_2\) | the second linear layer: narrows the vector back | 2048 × 512, and 512 biases | 256 × 64, and 64 biases | Ch. 13 · § 3.3 |
| \(\sqrt{d_{\text{model}}}\) | what an embedding is multiplied by when it is looked up | about 22.6 | 8 | Ch. 15 · § 3.4 |
| \(PE_{(pos,\,2i)},\ PE_{(pos,\,2i+1)}\) | the positional encoding: a sine for the even dimension, a cosine for the odd one, added to the token at position pos | fixed sine waves | the same | Ch. 12 · § 3.5 |
| \(pos\) | the token's position in the sentence, from 0 | any | 0 to 31 | Ch. 12 · § 3.5 |
| \(i\) | which pair of numbers: dimensions 2i and 2i + 1 | 0 to 255 | 0 to 31 | Ch. 12 · § 3.5 |
| \(n\) | the sequence length | a sentence of word pieces | up to 10 tokens in training | Ch. 21 · § 4 |
| \(d\) | the representation size, d_model | 512 | 64 | Ch. 21 · § 4 |
| \(k\) | a convolution's kernel size: how many neighbours it reads | any | not used | Ch. 21 · § 4 |
| \(r\) | the neighbourhood of restricted self-attention | a suggestion for future work | not used | Ch. 21 · § 4 |
| \(\beta_1,\ \beta_2\) | how much Adam's running averages of the slopes and of their squares remember | 0.9, 0.98 | 0.9, 0.98 | Ch. 20 · § 5.3 |
| \(\epsilon\) | a tiny number that keeps Adam from dividing by zero | 10⁻⁹ | 10⁻⁹ | Ch. 20 · § 5.3 |
| \(warmup\_steps\) | the steps over which the rate rises; the peak | 4000 | 800 | Ch. 20 · § 5.3 |
| \(step\_num\) | the current training step, from 1 | up to 100,000 (base) | up to 4,000 | Ch. 20 · § 5.3 |
| \(P_{drop}\) | the share of values dropout switches off, in training only | 0.1 (base), 0.3 (big; 0.1 for English–French) | 0.1 | Ch. 14 · § 5.4 |
| \(\epsilon_{ls}\) | the share of the target spread over all tokens | 0.1 | 0.1 | Ch. 20 · § 5.4 |
| \(\text{beam size}\) | how many beginnings beam search keeps at every step | 4 | 4 | Ch. 19 · § 6.1 |
| \(\alpha\) | the length penalty's strength: larger favours longer translations | 0.6 | 0.6 | Ch. 19 · § 6.1 |
| \(\text{BLEU}\) | how closely a translation matches a human one, from 0 to 100 | 28.4 (EN-DE), 41.8 (EN-FR), big model | 99.95 on our 805 held-out sentences | Ch. 19 · § 6.1 |
| \(\text{PPL}\) | perplexity per word piece on the development set; lower is better | 4.92 (base) | not measured; we use the held-out loss | Ch. 20 · § 6.2 |
| \(\text{params}\) | the number of weights, in millions | 65 (base), 213 (big) | about a quarter of a million | Ch. 23 · § 6.2 |
Values from Vaswani et al., Attention Is All You Need (arXiv:1706.03762v7); ours read from the lab's models. Ch. is a Course chapter, § a section of the paper in the Theory tab.