∣V∣|V|

|V| — size of the vocabulary

Read "the size of V". Single bars around a set mean "how many items it has", so |V| is the number of tokens in the vocabulary.

VV is the vocabulary: the fixed list of tokens the tokenizer can produce. ∣V∣|V| counts them. It is 50,257 for GPT-2, 32,000 for LLaMA-2 and 256,000 for Gemma.

Do not confuse it with two similar notations. ∥v∥\|\mathbf{v}\| (double bars) is the length of a vector. ∣x∣|x| on a single number is its absolute value, so ∣−3∣=3|-3| = 3.

Example

V={the,cat,sat}  ⟹  ∣V∣=3V = \{\text{the}, \text{cat}, \text{sat}\} \;\Longrightarrow\; |V| = 3

A toy vocabulary of three tokens.

Where the course uses it

Related terms