# Enriching Word Vectors with Subword Information

Word vectors built from character n-grams handle rare and morphologically rich words

Piotr Bojanowski, Edouard Grave, Armand Joulin, Tomas Mikolov · arXiv · 2016-7-15

- **Problem** Word embedding models give each word its own vector and ignore word structure. This leaves rare words and words in morphologically rich languages with poor or missing vectors.
- **Method** Subword skipgram builds each word vector as the sum of vectors for its character n-grams. Instead of one vector per word, each word also keeps its whole-word vector, so rare words borrow from shared pieces.
- **Results** On German GUR350, the model scored 70, compared to 62 for cbow. It reached state-of-the-art results across nine languages on word similarity and analogy tasks.

## Why whole-word vectors stall

Most embedding methods give each word of the vocabulary its own vector and ignore the internal structure of words. That gap matters most in morphologically rich languages such as Turkish or Finnish, where one lemma can take many surface forms. For example, most French or Spanish verbs have more than forty inflected forms, and Finnish nouns have fifteen cases.

Many word formations follow rules, so the characters inside a word carry information that a whole-word vector ignores. The authors therefore ask whether character-level information can improve vectors for these languages.

## Key idea: words as sums of character n-grams

The core idea is to keep the skipgram training but to represent each word as the sum of vectors for its character n-grams. The model also adds the whole word to its set of n-grams, so each word keeps a vector of its own in addition to the pieces. Sharing the pieces lets a rare word borrow strength from other words that contain the same substrings.

Boundary symbols \< and \> mark the start and end of a word, so a prefix or suffix differs from the same letters inside a word. For example, the word where with n equal to 3 gives the n-grams \<wh, whe, her, ere and re, plus the special sequence \<where\>. The n-gram her from where is therefore not the same object as the word her, which has its own boundary-marked form.

In practice the model extracts all n-grams with n from 3 to 6.

To keep memory bounded, each character sequence is hashed with the FNV-1a function into one of K buckets, with K set to 2.106 in the paper. A word is then stored as its dictionary index together with the set of hashed n-grams it contains.

## Scoring and loss

The skipgram objective maximizes the log-probability of each context word given the target word, summed over all positions and their context windows. A softmax would predict one context word per target, which doesn't fit the setting where many context words are present. Instead, the authors frame each context word as an independent binary decision, with context words as positives and random dictionary words as negatives.

With the logistic loss written as \\( \\ell(x) = \\log(1 + e^{-x}) \\), each observed pair contributes \\( \\ell(s(w\_t, w\_c)) \\) and each sampled negative contributes \\( \\ell(-s(w\_t, n)) \\). In the baseline, the score is the scalar product \\( s(w\_t, w\_c) = u\_{w\_t}^\\top v\_{w\_c} \\) between an input vector and an output vector. The subword model changes only the score, which becomes \\( s(w, c) = \\sum\_{g \\in G\_w} z\_g^\\top v\_c \\), summing the n-gram vectors \\( z\_g \\) of word \\( w \\) and dotting them with the context vector \\( v\_c \\).

Training runs stochastic gradient descent on this negative log-likelihood, with a step size that decays linearly over the total number of words processed. Threads share parameters and update them asynchronously in the Hogwild style, so the optimization runs in parallel.

## Settings and training speed

Both the proposed model and the baselines use 300-dimensional word vectors, with 5 negatives drawn for each positive example. Negatives are sampled with probability proportional to the square root of the unigram frequency, and the context window size is drawn uniformly from 1 to 5. The step size starts at 0.025 for the skipgram baseline and at 0.05 for both the subword model and the cbow baseline.

On English data, the subword model is about 1.5 times slower to train than the skipgram baseline. It processes 105k words per second per thread, while the baseline processes 145k. The authors trained the models on Wikipedia dumps in nine languages, normalized and shuffled, with five passes over the data.

## Word similarity results

Similarity is measured as Spearman rank correlation between human judgements and cosine similarity of the vectors. The evaluation uses WS353, RW and the German sets GUR65, GUR350 and ZG222, among others, across nine languages. On German GUR350, sisg scored 70, compared to 62 for cbow. On the English RW set, sisg scored 47, compared to 43 for cbow, which fits the authors' view that rare words benefit most.

The subword model is higher than cbow on every listed dataset except English WS353. On that dataset sisg scored 71, compared to 73 for cbow. The authors attribute this to WS353 containing common words that get good vectors without subword information.

For out-of-vocabulary words, summing n-gram vectors (sisg) scored at least as high as using null vectors (sisg-) on every dataset. On GUR350, sisg scored 70 compared to 64 for sisg-. The authors link the gain on German and Russian to noun compounding and case declensions, as in Tischtennis, which shares character pieces with Tennis.

## Analogy results

The analogy tests use English, Czech, German and Italian datasets, and questions with words missing from the corpus were excluded. The metric is accuracy, reported separately for semantic and syntactic questions.

