Jump to content

Token (machine learning): Difference between revisions

From Wikibase
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Category:Token| ]]
[[Category:Token| ]]
[[Category:Machine learning]]
[[File:Machine learning tokens.png|thumbnail|300px|A '''token''' is a small fragment of data (e.g., a sub-word, a small group of pixels, a short segment of an audio wave function) carrying some meaning.]]
[[File:Machine learning tokens.png|thumbnail|300px|A '''token''' is a small fragment of data (e.g., a sub-word, a small group of pixels, a short segment of an audio wave function) carrying some meaning.]]
A '''token''' is an elementary unit of data used by a [[machine learning]] model, particularly in [[natural language processing (NLP)]].
A '''token''' is an elementary unit of data used by a [[machine learning]] model, particularly in [[natural language processing (NLP)]].
Line 11: Line 10:


* '''Word tokens''': 1 word = 1 token
* '''Word tokens''': 1 word = 1 token
** [[File:Word tokens.png|300px]]
** Advantage
** Advantage
*** Intuitive
*** Intuitive
Line 24: Line 24:
*** 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)]]

Latest revision as of 15:06, 11 November 2026

A token is a small fragment of data (e.g., a sub-word, a small group of pixels, a short segment of an audio wave function) carrying some meaning. · Open in a new tab

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
    • Advantage
      • Intuitive
    • Problem
      • Suffers from a large vocabulary
      • Poor handling of words unseen in training data
  • Character tokens: 1 character = 1 token
    • Advantage
      • Smallest vocabulary
      • Can represent any string
    • Problem
      • Loses semantic information
      • Produces long sequences
  • Subword tokens: Words are decomposed into smaller, meaningful units (e.g, morphemes or frequent character $n$-grams)