Notation conventions

PE(pos,2i)=sin⁡(pos/100002i/dmodel)PE_{(pos, 2i)} = \sin\left(pos / 10000^{2i/d_{model}}\right) Multi-letter names

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

In ML papers

In math, letters written side by side are multiplied: abab is aa times bb. But papers often write whole words in italics, like pospos, modelmodel or softmaxsoftmax, and they mean one name. In the Transformer paper (Vaswani et al. 2017), PE(pos,2i)PE_{(pos, 2i)} is the positional encoding at position pospos, and dmodeld_{model} is the model's width; nothing is being multiplied.

The cleaner way is upright type: softmax⁡\operatorname{softmax} for a function (with \operatorname, which also adds the right spacing) and dmodeld_{\mathrm{model}} or pos\text{pos} for a label. Italic words come from typing them without those commands. Read a run of italic letters as a single name whenever it spells a word.

How to type it

LaTeXShows
\operatorname{softmax}(x) a function namesoftmax⁡(x)\operatorname{softmax}(x)
d_{\mathrm{model}} a labeldmodeld_{\mathrm{model}}
\text{pos}pos\text{pos}

A worked example

dmodel=512meansdmodel=512d_{model} = 512 \quad\text{means}\quad d_{\mathrm{model}} = 512

Same meaning, written two ways; the upright one makes it clear that "model" is a label.

Common confusions

Related

y=Wx+by = Wx + bItalic letters (variables)xi,  Wq,  pθ,  dmodelx_i,\; W_q,\; p_\theta,\; d_{\text{model}}Subscript (index or label)softmax⁡(z)i=ezi∑jezj\operatorname{softmax}(\mathbf{z})_i = \frac{e^{z_i}}{\sum_j e^{z_j}}Softmaxa⋅b\mathbf{a} \cdot \mathbf{b}Centre dot

Decode this example →