Multilingual Tokenization and Vocabulary Allocation › The economics of an unequal vocabulary
Language AI HandbookAll chapters The measurements above are interesting on their own, but the reason multilingual tokenization is a first-class engineering concern is that token counts propagate into everything downstream.
Pre-training budgets
Training budgets often count tokens. Chinchilla studied compute-optimal scaling under a particular training setup, in which roughly twenty training tokens per parameter describes one model-data point. If a collection consumes three times as many tokens for the same number of translated messages, a fixed per-language token budget holds about one third as many such messages, assuming the observed ratio transfers. That arithmetic says how much text fits. It does not establish whether a model is undertrained.
Two models at the same token budget can see different amounts of text. Report bytes seen alongside tokens seen when comparing training exposure across tokenizers. State the encoding and preprocessing used for the byte counts.
Evaluation
Perplexity exponentiates average negative log-likelihood per scored token, with the exponential matched to the logarithm's base. The token unit changes across tokenizers and can represent very different amounts of text across languages even with one tokenizer. A higher token count makes each scoring decision cover a smaller unit on average. The model's probability of that unit is an empirical question.
For comparisons that score the same text span under compatible preprocessing, compute the total sequence loss in bits per UTF-8 byte:
Here counts the token targets that enter the average, and the multiplication recovers the total bits assigned to those targets. Count the UTF-8 bytes in the same span those targets represent. If preprocessing drops or changes text, compare both models on the same retained text and byte span. A raw byte count would include bytes that the model did not score. Match the held-out inputs, conditioning, boundary conventions, and special-token treatment. This per-byte loss scores the token sequence the tokenizer chose. The probability of the decoded text sums the probabilities of all valid token sequences that decode to it. Geh et al. (2024).
Consider the same 100-byte passage scored in two representations. A model that scores 25 targets at four bits per target assigns 100 bits to the passage. Another that scores 50 targets at two bits per target also assigns 100 bits. Both give one bit per byte, despite a twofold difference in average loss measured in bits per token. This equality assumes that the model scores the same complete passage under the same conditioning convention.
Context windows and cost
An 8,192-token context holds about the same number of translated messages as 2,048 English tokens if the measured premium is four and applies to the document in question. That estimate assumes all 8,192 positions are available for the text. Conversation history, system instructions, and generation can take some of those positions. At the same per-token input price, the same document-length ratio also applies to the input charge for those tokens.
When training frequency and deployment goals differ
Greedy BPE selects frequent pairs in the training sample. A deployment workload might instead care about the tail latency of multilingual messages or the cost of serving a fixed number of requests in each language. Those goals can give much more weight to a language than its raw training frequency provides.
Reweighting the tokenizer training mixture can move the allocation. In our example the mixed fit spends more positions on English and fewer on Hindi. Other vocabulary learners can also change their objective. Xu et al. (2021), for example, formulate finding a vocabulary and size for machine translation as an optimal transport problem. That work illustrates explicit vocabulary design in a different setting. VOLT
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!