Advanced level · Module 6: Transformer Architecture and Modern NLP · Lesson 2 of 4
Subword Tokenisation and Low-Resource Languages
Learners inspect how pretrained tokenisers split English, Juba Arabic and other text into subwords, and measure the extra cost and quality risks for under-represented languages.
In this lesson you will
- Explain BPE, WordPiece and SentencePiece tokenisation
- Measure tokenisation fertility across languages
Key concepts
subword tokenisationAutoTokenizertokens per word (fertility)vocabulary coveragecontext length cost
The lesson
Transformers use subword tokenisers. Frequent words stay whole, while rare words are split into pieces ('registration' might be one token, an unfamiliar name several). AutoTokenizer.from_pretrained(name) loads the tokeniser that matches a model.
Fertility, the average number of tokens per word, shows how well a tokeniser fits a language. Languages poorly represented in pretraining are split into many short pieces, so the same sentence uses more of the model's context window and computing budget, and the model has seen few of the resulting patterns.
Measure fertility for English, Juba Arabic (Latin script) and, where a verified source exists, Dinka or Nuer sentences (for example from the FLORES+ evaluation set, which requires accepting its terms). Report the numbers rather than assumptions.
Step by step
- Load the tokeniser of a multilingual model and of an English-only model.
- Tokenise ten English and ten local-language sentences with each.
- Compute fertility for each language and tokeniser.
- Write what the results imply for cost and quality.
Practice activity
Produce a tokenisation fertility table across languages and two tokenisers, with implications.
Expected result: A measured table and a reasoned note on cost and quality risks for local languages.
Check your understanding
-
What is tokenisation fertility?
Show answer
The average number of subword tokens per word.
-
Why is high fertility a problem?
Show answer
Texts use more context and compute, and the model has seen few of those token patterns.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.