Multilingual Tokenization and Vocabulary Allocation
Language AI HandbookAll chapters Fertility, script coverage, shared vocabularies, byte models, and unequal token costs across languages.
Suppose a tokenizer encodes cat as one token and बिल्ली as six. The Hindi word occupies six input positions and, at the same per-token input rate, costs six times as much to send. That count does not tell you how much slower the request will be. The model can process input tokens together during prefill, and the work depends on the architecture and the full sequence. Better language modeling can improve what the system does with those six tokens. For a fixed input and tokenizer, the six positions are still occupied.
In Part V we built subword tokenizers from byte pair encoding, WordPiece, unigram language models, and SentencePiece. A multilingual training corpus gives their vocabulary learners evidence from several languages at once. When the corpus is skewed, frequently observed patterns from heavily sampled languages have an advantage. The details depend on the tokenizer and the pieces that languages share.
This chapter explains three ways to diagnose that allocation. Fertility counts tokens relative to words when word boundaries are defined. Bytes per token describes how much text fits in each token, and a tokenization premium compares the token counts of translations. We train two small tokenizers and measure held-out token counts, bytes per token, translation premiums, and token overlap. Those measurements help explain differences in context budgets and per-token costs. The evaluation section shows how to compare loss across tokenizers.
Choose the measurement from the question you are trying to answer. A documentation team deciding how many translated help articles fit in a retrieval context needs token counts on those translations. A tokenizer engineer deciding which part of the corpus needs attention also wants to know how many bytes the tokenizer can encode per position. A language-model researcher comparing the probability assigned by two systems needs a unit of loss that the two systems can both report.
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!