Velamuvi AIAcademy
Tokenization

Lesson 5 of 5 · Tokens

Tokenisation Across Languages

Why a message can cost several times more tokens in Hindi, Telugu or Chinese than English, how new tokenizers narrow the gap, and what it means for cost.

  • 6 min read
  • Intermediate
  • Reviewed
In this lesson you will learn
  • Why some languages need many more tokens than English for the same meaning
  • How much newer tokenizers have improved, with real measurements
  • What the token gap means for cost, context, speed and quality
  • What to do if you build for speakers of many languages

Same message, different price

A tokenizer's vocabulary is learned from its training text. If that text is mostly English, English words get their own tokens, while words in other languages, especially in other scripts, are left in small pieces. The same message then needs many more tokens.

Switch between three real tokenizers from 2019, 2023 and 2024, and watch the counts for the same greeting in different languages:

Loading the tokenizer…
0 tokens · 7 words · 51 characters
Try a sentence in your own language. A piece shown as � is a single byte, only part of a character: older tokenizers break many scripts into bytes, newer ones have whole words.

Measured, not guessed

Here is the same greeting ("Good morning! How are you today? I hope the weather is nice where you are.") translated into five languages, with real token counts from each tokenizer:

Try it yourselfPython
# Tokens needed for the same short greeting, measured with three real tokenizers:
# GPT-2 (2019), GPT-4's cl100k_base (2023) and GPT-4o's o200k_base (2024)
counts = {
    "English": (18, 18, 18),
    "Spanish": (33, 23, 17),
    "Chinese": (40, 28, 15),
    "Hindi": (114, 78, 23),
    "Telugu": (212, 135, 27),
}
names = ["2019", "2023", "2024"]

english = counts["English"]
header = f"{'language':8}"
for name in names:
    header += f"{name:>14}"
print(header)
for language in counts:
    row = f"{language:8}"
    for i in range(3):
        tokens = counts[language][i]
        row += f"{tokens:>6} ({tokens / english[i]:4.1f}x)"
    print(row)

With the 2019 tokenizer, the Telugu greeting needed almost 12 times as many tokens as English, so it would cost 12 times as much and use 12 times as much context. The 2023 tokenizer roughly halved the gap for many languages, and the 2024 one brought most of them close to English.

Why scripts suffer most

Byte-level tokenizers start from UTF-8 bytes. English letters are 1 byte each; most Indian scripts take 3 bytes per character; many characters in Chinese and Japanese take 3 bytes too. If the vocabulary has few merges for a script, text falls back to short pieces of characters, or single bytes.

The fix is to train the tokenizer on more text in more languages and give it a larger vocabulary, so common words in each language earn their own tokens. That is a large part of why vocabulary sizes have grown from about 50,000 to around 200,000 tokens.

If you build for many languages

  • Measure your own text. Count tokens for real samples in each language with each candidate model's tokenizer; don't assume the English ratio.
  • Budget per language. Cost, context limits and maximum output length all depend on the language.
  • Prefer models with newer, multilingual tokenizers when serving non-English speakers.
  • Test quality per language, not only cost. A model can be cheap in a language and still weaker in it.

Common mistakes

Practice exercise

Measure the token tax for Telugu speakers with an older and a newer tokenizer.

Your solutionPython
english_tokens = 18
telugu_tokens_2023 = 135
telugu_tokens_2024 = 27

# How many times more tokens (and so cost) did the Telugu greeting need
# than the English one, with each tokenizer? Print with 1 decimal:
# 2023 tokenizer: 7.5x
# 2024 tokenizer: 1.5x
Knowledge check

Why did older tokenizers need many more tokens for languages such as Hindi and Telugu?

Summary

  • The same meaning can need many more tokens in some languages: a token tax on cost, context and speed.
  • Real measurements show older tokenizers needed up to 12 times more tokens for Telugu than English; newer ones are close to English.
  • Scripts that use more bytes per character, with few learned merges, suffer most.
  • When building for many languages, measure token counts and test quality per language, and prefer newer multilingual tokenizers.

Course complete

You now know what tokens are, how byte-pair encoding builds a vocabulary, what special tokens do, how to count tokens, and why tokenisation differs across languages. Next: Embeddings shows how tokens and text become meaningful vectors, and Working with AI APIs puts token counting to work.

Finished reading? Tick it off to track your progress.