Tokenization is the process of breaking text into smaller units called tokens so that a machine learning model can process them.
Different types of tokenization techniques
1. Word-level tokenization
2. Character-level tokenization
3. Subword-level tokenization
4. Byte-level tokenization
5. Unigram tokenization

BPE (Byte Pair Encoding)
Comparison: Which technique is better?
| Technique | Vocabulary | Sequence length | Common application |
|---|---|---|---|
| Word-level | Large | Short | Traditional NLP |
| Character-level | Small | Very long | Character models |
| Subword | Medium | Medium | Modern LLMs |
| Byte-level | Small base units | Variable | Robust text processing |
| Unigram | Medium | Medium | Modern NLP/LLMs |
If your goal is to build an LLM from scratch, learn these in this order:
- Word-level tokenization – understand the basics.
- Character-level tokenization – understand vocabulary and IDs.
- BPE – understand how modern tokenizers learn vocabulary.
- WordPiece – understand BERT tokenization.
- Unigram – understand probabilistic segmentation.
- Byte-level BPE – understand GPT-style tokenization.