On Czech syntactic questions, sisg reached 77.8, compared to 55.0 for cbow and 52.8 for sg. The gain on syntax is large, which fits the idea that suffixes capture inflection. On German semantic questions, sisg scored 62.3, below 66.8 for cbow.

So the subword model helps syntactic analogies but doesn't help semantic ones. The authors tie the semantic drop to the chosen n-gram length, and they note that with a better length the semantic degradation shrinks.

## Comparison with morphology-based methods

Each comparison retrains the subword model on the same data as the compared method, such as English Wikipedia or Europarl and news commentary.

On German GUR350, sisg reached 73, compared to 64 for Soricut and Och (2015). On English RW, sisg scored 48, compared to 42 for the same method. Against Botha and Blunsom (2014), sisg scored 66 on GUR350 compared to 56 for that model.

The authors read the large German gain as a sign that the Soricut and Och approach doesn't model noun compounding, which the n-gram sum does. These are the same kind of word similarity scores, so the comparison is a controlled one only within each training set.

## Training data size

The authors train on the first 1, 2, 5, 10, 20 and 50 percent of the Wikipedia data, without reshuffling, so each subset is contained in the next. As the corpus shrinks, the out-of-vocabulary rate rises, which hurts sisg- and cbow.

With 5% of the data, sisg reached 66 on German GUR350, above the 62 that cbow reached on the full dataset. On English RW, 1% of the data gave sisg 45, which beats cbow on the full data at 43. The authors conclude that useful vectors can come from restricted, task-relevant corpora.

The subword model saturates quickly, and adding more data doesn't always improve its results. The cbow baseline keeps improving as more data is added, so the gap narrows with a large corpus.

## Choosing the n-gram range

The range 3 to 6 was chosen arbitrarily, because it covers short suffixes such as conjugations and declensions as well as longer roots. The authors vary the range for English and German on similarity and analogy datasets.

On German GUR350, the 3 to 6 range gives 70, while a 2 to 2 range gives 57. Ranges that include longer n-grams work best, which the authors connect to German compound nouns. Because 2-grams can't represent a suffix on their own, the boundary symbols leave them too short for conjugations.

The best range depends on the task and language, and no validation procedure selects it automatically. So 3 to 6 is a reasonable default, not a tuned one.

## Language modeling results

The experiment covers five languages with about one million training tokens each, following Botha and Blunsom (2014).

On Czech, the test perplexity is 312 with sisg vectors, compared to 339 with sg vectors. On Russian it is 206 with sisg, compared to 237 with sg. The reduction is 8% for Czech and 13% for Russian, while Spanish and French improve by only 3% and 2%.

The authors attribute the larger gains to the richer morphology of Slavic languages. Initializing from pre-trained vectors helps even without subwords, since the plain LSTM scored 366 on Czech.

## What the n-grams capture

To test this, the authors remove one n-gram at a time from the word sum and rank the n-grams by how much the cosine with the full vector drops. A large change means the n-gram matters most for that word.

For German compounds, the top n-grams of Autofahrer are Auto and Fahrer, which are its morphemes. In English, lifetime and starfish split into their parts, while kindness and unlucky surface affixes. In French, endings such as ais\>, ent\> and ions\> stand out as verb inflections.

For out-of-vocabulary words, the n-grams of microcircuit that match chip roughly correspond to micro and circuit. Similarly, the suffix -ness matches -ity well when comparing scarceness with rarity.

## Limitations

Character n-grams don't help semantic analogy accuracy, and at the chosen lengths they degrade it for German and Italian. The authors say the semantic result depends on the n-gram length they picked.

The n-gram range was not tuned, because no validation procedure was implemented. Results on WS353 show that common words don't need the subword pieces.

The data-size curve saturates, so more Wikipedia text doesn't always help the subword model.

## Paper info

