A subword is a word fragment between a complete word and a single character. It can carry part of a word’s meaning: schoolhouse may become school and house, while thoughtful may become thought and ful. section 2.2
Subwords help language models represent text through tokenization:
- Byte-pair encoding starts with individual characters, repeatedly combines frequent neighboring pairs, and stops when the vocabulary reaches a suitable size. section 2.2.3
- The resulting vocabulary balances compact representation against coverage: a vocabulary that is too small may fail to represent unfamiliar words. section 2.2.2
- Token identifiers do not inherently preserve relationships such as shared prefixes, suffixes, capitalization, or similar spelling; models learn such relationships from data. section 2.2 section 2.6
A frequent-pair merge
Imagine that the adjacent letters n and g frequently occur together. Byte-pair encoding can merge them into an ng token, replace those pairs, add ng to the vocabulary, and continue merging other frequent pairs. section 2.2.3
Figure 2.5 A simplified byte pair encoding algorithm for creating tokens: first, find the most frequent pair of characters “ng.” Next, replace all instances of “ng” with a placeholder token “T,” and add “ng” to the vocabulary. Repeat the process until no common byte pairs remain.
The figure traces byte-pair encoding from frequent character pairs to merged subword tokens. section 2.2.3






