What is tokenisation?
Tokenisation is the preprocessing step that splits text into tokens a language model can process and maps each token to an ID in the model's vocabulary.
It is also spelt tokenization. It differs from a tokeniser in that tokenisation is the process, while the tokeniser is the component that performs it. It is not just splitting on spaces; subword methods turn frequent character sequences into single tokens.
- Topic
- Core concepts
- Also known as
- Tokenization
How tokenisation works
- Input text goes through Unicode normalisation and pre-splitting on whitespace and punctuation.
- A subword algorithm such as Byte Pair Encoding or Unigram splits it using a learned vocabulary: BPE applies merge rules, while Unigram picks the most likely segmentation; rare words become smaller pieces or bytes.
- Each piece is mapped to an integer ID in the vocabulary; the model sees only this sequence of IDs.
- After generation the reverse step turns IDs back into readable text.
In more detail
Byte-level BPE and Turkish characters
Modern LLMs predominantly use byte-level BPE (originating in GPT-2), which builds merges atop the 256 raw UTF-8 byte values. As a result, out-of-vocabulary unknown (`
How a model or tokeniser change affects production pipelines
Changing a generation model's tokeniser invalidates saved token-count limits and prompt-cache keys, while changing an embedding model's tokeniser requires re-embedding the entire vector database to keep retrieval consistent.
Commonly confused terms
| Term | How it differs |
|---|---|
| Stemming and lemmatisation | Tokenisation is the preprocessing step that splits text into subword units and maps them to integer IDs; stemming and lemmatisation are classical linguistic normalisation methods that strip suffixes or map words to dictionary base forms, often discarding grammatical nuance. |
| Chunking | Chunking splits long documents into multi-hundred-token passages for RAG retrieval and indexing; tokenisation breaks text into individual subword tokens at the model input boundary. |
Why tokenisation matters for on-premises AI
Tokenisers whose vocabulary was learned mostly from English can split Turkish suffixes into separate pieces, so the same content takes more tokens, less text fits in context and generation slows. That is why capacity and cost are calculated in tokens rather than words or characters; RAG chunk boundaries also follow the model's tokenisation. The tokeniser is versioned with the model, since a changed tokeniser can invalidate earlier calculations and embeddings.
A legal department converts long Turkish contracts into tokens in its in-house summarisation system and splits them into sections that fit the model's context limit.
Common questions
Why can tokenisation be a problem for Turkish?
Tokenisers trained mostly on English split Turkish suffixes into separate pieces. Token counts rise, less text fits in context and responses slow down.
Why do models use subword rather than word-level tokenisation?
Word-level tokenisation needs a huge vocabulary and cannot handle unseen words. Subword methods represent rare and derived words with root and suffix pieces using a manageable vocabulary.
Related terms
- Token
- Byte Pair Encoding
- Subword tokenisation
- Unigram tokenisation
- Tokeniser
- Vocabulary
- Token fertility
- Agglutinative language
Sources
- Sennrich, Haddow and Birch, Neural Machine Translation of Rare Words with Subword Units, 2016
- Kudo and Richardson, SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing, 2018
In the glossary: Glossary, R to Z