Skip to main contentSkip to navigation
LLMs & language models · T

Tokenisation

Tokenisation is the process in which text is broken into smaller units, so-called tokens. A token can be a whole word, part of a word or a single character. This tokenisation is a necessary preprocessing step before a language model can process text and helps determine how content is captured and how cost and context length are calculated.

Also known as: tokenisation, tokenization, text tokenisation, tokenizer

What is tokenization?

Tokenization describes splitting text into the individual building blocks a Language model can process. These building blocks are called Token and can vary in size depending on the method, from individual characters through parts of words to whole words. Models do not work directly with letters or words in the human sense but with these tokens.

Tokenisation is thus the bridge between human language and the model's internal representation. Every input text is first turned into tokens, which are then converted into numerical representations and processed by the model.

The component carrying out this splitting is called the tokeniser. It has a set vocabulary of known tokens and a set of rules by which unknown text is translated into that vocabulary. Vocabulary and rules are developed together with the model and stay consistent across its lifetime, so training and later use speak the same language.

How does tokenisation work?

Modern language models mostly use methods breaking words into frequently occurring word parts. Common words are often represented as a single token, while rarer or compound terms are split into several sub-tokens. A great variety of language can thus be covered even with a manageable vocabulary.

A vivid example: a short, common word can correspond to exactly one token, while a long technical term falls into several. Spaces, punctuation and special characters are taken into account in tokenisation too. Which specific method a model uses is part of its architecture and influences how efficiently different languages are processed.

The great advantage of this splitting into word parts is that entirely unknown terms can be processed too. Even if a word has never occurred before, it can be assembled from known building blocks. The vocabulary thus stays manageably large without the model failing on rare or newly coined words, on proper names, technical terms or compounds for instance.

Tokenization, cost and context length

Tokens are the unit of computation for many language models. Both input and output are measured in tokens, and billing for commercial models often follows exactly that. Understanding tokenisation helps judge an application's resource needs better.

The context length of a model is given in tokens. The context window sets how many tokens a model can take into account at once. Long texts, or languages tokenised inefficiently, use more tokens and so more of the context available. Efficient tokenisation therefore matters both for cost and for the usable text length.

In practice it is worth steering token use deliberately. Concise, clearly phrased input, avoiding unnecessary repetition and a well-considered structuring of extensive documents can lower use considerably. In high-volume applications such savings add up, so designing the input efficiently pays directly into the economics.

Tokenising different languages

Not every language is tokenised equally efficiently. Since many tokenisers are built on text collections in which certain languages are more strongly represented, those are often represented with fewer tokens per word. Other languages appearing more rarely in the training material split more often into many small sub-tokens.

For German, the tendency towards long compound words plays a part too. Compounds are mostly broken by the tokeniser into several parts, which can raise token use compared with shorter terms. Anyone planning multilingual applications should take such differences into account, since they affect cost, speed and the usable context length.

This knowledge matters particularly when content is to be processed in several languages. A text with identical meaning can require a different number of tokens depending on the language. A realistic estimate of token needs for the languages actually used helps plan budgets and context limits reliably.

Why tokenization matters in practice

For users, tokenisation matters above all because it directly affects cost, speed and the maximum amount of text that can be processed. Anyone processing large documents or automating many requests benefits from keeping an eye on token use.

Tokenisation also explains some quirks of language models. A model can have difficulty counting letters, for instance, because it perceives text not as individual characters but as tokens. A basic understanding of tokenisation therefore helps place such models' workings and limits better.

At Elisabit we factor tokenisation into the design of AI-driven solutions from the start. By structuring input efficiently and calculating token needs realistically, applications can be built that are both capable and economically viable, especially where large amounts of text or many requests are involved.

Frequently asked questions

What is a token in tokenization?

A token is a language model's smallest unit of processing and can be a whole word, part of a word or a single character. In tokenisation, text is split into exactly such tokens before the model processes it.

Why does tokenization matter for cost?

Many language models bill by the number of tokens processed, for both input and output. Efficient tokenisation can therefore noticeably affect token use and so an application's cost.

How is tokenization connected to context length?

A model's context length is given in tokens and sets how much text can be taken into account at once. Texts that split into many tokens use up more of the available context window.

Are all languages tokenised the same way?

No. Depending on the training material, some languages are represented more efficiently than others. German, with its long compound words, can need more tokens per word, which affects cost and context length.

Why can models sometimes not count letters?

Language models perceive text not as individual letters but as tokens. Because a token often spans several characters, models find it harder to count individual letters within words correctly.

Put AI to work for your business?

We help you integrate artificial intelligence into your processes, your marketing and your website — strategically and securely.

Request a project

Stefan

Your contact

Stefan

I look forward to hearing about your project and finding the best solution together.