- **Authors**: Piotr Bojanowski, Edouard Grave, Armand Joulin, Tomas Mikolov
- **Venue**: arXiv · Preprint
- **First published**: 2016-7-15
- **Added**: 2026-11-11
- **Updated**: 2017-6-19
- **Version**: v2
- **arXiv**: 1607.04606
- **Category**: cs.CL · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1607.04606v2) · [PDF ↗](https://arxiv.org/pdf/1607.04606v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Piotr Bojanowski, Edouard Grave, Armand Joulin, Tomas Mikolov (2016). Enriching Word Vectors with Subword Information. arXiv:1607.04606v2. https://arxiv.org/abs/1607.04606v2

**BibTeX**

```
@misc{bojanowski2016enriching,
  title = {{Enriching Word Vectors with Subword Information}},
  author = {Piotr Bojanowski and Edouard Grave and Armand Joulin and Tomas Mikolov},
  year = {2016},
  eprint = {1607.04606},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1607.04606v2}
}
```

## Related papers

- [HOGWILD!: A Lock-Free Approach to Parallelizing Stochastic Gradient Descent](https://refivu.com/en/papers/4f25abad-2562-433a-bc64-107b6d812ffb-hogwild-a-lock-free-approach-to-parallelizing-stochastic.md)
- [A Comprehensive Survey on Transfer Learning](https://refivu.com/en/papers/c3ef16ed-6b27-4ef6-a0f1-b20616ba3e47-a-comprehensive-survey-on-transfer-learning.md)
- [Neural Machine Translation of Rare Words with Subword Units](https://refivu.com/en/papers/0950e659-f6cc-4852-b244-bbb2742bf059-neural-machine-translation-of-rare-words-with-subword.md)
- [Recent Trends in Deep Learning Based Natural Language Processing](https://refivu.com/en/papers/6cdbf953-5aaa-4de2-9e22-528902a11655-recent-trends-in-deep-learning-based-natural-language.md)
- [Pointer Sentinel Mixture Models](https://refivu.com/en/papers/8f7d0844-f517-4c18-ba24-8cd7dc616a74-pointer-sentinel-mixture-models.md)
- [Recurrent Neural Network Regularization](https://refivu.com/en/papers/317651d8-c32f-47cc-ad63-48860741508c-recurrent-neural-network-regularization.md)

## Other paper commentary

- [Training Verifiers to Solve Math Word Problems](https://refivu.com/en/papers/6eaa7788-f79e-40b8-87b7-3ca3217edfe9-training-verifiers-to-solve-math-word-problems.md)
- [Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation](https://refivu.com/en/papers/a52e355d-5c49-4353-8d39-5013e656760c-learning-phrase-representations-using-rnn-encoder-decoder.md)
- [Effective Approaches to Attention-based Neural Machine Translation](https://refivu.com/en/papers/58ab56a7-1cd5-4c5e-be62-69ff9c1387c7-effective-approaches-to-attention-based-neural-machine.md)
- [Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions](https://refivu.com/en/papers/596b5353-6c04-4ada-a92e-25d0fee13147-natural-tts-synthesis-by-conditioning-wavenet-on-mel.md)
- [Universal Language Model Fine-tuning for Text Classification](https://refivu.com/en/papers/f2470a4a-1c9b-423c-8757-ba73cfe37b54-universal-language-model-fine-tuning-for-text-classification.md)
- [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://refivu.com/en/papers/13b055d5-7dcd-422f-b6d8-3704e3d48533-bart-denoising-sequence-to-sequence-pre-training-for.md)
- [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://refivu.com/en/papers/1de65a84-2d26-40df-8104-656807b7a166-deepseekmath-pushing-the-limits-of-mathematical-reasoning-in.md)
- [UNet++: A Nested U-Net Architecture for Medical Image Segmentation](https://refivu.com/en/papers/156db9ed-e303-494d-af9e-c37b8715a287-unet-a-nested-u-net-architecture-for-medical.md)
- [Identity Mappings in Deep Residual Networks](https://refivu.com/en/papers/4dcb24a4-8fe8-4b2a-b957-a69e3f0212b0-identity-mappings-in-deep-residual-networks.md)
- [Perceptual Losses for Real-Time Style Transfer and Super-Resolution](https://refivu.com/en/papers/780825d2-51b4-4426-9340-0f1859a637a2-perceptual-losses-for-real-time-style-transfer-and.md)
- [Learning Deep Features for Discriminative Localization](https://refivu.com/en/papers/6bdcd2a6-8c81-46b4-95d2-9560f97fd427-learning-deep-features-for-discriminative-localization.md)
- [node2vec: Scalable Feature Learning for Networks](https://refivu.com/en/papers/dc0725e4-ec21-4d60-9363-0eac2fc69a10-node2vec-scalable-feature-learning-for-networks.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [perplexity](https://refivu.com/en/terms/2b204e513801-perplexity)
- [language modeling](https://refivu.com/en/terms/8f3aaf7f8ef0-language-modeling)
- [Negative sampling](https://refivu.com/en/terms/1dbdea971d8c-negative-sampling)
- [Wikipedia](https://refivu.com/en/terms/2569175e3d90-wikipedia)
- [CBOW](https://refivu.com/en/terms/be0f50b387e8-cbow)
- [character n-grams](https://refivu.com/en/terms/9a07e0fb422e-character-n-grams)
- [out-of-vocabulary words](https://refivu.com/en/terms/9ab7496b6d55-out-of-vocabulary-words)
- [Spearman](https://refivu.com/en/terms/0f303c8a187a-spearman)
- [word similarity](https://refivu.com/en/terms/055b2da54441-word-similarity)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/c9e8d8e6-e24f-4128-8771-cadeb8b6c17e-enriching-word-vectors-with-subword-information)
