TheLantern 13 tokens for a 4-word sentence?
“ኣነ ጥዑም ሙዚቃ ይሰምዕ ።”
That’s “I listen to good music” in Tigrinya. Four words. On Monday I ran it through three multilingual tokenizers and the one I built for Qal, my Tigrinya language model, and counted the pieces:
- XLM-R: 13 tokens
- mBERT: 13 tokens
- mT5: 11 tokens
- Qal: 8 tokens
All four can process Tigrinya. They just represent it VERY differently.
So what’s actually happening here?
Before a language model sees any text, a tokenizer breaks it into tokens. There are three common ways to do that:
- Character-level
Every character is a token. It can represent almost any word, but sequences get long. - Word-level
Every word is a token. It reads naturally, but gets brittle with rare words, spelling variants and languages where one word has many forms (hi, Tigrinya 👋). - Subword-level
Words split into reusable pieces, a practical middle ground.
Most multilingual tokenizers use some form of subword tokenization. They still split text differently, because the algorithm, vocabulary size, training data and language coverage all decide the final tokens.
So why should 13 versus 8 matter?
On Tuesday I wrote about why, and it comes down to cost. A tokenizer QUIETLY controls the cost of the whole pipeline. For Qal, I saw it in three places:
- Training
Longer sequences mean more positions for the same sentence, which affects batch size, training speed and how much context fits in each example. - Learning
Too small a vocabulary splits words into too many fragments, and too large a vocabulary leaves many tokens too rare for a small model to learn well. - Serving
Autocomplete has a latency limit, and more token steps can mean more work at inference. For a writing assistant, even a small delay affects the experience.
Which left one real question. Which algorithm should Qal’s tokenizer use?
On Thursday I shared how I picked. I compared four subword algorithms: byte-level BPE, character-based BPE, Unigram and WordPiece. (BPE, or byte-pair encoding, builds its vocabulary by repeatedly merging the most frequent pair of pieces.)
Byte-level BPE is robust because it can fall back to bytes for anything, but Tigrinya characters are usually 3 bytes in UTF-8, so it may spend its early merges just rebuilding characters (two merges just to get back to one letter). Unigram added more complexity than I needed at this stage, and WordPiece showed no clear advantage over BPE for Qal.
The deciding constraint was Tigrinya itself. Many Tigrinya characters already encode a consonant-vowel unit, so starting from characters made more sense than starting from bytes. The ሙ in ሙዚቃ, for example, is already “mu” in one character. That’s why Qal uses character-based BPE.
Part 3 of Building Qal, my blog series on Substack, went live the same day, with the algorithm choice, the multilingual comparison and the 8K vs 16K vs 32K vocabulary experiments.
So, back to that one sentence about good music.
Four words, 13 tokens or 8. That’s the difference a tokenizer makes before training even starts.
A tokenizer can process your language and still be the wrong fit for your model.
Talk soon,
Fanus
P.S. A quick one for Tigrinya speakers. For “I listen to good music,” would you write “ኣነ ጥዑም ሙዚቃ እሰምዕ ።” or “ኣነ ጥዑም ሙዚቃ ይሰምዕ ።”? Reply with just እ or ይ in the comments or by email. (My tokenizer refuses to pick a side.)
this week's sources
$ Get the next one in your inbox
The Lantern goes out once a week, along with each new part of Building Qal. Unsubscribe anytime.