cat→3797\text{cat} \to 3797

Token

One piece of text the model reads or writes: a word, part of a word, or a punctuation mark. Each token has a whole-number ID in the vocabulary.

A tokenizer splits text into tokens and looks each one up in the vocabulary, giving a whole number. The model then replaces each number with a vector from its embedding matrix (section 1.5). Common words are usually one token; rare words are split into several (section 9.2).

A sentence of NN tokens therefore becomes NN vectors, stacked as the rows of an N×dmodelN \times d_{\text{model}} matrix.

Example

unbelievable→[un,  believ,  able]\text{unbelievable} \to [\text{un},\; \text{believ},\; \text{able}]

One word, three tokens (illustrative split; each tokenizer splits differently).

Where the course uses it

Related terms