Blogs / What a Token and a Vocabulary Are

What a Token and a Vocabulary Are

What a Hugging Face post says a token is, what the vocabulary maps and why a good tokenizer compresses text into fewer tokens.

  • Learning
  • 1 min read

For: Learners new to language models.

What a token is

A token is the smallest string unit the model sees.[1]

What the vocabulary maps

The vocabulary maps each unique token to the token ID.[1]

A tokenthe smallest string unitthe model seesThe vocabularymaps each unique token toits token IDA good tokenizercompresses text into thefewest tokensmapped by
What do tokens and the vocabulary do?

What a good tokenizer does

A good tokenizer compresses text into the smallest amount of tokens.[1]

Fewer tokens means more usable context without increasing model size.[1]

Sources

  1. Tokenization in Transformers v5 (huggingface.co · checked )

More articles