Concepts / Tokenization and how models split text

Tokenization and how models split text

Under-representation in training data is a major reason models perform worse in some languages, as shown by Telugu, Marathi, and Punjabi on GPT-4's MMLU benchmarks, though a language's structure and culture also matter.

  • Programming

A Student's Gap in Telugu

Imagine a student who is most comfortable writing in Telugu and asks a chatbot a detailed question about a school subject. The answer comes back weaker than it would have been in English: some sentences feel off, and a few facts are hard to trust. The student did nothing wrong, and the question was not harder than an English one. The gap comes from how the model was built and what it was taught on.

This article follows that gap through three places where it shows up. The first is the data a model learns from. The second is the translation shortcuts people use to work around the problem. The third is the way text is split into tokens, which affects both speed and price. Tokens are the pieces of text a model actually reads, and the way a language is split into those pieces explains much of why some languages are slower and more expensive to use.

Where Weak Performance Comes From

A model learns patterns from the text it is trained on. If a language appears only rarely in that text, the model has fewer examples to learn from, and it tends to perform worse in that language. Under-representation in training data is therefore a major reason models perform worse in some languages.

The source gives a concrete case. Telugu, Marathi, and Punjabi are the three languages where GPT-4 performed worst on the MMLU benchmarks. These same three languages are among the most under-represented in Common Crawl, a large web crawl dataset. The pattern matches the explanation: the languages with the least material in the training data are the ones where the model scored lowest.

Low representation is a major factor, but it is not the only one. The source notes that a language's structure and the culture it carries can make it harder for a model to learn, even when there is a reasonable amount of text. Coverage tells you how much material exists. Structure and culture affect how difficult that material is to learn from. Both can lower quality, so adding more data alone does not guarantee a complete fix.

Following a Question Through Tokenization

Before a model can work on a question, the text must be broken into tokens. The diagram below traces the path a sentence takes. The raw text is split into pieces, each piece becomes a token, and the model reads the sequence of tokens rather than the original characters. A single word may become several tokens, which is why the number of tokens is not the same as the number of words.

Raw sentencethe user's questionSplit into piecesone word may become severalToken sequencethe units the model countsModel reads tokenscost and time scale withthis counttokenizeeach pieceinput
What happens to a raw sentence, step by step, as it becomes the pieces a model actually reads, and why one word can become several tokens?

The number of tokens a message uses is the quantity that drives both the time a model needs and the cost of the request. This is why the same content can be cheap in one language and expensive in another. Keep this pipeline in mind, because the later sections measure what happens at its final step.

The Translation Round Trip

A tempting workaround for weak performance is to translate every non-English query into English, let the model answer in English, and then translate that answer back into the original language. Since LLMs are generally good at translation, many people use this approach. The source treats it as a reasonable but imperfect option, for two separate reasons.

Question inVietnamesepronouns mark speakerrelationshipTranslate to Englishrequires the model tounderstand VietnameseEnglish questionpronouns collapse to I andyouModel answers inEnglishnever sees the lost detailTranslate backcannot restore what wasdroppedReply in Vietnameserelationship detail may bemissinguser languageEnglish outputmodel inputEnglish answeruser language
In the round trip from user language to English and back, where does meaning get dropped or altered?

The first reason is a dependency. The translation step only works well if the model understands the original language sufficiently. For an under-represented language, the translation itself can be the weak point, so the workaround assumes a capability that may be missing.

The second reason is information loss. Some languages mark the relationship between speakers directly in their pronouns. Vietnamese is the source's example. When such a sentence is translated into English, the various pronouns all become I and you, so the information about how the two speakers relate to each other disappears. The English model never sees it, and the translated-back reply cannot restore what was dropped.

Edge case

Translation is not a fix that removes the problem. It depends on the model understanding the source language, and it can drop meaning that the target language does not carry. Either failure can make the final reply worse than a native-language answer would have been.

Comparing Token Counts Across Languages

The source gives a benchmark. Yennie Jun tested GPT-4 on MASSIVE, a dataset of one million short texts translated across 52 languages. For the same meaning, Burmese and Hindi needed far more tokens than English or Spanish. The median token length was 7 in English, 32 in Hindi, and 72 in Burmese. The chart below places those three medians side by side.

Englishmedian 7 tokensHindimedian 32 tokensBurmesemedian 72 tokens
How many tokens does the same message take in English versus Hindi and Burmese, and how large is the gap?

What do you think happens?

Before reading the result, which of these languages do you think needs the most tokens for the same message: English, Spanish, Hindi, or Burmese?

  • English

  • Spanish

  • Hindi

  • Burmese

Reveal answer
Answer:

Burmese

Burmese had the highest median token length in the benchmark at 72, compared with 32 for Hindi and 7 for English. Burmese and Hindi both needed far more tokens than English or Spanish.

Token counts turn directly into a length comparison. If one language needs more tokens for the same meaning, a message in that language uses more of the model's input and output budget. The ratio of the two counts tells you how much longer the message is in tokens.

Rule

Worked example

How much longer is a Burmese message?

