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

  1. Input text goes through Unicode normalisation and pre-splitting on whitespace and punctuation.
  2. 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.
  3. Each piece is mapped to an integer ID in the vocabulary; the model sees only this sequence of IDs.
  4. 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 (``) tokens are eliminated entirely, though non-ASCII Turkish characters (ğ, ş, ı) may split into two byte-level tokens if missing from frequent merges.

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

TermHow it differs
Stemming and lemmatisationTokenisation 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.
ChunkingChunking 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.

ON-PREMISES EXAMPLE

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.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.