Tokenization
Tokenization is the step that splits text or other input into tokens, the units a language model actually reads and writes, and maps each token to a number.
A language model does not see letters or words. Before any text reaches it, a tokenizer breaks the text into pieces called tokens and replaces each with an ID number from a fixed vocabulary. The model works entirely on those numbers and produces new ones, which the tokenizer turns back into text. Google's machine learning glossary defines a tokenizer as a system that translates a sequence of input data into tokens, and notes that multimodal models need tokenizers for each kind of input, for example turning text into subwords and images into small patches.
Most modern tokenizers use subwords. Common words such as going stay whole, while rarer words are split into familiar parts: itemize might become item and ize. This keeps the vocabulary manageable while letting the model handle any word, including names and new coinages. A widely used method, byte pair encoding, adapts a 1994 data compression technique: it starts from single characters and repeatedly merges the pair of symbols that occurs most often into a new symbol, until the vocabulary reaches the chosen size. In August 2015 Rico Sennrich, Barry Haddow and Alexandra Birch showed it could let translation models handle rare and unknown words, improving results on English-German and English-Russian translation.
OpenAI's rule of thumb for English is that one token is roughly four characters, or about three quarters of a word, so 100 tokens is about 75 words. The ratio is different for other languages. Exact counts come from tools such as OpenAI's online tokenizer page and its open-source tiktoken library, and different model families use different tokenizers, so the same text can have different token counts.
Token counts matter because almost everything about a language model is measured in them: prices per million tokens, the size of the context window and the speed of generation. That makes tokenization a question of fairness as well as engineering. A NeurIPS 2023 paper by Aleksandar Petrov and colleagues found that the same text translated into different languages could produce token sequences differing in length by up to 15 times, so speakers of some languages pay more, wait longer and fit less into a model's context.
Tokenization also explains some odd failures. Because a model sees tokens rather than letters, tasks that depend on individual characters, such as counting the letters in a word or spelling it backwards, are harder for it than they look. The model never saw the letters, only the IDs of the chunks they were grouped into.
It is the process of splitting input, usually text, into tokens and converting each into a number the model can process. Tokens are often whole words for common words and parts of words for rarer ones. The model reads and generates these tokens rather than letters or words. In English, OpenAI's rule of thumb is about four characters or three quarters of a word per token, so 100 tokens is roughly 75 words. Other languages differ, and different models use different tokenizers, so exact counts need the model's own tokenizer. Tokenizers are built from training text, and languages that were less common in that text are split into more, smaller pieces. Research published at NeurIPS 2023 found differences of up to 15 times in token length for the same text across languages, which affects cost, speed and how much fits in a context window. Because they do not see letters. The tokenizer groups characters into chunks before the model sees anything, so the model works with token IDs, not spellings. Tasks that depend on individual characters are therefore harder for it than tasks about meaning.Common questions
What is tokenization in AI?
How many words is a token?
Why do some languages use more tokens?
Why can't AI models count letters in a word?
Search for "LLM tokenization", "byte pair encoding" or "tokenizer language disparity" to understand how text is split and why it matters. Reliable sources include provider documentation on tokens and pricing, open-source tokenizer libraries and research papers on arXiv. Count tokens with the specific model's tokenizer rather than relying on general rules when cost or context limits matter.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.