Token (machine learning): Difference between revisions
Appearance
No edit summary |
|||
| Line 11: | Line 11: | ||
* '''Word tokens''': 1 word = 1 token | * '''Word tokens''': 1 word = 1 token | ||
** [[File:Word tokens.png|300px]] | |||
** Advantage | ** Advantage | ||
*** Intuitive | *** Intuitive | ||
| Line 24: | Line 25: | ||
*** Produces long sequences | *** Produces long sequences | ||
* '''Subword tokens''': Words are decomposed into smaller, meaningful units (e.g, morphemes or frequent character $n$-grams) | * '''Subword tokens''': Words are decomposed into smaller, meaningful units (e.g, morphemes or frequent character $n$-grams) | ||
** [[File:Sub-word tokens.png|500px]] | |||
** Balancing between semantic information preservation and vocabulary size | ** Balancing between semantic information preservation and vocabulary size | ||
** Dominant approach in modern [[large language model (LLM)]] | ** Dominant approach in modern [[large language model (LLM)]] | ||
Revision as of 20:41, 10 November 2026

A token is an elementary unit of data used by a machine learning model, particularly in natural language processing (NLP).
Text token
Granularities
Three primary granularities:
- Word tokens: 1 word = 1 token
- Character tokens: 1 character = 1 token
- Advantage
- Smallest vocabulary
- Can represent any string
- Problem
- Loses semantic information
- Produces long sequences
- Advantage
- Subword tokens: Words are decomposed into smaller, meaningful units (e.g, morphemes or frequent character $n$-grams)

- Balancing between semantic information preservation and vocabulary size
- Dominant approach in modern large language model (LLM)