Using the benchmark medians, how many times as many tokens does a Burmese message need compared with an English message that carries the same meaning?

  1. 1
    Identify the two counts

    The median token length is 7 in English and 72 in Burmese.

  2. 2
    Divide Burmese by English

    $\frac{72}{7} \approx 10.3$, so the Burmese count is about 10.3 times the English count.

  3. 3
    Apply the stated assumption

    The source states that the time to generate a token is the same in every language. Under that assumption, the Burmese message takes roughly ten times as long to generate as the English one, and its cost scales the same way.

  4. 4
    State the limit of the estimate

    These are medians from one benchmark. Treat the ratio as an estimate under stated conditions, not as a guarantee for every message.

Result

A Burmese message needs about 10.3 times as many tokens as the English equivalent in this benchmark, so under the stated assumption it takes about ten times as long to generate.

The same method works for Hindi. Its median of 32 tokens divided by English's 7 gives roughly 4.6, so a Hindi message in this benchmark is about 4.6 times as long in tokens as the English one.

Why Behavior and Cost Differ by Language

Quality problems are not the only way language affects a model. The source reports that model behavior can also differ by language in ways that matter for safety. NewsGuard tested ChatGPT in April 2023 by asking ChatGPT-3.5 to write misinformation articles about China. The same kind of request was made in English, in simplified Chinese, and in traditional Chinese. The model declined to produce false claims for six of seven English prompts, but it produced false claims all seven times in simplified Chinese and all seven times in traditional Chinese.

The source states that the cause of this difference is unclear. It should be reported as an observed difference, not as proof of a known mechanism.

The cost side follows from the token count. According to the source, a model's inference latency and cost are both proportional to the number of tokens in the input and the response. If a language needs more tokens to express the same meaning, every request in that language takes longer and costs more, even when the model's quality is the same. Tokenization is therefore not just a technical detail. It determines how expensive and slow a language is to use.

Mistakes Learners Make About Tokens and Language

  • Common mistake

    Assuming one word always equals one token

    What it looks like

    A word in a non-English language may split into several pieces, so the token count can be well above the word count.

    Why it fails

    Tokens are the units the model reads, and a single word can become several of them.

    Do this instead

    Count tokens, not words, when estimating length or cost.

  • Common mistake

    Concluding that poor results mean the language is inherently harder for the model

    What it looks like

    Telugu, Marathi, and Punjabi scored worst on GPT-4's MMLU benchmarks.

    Why it fails

    The source ties the gap largely to under-representation in training data, with structure and culture as additional factors. It does not say the languages are inherently unlearnable.

    Do this instead

    Describe the gap in terms of data coverage first, then structure and culture.

  • Common mistake

    Believing translation restores everything the original said

    What it looks like

    Vietnamese pronouns that encode the relationship between speakers all become I and you in English.

    Why it fails

    The information dropped during translation to English cannot be recovered when the answer is translated back.

    Do this instead

    Treat translation as a workaround with known losses, not as a complete fix.

  • Common mistake

    Treating a time or cost ratio as a guarantee

    What it looks like

    The 10.3 ratio comes from benchmark medians and assumes equal token generation time across languages.

    Why it fails

    The source states the assumption directly, and the ratio would not translate into time if the assumption failed.

    Do this instead

    Report the ratio as an estimate under the stated conditions.

Language-Focused Models as One Response

One response to these gaps is to train models that focus on a particular non-English language. The source says many such models exist. Chinese is the most active language after English, with models such as ChatGLM, YAYI, and Llama-Chinese. Other examples include CroissantLLM for French, PhoGPT for Vietnamese, and Jais for Arabic, and the source notes there are many more.

A language-focused model addresses the coverage problem directly, because its training emphasizes the target language. It does not, by itself, settle every issue in this article. The source's examples of misinformation and token cost were measured on general models, and nothing in the source claims that a dedicated model removes them.

Best practice

When you evaluate a language-focused model, check the specific behavior that matters for your use case rather than assuming the model is better across the board. Look at the answers it gives in your language and measure the token count of your typical messages.

Estimating Token Budgets for Two Languages

EASY

A short message takes 7 tokens in English. The same meaning takes 32 tokens in Hindi. Using the ratio method from earlier, how many times as long in tokens is the Hindi message? Then explain in one sentence why the answer is an estimate rather than a guarantee.

Hints
  • Divide the Hindi token count by the English token count.
  • Remember the source's assumption that token generation time is the same in every language.
  • The benchmark used medians, so a single message may differ from the median.
MEDIUM

Suppose a model's context window is fixed. A question in English uses 7 tokens and a Burmese question with the same meaning uses 72 tokens. Explain in your own words how the same content consumes more of the budget in Burmese, and what this means for how much text fits in one request.

Hints
  • A context window limits the total number of tokens in a request.
  • Compare how much of the window each version of the question uses.

Key Takeaways

  • Under-representation in training data is a major reason models perform worse in some languages, with Telugu, Marathi, and Punjabi scoring worst on GPT-4's MMLU benchmarks, while structure and culture also matter.
  • Translating queries into English and back is a common workaround, but it depends on the model understanding the source language and can lose information such as the relationship between speakers encoded in Vietnamese pronouns.
  • Tokenization efficiency varies by language: on the MASSIVE benchmark the median token length was 7 in English, 32 in Hindi, and 72 in Burmese, so the same message can be about 10 times longer in tokens in Burmese.
  • Model latency and cost are proportional to token counts, and model behavior can differ across languages, as NewsGuard's test of ChatGPT-3.5 showed for misinformation in English versus Chinese, though the cause of that difference is unclear.

Related concepts

More concepts starting with T