الانتقال إلى المحتوى
Deep Learning و LLMsTransformers· 7 دقائق للقراءة

Tokens Aren't Words: Why Arabic Costs More and Models Miscount Letters

A token is a chunk the tokenizer learned from data, and that one fact shapes your bill, your context and letter counting.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A team in Cairo prices its support assistant from the English pilot. They measure tokens per conversation, divide by words, get a tidy ratio and apply it to the Arabic launch. The first Arabic bill comes in far above the forecast, long chats hit the context limit sooner than anyone planned, and QA files a bug that looks unrelated: asked how many times a letter appears in a product code, the assistant gets it wrong. All three have the same root cause.

The common misconception

"A token is basically a word, so 1,000 words cost about 1,000 tokens in any language." It's an easy belief to pick up:

  • In classic text processing, tokenizing meant splitting on spaces and punctuation, so a token really was a word.
  • Common English words often map to a single token, so English examples look like word counts.
  • Rules of thumb travel without their fine print. Anthropic's glossary says a token is approximately 3.5 English characters on Claude models before 4.7: English, and those models only.
  • Chat interfaces show you words, never tokens.

The half-truth is that some tokens are words. Which ones, and how many tokens everything else needs, is decided by the tokenizer and the data it was built from.

What actually happens

A never reads text directly. A first turns the text into a sequence of , each one an ID from a fixed vocabulary, and the model reads and predicts those IDs.

A tokenizer learns its vocabulary from data

Most LLMs use subword tokenizers, and the best-known recipe is (BPE), which Sennrich, Haddow and Birch adapted for neural machine translation. Training starts from single characters (or bytes) and repeatedly merges the most frequent adjacent pair into a new symbol. Each merge becomes a vocabulary entry, until the size budget runs out. Frequent strings end up as one token; rare strings stay in pieces. The upside is an open vocabulary: any word, even one never seen in training, can still be encoded as smaller pieces.

Why the same text costs more in Arabic

The merges go to whatever is frequent in the tokenizer's training text. When that text is mostly English, English words get merged into single tokens and Arabic words keep falling apart. Petrov and colleagues measured this on FLORES-200, the same 2,000 Wikipedia sentences translated by people into 200 languages. The tokenizer behind ChatGPT and GPT-4 needed about 3 times as many tokens for Standard Arabic as for English, and GPT-2's needed 4.4 times. In GPT-2, the everyday Arabic word for "why" was split into one token per letter.

Byte-level tokenizers add a second gap. They start from UTF-8 bytes, where an English letter takes one byte and an Arabic letter takes two, so each Arabic letter begins as two units before any merge happens.

None of this is a law about Arabic. Multilingual tokenizers in the same study, such as XLM-R's and BLOOM's, brought Standard Arabic down to between 1.14 and 1.40 times English. The ratio belongs to the tokenizer, so measure the one you actually use.

What a token count controls

The study lists three consequences: cost, because APIs bill per token; latency, because more tokens take longer to process; and context, because a fixed-size window holds less text in a token-hungry language. Anthropic's docs add a twist: the tokenizer can change between model generations. Claude models from 4.7 on use a newer tokenizer that produces approximately 30 percent more tokens for the same text than earlier ones, so a count measured on one model doesn't transfer to the next.

Why models miscount letters

The model never receives letters. It receives token IDs, numbers that stand for chunks. If "strawberry" arrives as a few multi-letter chunks, the letters inside each chunk aren't separate inputs; the model only knows how a token is spelled from patterns it absorbed in training. Research on letter counting links the errors to tokenization, but not only to it: Fu and colleagues found that models usually recognize which letters a word contains yet still miscount them, and most fail when a letter appears more than twice.

Watch BPE at work

This script trains a toy BPE tokenizer on mostly English text with a little Arabic, then tokenizes three words.

Python toy_bpe.py
from collections import Counterfrom functools import reducedef merge(symbols, pair):  # glue every adjacent occurrence of `pair`    out = []    for s in symbols:        if out and (out[-1], s) == pair:            out[-1] += s        else:            out.append(s)    return outdef learn_bpe(words, n_merges):  # repeatedly merge the most frequent pair    words, merges = [list(w) for w in words], []    for _ in range(n_merges):        pairs = Counter(p for w in words for p in zip(w, w[1:]))        merges.append(pairs.most_common(1)[0][0])        words = [merge(w, merges[-1]) for w in words]    return mergescorpus = "why does the model read tokens not words".split() * 50 + ["لماذا"] * 3merges = learn_bpe(corpus, 20)  # a vocabulary budget of 20 mergesfor word in ["why", "tokens", "لماذا"]:    n_tokens = len(reduce(merge, merges, list(word)))  # apply merges in order    print(f"{len(word)} letters, {n_tokens} tokens, {len(word.encode())} bytes")

It prints 3 letters, 1 tokens, 3 bytes, then 6 letters, 1 tokens, 6 bytes, then 5 letters, 5 tokens, 10 bytes. The English words became single tokens, while the Arabic "why" stayed one token per letter, just like GPT-2 in the study, and its 5 letters take 10 bytes. Notice "tokens" too: 6 letters, one ID. Ask this model how many times "o" appears in it and the answer depends on what it learned about that ID, not on letters it can see.

MythReality
A token is a wordA token is a learned chunk: a word, part of a word, a letter or a few bytes
1,000 words is about 1,000 tokens anywhereOn GPT-4's tokenizer, Arabic took about 3 times the tokens of the same English text
A token count is fixed for a textIt changes with the tokenizer; newer Claude models count about 30 percent more
The model reads lettersIt reads token IDs and learns spelling only indirectly
Arabic is simply expensiveMultilingual tokenizers brought Arabic to 1.14–1.40 times English

How to apply it in your project

  1. Measure tokens per languageTake a sample of real prompts in each language you support and count them with your provider's token counter. Budget from those numbers, not from words.
  2. Recount when you change modelsTokenizers change between model generations. Rerun the counts before a migration and update your cost and context estimates.
  3. Trim and limit by tokensSize history windows, retrieval chunks and output limits in tokens, with headroom for your most token-hungry language.
  4. Do letter-level work in codeCounting characters, enforcing length limits or validating codes takes one line of code. Compute it and give the model the result.

Key takeaways

  • A token is a chunk a tokenizer learned from data, not a word: frequent strings become one token, rare ones stay in pieces.
  • Token counts depend on language and tokenizer; on GPT-4's tokenizer, Arabic took about 3 times as many tokens as the same English text.
  • Tokens set cost, latency and how much fits in the context, so budget from measured counts per language and model.
  • Models see token IDs, not letters, so leave character-level tasks to code.

📚 المصادر

  1. Sennrich, Haddow and Birch, Neural Machine Translation of Rare Words with Subword Units, arXiv:1508.07909
  2. Petrov et al., Language Model Tokenizers Introduce Unfairness Between Languages (NeurIPS 2023), arXiv:2305.15425
  3. Token counting — Claude API Docs
  4. Glossary: Tokens — Claude API Docs
  5. Fu et al., Why Do Large Language Models (LLMs) Struggle to Count Letters?, arXiv:2412.18626

التعليقات (0)