A language model can only work with a finite set of discrete units, because its input and output layers are indexed by integers. Choosing those units is a trade-off between how large the vocabulary is and how long the sequences become.
The two extremes
Character-level
- Vocabulary of a few hundred symbols
- A 40-word sentence becomes ~200 units
- No unknown symbols, but long sequences to track
Word-level
- Hundreds of thousands of word forms
- Short sequences, one unit per word
- New words, names, and typos fall outside the vocabulary
The subword compromise
Subword tokenization keeps frequent words intact and splits rare ones into smaller pieces that recur across many words. The vocabulary stays in the tens of thousands, sequences stay reasonably short, and almost any text can be represented without an unknown-symbol fallback.
Splitting a sentence
Take the sentence "Tokenization is unbelievably useful." A word-level scheme needs a separate entry for "unbelievably"; a character-level scheme turns it into twelve units. A subword scheme might produce something like: Token | ization | is | un | believ | ably | useful | . — eight units, each drawn from a fixed vocabulary, and the pieces un-, believ-, and -ably also appear in countless other words.