TL;DR
Neural translation models have a fixed vocabulary, so any word outside it is lost or replaced by a placeholder. This paper keeps the vocabulary small by splitting rare words into pieces, using a compression method called byte pair encoding that repeatedly joins the most frequent adjacent pair of symbols. The model then translates over these pieces, so it can handle words it has never seen. On the WMT 2015 English to German and English to Russian tasks, subword models beat a back-off dictionary baseline, and the best BPE system gains 1.3 BLEU over that baseline on English to Russian.
Builds on: Subword Tokenization, Encoder-Decoder Architecture, Attention Mechanism · Leads to: sequence-to-sequence translation, attention-based translation
Why it mattered
Subword vocabularies built this way became common in later translation systems and language models. The method is simple: a list of merge rules learned from text, applied to any new word. Systems can handle names, compounds or inflected forms without a back-off dictionary. The paper reports its largest gains on rare and unseen words, which a word-level model handles poorly.
The problem
A word-level neural translator keeps a list of its most frequent words, typically 30,000 to 50,000, and maps every other word to a single unknown symbol. The paper states this limit directly: the vocabulary of neural models is typically limited to 30,000 to 50,000 words, but translation is an open-vocabulary problem. Names, compounds such as German nouns built from several words, and rare inflections fall outside the list.
The usual fix is a back-off dictionary. When the model emits an unknown symbol, the system looks up the source word in a dictionary and copies or translates it. The authors argue that this makes assumptions that often fail. There is not always a one-to-one match between source and target words, because of differences in morphology. Copying a name works for some language pairs and not for others, for example when the alphabets differ.
The question is therefore: can a neural translator work on an open vocabulary directly, with a fixed-size vocabulary of pieces, and do better than the back-off baseline?
How it works
The method has three parts: learn the subword vocabulary from text, split any new text with it, and train and run a translator on the split text.
- Start with characters. Take a training vocabulary of words and their counts. Represent each word as a sequence of characters, and add a special end-of-word symbol so that the original words can be restored after translation. In the notes below the end symbol is written as an underscore.
- Count adjacent pairs. Count every pair of neighbouring symbols across all words, weighted by how often each word occurs.
- Merge the most frequent pair. Replace every occurrence of that pair with one new symbol. The new symbol is a longer piece, for example an "er" from an "e" followed by an "r".
- Repeat. Recount the pairs with the merged symbols and merge again. Stop after a chosen number of merges. That number is the only hyperparameter of the method.
- Segment new text. For any word, including one never seen in training, split it into characters and apply the learned merges in the order they were learned. Each word becomes a sequence of known pieces.
- Train and translate. The translator reads and writes the pieces. After translation, joining the pieces and removing the end markers restores the words.
Here is a toy trace with four words and their counts: low (5), lowest (2), newer (6), wider (3). This toy is our own; the paper's Figure 1 uses similar words with different counts.
Step 1 has pair counts of and from the words newer and wider. They tie, so take and merge it into "er". Now newer is and wider is .
Step 2 counts the pairs again. The pair now occurs in newer (6) and wider (3), so its count is 9. It is the most frequent pair, so merge it into "er_".
The merges learned so far are and then . Now segment the unseen word lower. Its characters are . The first merge gives , and the second gives . The word splits into , and every piece is known. The unseen word newest contains none of the learned pairs, so it stays as characters. That is the fallback: a rare word is always representable, just in smaller pieces.
flowchart LR A["Training words with counts"] --> B["Start from characters plus end marker"] B --> C["Count adjacent pairs"] C --> D["Merge most frequent pair"] D -->|"repeat for N merges"| C D --> E["Apply the merges to any text"] E --> F["Train and run the NMT model on pieces"]
The paper also explains why this helps the translator, which learns vector representations of the pieces just as it would of words. Frequent words or common character sequences become single symbols, so they still cost one step. Rare words become several pieces, and each piece is a symbol the model has seen many times. The model therefore learns to translate the parts of a rare word, such as a name or a compound, even if the whole word appears only once.
The math
Let be the set of characters plus the end symbol. Let be the training vocabulary, a list of words with counts . For a current segmentation of each word into symbols, the count of an adjacent pair is
where is the number of places in word where symbol is directly followed by symbol .
Step 2 and 3 in symbols: choose and merge
At each merge, choose the most frequent pair
and add the new symbol to the vocabulary. In the toy trace, , so either pair may be chosen, and the step takes .
Step 4 in symbols: the vocabulary size
If the initial vocabulary has symbols and the method performs merges, the final symbol vocabulary has
symbols. The paper states this relation directly: the final symbol vocabulary size is the initial vocabulary plus the number of merge operations, and the number of merges is the only hyperparameter. A larger gives longer pieces and a shorter text, and a smaller gives shorter pieces and a longer text.
Step 5 in symbols: segmentation
Given the ordered merge list , a new word is segmented by starting from its characters and applying , then , and so on, each time to every place where the pair occurs. The output has no unknown symbols, provided every character of the word is in the character vocabulary. In the toy trace, applying and then to lower gives .
Step 6 in symbols: the translator
The translator is an encoder-decoder with attention, operating on the sequence of pieces. The paper says its approach is not specific to this architecture, and it trains the model with stochastic gradient descent on the piece sequences. At test time it searches for output with beam search.
Results
The paper evaluates on the WMT 2015 shared translation task. English to German uses 4.2 million sentence pairs, about 100 million tokens. English to Russian uses 2.6 million sentence pairs, about 50 million tokens. Scores are BLEU, the standard translation metric (see BLEU Score), and chrF3, a character n-gram score. Test sets are newstest2015. The paper also reports unigram F1 separately for rare words (not among the top 50,000 training words) and for out-of-vocabulary words (not in the training text).
English to German, Table 2 of the paper (single model, then ensemble of 8):
- Back-off dictionary baseline WDict: BLEU 22.0 single, 24.2 ensemble.
- BPE with 60,000 symbols on each side (BPE-60k): BLEU 21.5 single, 24.5 ensemble.
- Joint BPE with 90,000 symbols (BPE-J90k): BLEU 22.8 single, 24.7 ensemble.
- Character bigram model with a 50,000-word shortlist (C2-50k): BLEU 22.8 single, 25.3 ensemble, the best BLEU in the table.
- Unigram F1 on rare words, ensemble: 36.8 for WDict, 41.8 for BPE-J90k.
- Unigram F1 on out-of-vocabulary words, ensemble: 36.8 for WDict, 33.6 for BPE-J90k.
English to Russian, Table 3 (single, then ensemble of 8): WDict BLEU 19.1 single and 22.8 ensemble. BPE-J90k reaches 20.4 single and 24.1 ensemble. Unigram F1 on rare words rises from 26.5 for WDict to 29.7 for BPE-J90k.
The abstract summarises the gains as 1.1 BLEU on English to German and 1.3 BLEU on English to Russian over the back-off baseline. The English to German gain of 1.1 corresponds to the character-bigram system, C2-50k, at ensemble level (25.3 against 24.2). The English to Russian gain of 1.3 corresponds to BPE-J90k.
Limits the paper states itself. The rare and unseen words that the subword models help most make up only 9 to 11 percent of the test sets, so BLEU underestimates their effect on meaning. The gains are not uniform: for English to German out-of-vocabulary words, the copying baseline is stronger, because many such words are names that are copied across. The paper notes differences of up to 1 BLEU between models on its development set, so gaps of a few tenths of a BLEU point should be read with care.
Reading guide
The paper's sections, in order, and what each one needs. Unigram F1 is the harmonic mean of precision and recall over single words.
- Introduction (section 1). Needs Encoder-Decoder Architecture and the idea of a fixed vocabulary. It states the open-vocabulary problem and the claims.
- Related work and the back-off approach (section 3.1). Needs the idea of a fixed vocabulary from the introduction. It describes the dictionary back-off that the paper's baseline uses.
- Byte pair encoding (section 3.2). Needs Subword Tokenization and the merge idea in this lesson. It gives the algorithm, which is the paper's core.
- Experimental setup (section 4). Needs BLEU Score and Attention Mechanism. The model is an attention encoder-decoder.
- Results (section 4.2). Needs the metrics above and the tables. Read the rare-word F1 and the out-of-vocabulary rows together with the BLEU rows.
- Analysis and conclusion (sections 5 and 6). Needs the rare-word F1 measure and the limits listed under Results.