Home Knowledge Base Subword Tokenization

Subword Tokenization is the text preprocessing technique that segments input text into a vocabulary of subword units — smaller than whole words but larger than individual characters — enabling language models to handle any text (including rare words, misspellings, and novel compounds) by decomposing unknown words into known subword pieces while keeping common words as single tokens for efficiency.

Why Not Words or Characters?

Major Algorithms

Vocabulary Size Tradeoffs

SizeTokens per TextEmbedding TableSemantic Density
32KLonger sequencesSmallerLess info per token
64KMediumMediumBalanced
128K+Shorter sequencesLargerMore info per token

Larger vocabularies produce shorter token sequences (better for long contexts) but require a larger embedding matrix and may underfit rare tokens. Most modern LLMs use 32K-128K tokens.

Multilingual Considerations

For multilingual models, the tokenizer must allocate vocabulary across languages. If 90% of training data is English, 90% of the vocabulary will be English-optimized, causing non-Latin scripts (Chinese, Arabic, Devanagari) to be over-segmented into many small pieces per word — increasing sequence length and degrading efficiency for those languages.

Subword Tokenization is the linguistic compression layer that makes language models tractable — resolving the fundamental tension between vocabulary completeness and vocabulary efficiency by learning a data-driven decomposition that balances the two.

byte pair encoding tokenizerwordpiece tokenizersentencepiece tokenizersubword tokenizationtokenizer vocabulary

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.