Enriching Word Vectors with Subword Information

by   Piotr Bojanowski, et al.

Continuous word representations, trained on large unlabeled corpora are useful for many natural language processing tasks. Popular models that learn such representations ignore the morphology of words, by assigning a distinct vector to each word. This is a limitation, especially for languages with large vocabularies and many rare words. In this paper, we propose a new approach based on the skipgram model, where each word is represented as a bag of character n-grams. A vector representation is associated to each character n-gram; words being represented as the sum of these representations. Our method is fast, allowing to train models on large corpora quickly and allows us to compute word representations for words that did not appear in the training data. We evaluate our word representations on nine different languages, both on word similarity and analogy tasks. By comparing to recently proposed morphological word representations, we show that our vectors achieve state-of-the-art performance on these tasks.


page 1

page 2

page 3

page 4


Morphological Skip-Gram: Using morphological knowledge to improve word representation

Natural language processing models have attracted much interest in the d...

Learning Word Vectors for 157 Languages

Distributed word representations, or word vectors, have recently been ap...

Probabilistic Modelling of Morphologically Rich Languages

This thesis investigates how the sub-structure of words can be accounted...

Personalized word representations Carrying Personalized Semantics Learned from Social Network Posts

Distributed word representations have been shown to be very useful in va...

A Systematic Study of Leveraging Subword Information for Learning Word Representations

The use of subword-level information (e.g., characters, character n-gram...

Building a language evolution tree based on word vector combination model

In this paper, we try to explore the evolution of language through case ...

WordNet2Vec: Corpora Agnostic Word Vectorization Method

A complex nature of big data resources demands new methods for structuri...

Code Repositories


Library for fast text representation and classification.

view repo


A Python interface for Facebook fastText

view repo


Java interface for fastText

view repo

1 Introduction

Learning continuous representations of words has a long history in natural language processing [Rumelhart et al.1988]. These representations are typically derived from large unlabeled corpora using co-occurrence statistics [Deerwester et al.1990, Schütze1992, Lund and Burgess1996]. A large body of work, known as distributional semantics, has studied the properties of these methods [Turney et al.2010, Baroni and Lenci2010]

. In the neural network community, collobert2008unified proposed to learn word embeddings using a feedforward neural network, by predicting a word based on the two words on the left and two words on the right. More recently, mikolov2013distributed proposed simple log-bilinear models to learn continuous representations of words on very large corpora efficiently.

Most of these techniques represent each word of the vocabulary by a distinct vector, without parameter sharing. In particular, they ignore the internal structure of words, which is an important limitation for morphologically rich languages, such as Turkish or Finnish. For example, in French or Spanish, most verbs have more than forty different inflected forms, while the Finnish language has fifteen cases for nouns. These languages contain many word forms that occur rarely (or not at all) in the training corpus, making it difficult to learn good word representations. Because many word formations follow rules, it is possible to improve vector representations for morphologically rich languages by using character level information.

In this paper, we propose to learn representations for character -grams, and to represent words as the sum of the -gram vectors. Our main contribution is to introduce an extension of the continuous skipgram model [Mikolov et al.2013b], which takes into account subword information. We evaluate this model on nine languages exhibiting different morphologies, showing the benefit of our approach.

2 Related work

Morphological word representations.

In recent years, many methods have been proposed to incorporate morphological information into word representations. To model rare words better, alexandrescu2006factored introduced factored neural language models, where words are represented as sets of features. These features might include morphological information, and this technique was succesfully applied to morphologically rich languages, such as Turkish [Sak et al.2010]. Recently, several works have proposed different composition functions to derive representations of words from morphemes [Lazaridou et al.2013, Luong et al.2013, Botha and Blunsom2014, Qiu et al.2014]

. These different approaches rely on a morphological decomposition of words, while ours does not. Similarly, chen2015joint introduced a method to jointly learn embeddings for Chinese words and characters. cui2015knet proposed to constrain morphologically similar words to have similar representations. soricut2015unsupervised described a method to learn vector representations of morphological transformations, allowing to obtain representations for unseen words by applying these rules. Word representations trained on morphologically annotated data were introduced by cotterell2015morphological. Closest to our approach, schutze1993word learned representations of character four-grams through singular value decomposition, and derived representations for words by summing the four-grams representations. Very recently, wieting2016charagram also proposed to represent words using character

-gram count vectors. However, the objective function used to learn these representations is based on paraphrase pairs, while our model can be trained on any text corpus.

Character level features for NLP.

Another area of research closely related to our work are character-level models for natural language processing. These models discard the segmentation into words and aim at learning language representations directly from characters. A first class of such models are recurrent neural networks, applied to language modeling 

[Mikolov et al.2012, Sutskever et al.2011, Graves2013, Bojanowski et al.2015], text normalization [Chrupała2014], part-of-speech tagging [Ling et al.2015] and parsing [Ballesteros et al.2015]

. Another family of models are convolutional neural networks trained on characters, which were applied to part-of-speech tagging 

[dos Santos and Zadrozny2014]

, sentiment analysis 

[dos Santos and Gatti2014], text classification [Zhang et al.2015] and language modeling [Kim et al.2016]

. sperr2013letter introduced a language model based on restricted Boltzmann machines, in which words are encoded as a set of character

-grams. Finally, recent works in machine translation have proposed using subword units to obtain representations of rare words [Sennrich et al.2016, Luong and Manning2016].

3 Model

In this section, we propose our model to learn word representations while taking into account morphology. We model morphology by considering subword units, and representing words by a sum of its character -grams. We will begin by presenting the general framework that we use to train word vectors, then present our subword model and eventually describe how we handle the dictionary of character -grams.

3.1 General model

We start by briefly reviewing the continuous skipgram model introduced by mikolov2013distributed, from which our model is derived. Given a word vocabulary of size , where a word is identified by its index , the goal is to learn a vectorial representation for each word . Inspired by the distributional hypothesis [Harris1954], word representations are trained to predict well words that appear in its context. More formally, given a large training corpus represented as a sequence of words , the objective of the skipgram model is to maximize the following log-likelihood:

where the context is the set of indices of words surrounding word

. The probability of observing a context word

given will be parameterized using the aforementioned word vectors. For now, let us consider that we are given a scoring function  which maps pairs of (word, context) to scores in . One possible choice to define the probability of a context word is the softmax:

However, such a model is not adapted to our case as it implies that, given a word , we only predict one context word .

The problem of predicting context words can instead be framed as a set of independent binary classification tasks. Then the goal is to independently predict the presence (or absence) of context words. For the word at position we consider all context words as positive examples and sample negatives at random from the dictionary. For a chosen context position , using the binary logistic loss, we obtain the following negative log-likelihood:


is a set of negative examples sampled from the vocabulary. By denoting the logistic loss function

, we can re-write the objective as:

A natural parameterization for the scoring function between a word and a context word is to use word vectors. Let us define for each word in the vocabulary two vectors and in . These two vectors are sometimes referred to as input and output vectors in the literature. In particular, we have vectors and , corresponding, respectively, to words and . Then the score can be computed as the scalar product between word and context vectors as . The model described in this section is the skipgram model with negative sampling, introduced by mikolov2013distributed.

3.2 Subword model

By using a distinct vector representation for each word, the skipgram model ignores the internal structure of words. In this section, we propose a different scoring function , in order to take into account this information.

Each word is represented as a bag of character -gram. We add special boundary symbols < and > at the beginning and end of words, allowing to distinguish prefixes and suffixes from other character sequences. We also include the word itself in the set of its -grams, to learn a representation for each word (in addition to character -grams). Taking the word where and as an example, it will be represented by the character -grams:

<wh, whe, her, ere, re>

and the special sequence


Note that the sequence <her>, corresponding to the word her is different from the tri-gram her from the word where. In practice, we extract all the -grams for greater or equal to 3 and smaller or equal to . This is a very simple approach, and different sets of -grams could be considered, for example taking all prefixes and suffixes.

Suppose that you are given a dictionary of -grams of size . Given a word , let us denote by the set of -grams appearing in . We associate a vector representation to each -gram . We represent a word by the sum of the vector representations of its -grams. We thus obtain the scoring function:

This simple model allows sharing the representations across words, thus allowing to learn reliable representation for rare words.

In order to bound the memory requirements of our model, we use a hashing function that maps -grams to integers in 1 to . We hash character sequences using the Fowler-Noll-Vo hashing function (specifically the FNV-1a variant).111http://www.isthe.com/chongo/tech/comp/fnv We set below. Ultimately, a word is represented by its index in the word dictionary and the set of hashed -grams it contains.

4 Experimental setup

4.1 Baseline

In most experiments (except in Sec. 5.3), we compare our model to the C implementation of the skipgram and cbow models from the word2vec222https://code.google.com/archive/p/word2vec package.

4.2 Optimization

We solve our optimization problem by performing stochastic gradient descent on the negative log likelihood presented before. As in the baseline

skipgram model, we use a linear decay of the step size. Given a training set containing words and a number of passes over the data equal to , the step size at time is equal to , where is a fixed parameter. We carry out the optimization in parallel, by resorting to Hogwild [Recht et al.2011]. All threads share parameters and update vectors in an asynchronous manner.

4.3 Implementation details

For both our model and the baseline experiments, we use the following parameters: the word vectors have dimension . For each positive example, we sample negatives at random, with probability proportional to the square root of the uni-gram frequency. We use a context window of size , and uniformly sample the size between and . In order to subsample the most frequent words, we use a rejection threshold of (for more details, see [Mikolov et al.2013b]). When building the word dictionary, we keep the words that appear at least times in the training set. The step size is set to for the skipgram baseline and to for both our model and the cbow baseline. These are the default values in the word2vec package and work well for our model too.

Using this setting on English data, our model with character -grams is approximately slower to train than the skipgram baseline. Indeed, we process k words/second/thread versus k words/second/thread for the baseline. Our model is implemented in C++, and is publicly available.333https://github.com/facebookresearch/fastText

4.4 Datasets

Except for the comparison to previous work (Sec. 5.3), we train our models on Wikipedia data.444https://dumps.wikimedia.org We downloaded Wikipedia dumps in nine languages: Arabic, Czech, German, English, Spanish, French, Italian, Romanian and Russian. We normalize the raw Wikipedia data using Matt Mahoney’s pre-processing perl script.555http://mattmahoney.net/dc/textdata All the datasets are shuffled, and we train our models by doing five passes over them.

5 Results

We evaluate our model in five experiments: an evaluation of word similarity and word analogies, a comparison to state-of-the-art methods, an analysis of the effect of the size of training data and of the size of character -grams that we consider. We will describe these experiments in detail in the following sections.

5.1 Human similarity judgement

We first evaluate the quality of our representations on the task of word similarity / relatedness. We do so by computing Spearman’s rank correlation coefficient [Spearman1904]

between human judgement and the cosine similarity between the vector representations. For German, we compare the different models on three datasets:

Gur65, Gur350 and ZG222 [Gurevych2005, Zesch and Gurevych2006]. For English, we use the WS353 dataset introduced by finkelstein2001placing and the rare word dataset (RW), introduced by luong2013better. We evaluate the French word vectors on the translated dataset RG65 [Joubarne and Inkpen2011]. Spanish, Arabic and Romanian word vectors are evaluated using the datasets described in [Hassan and Mihalcea2009]. Russian word vectors are evaluated using the HJ dataset introduced by panchenko2016human.

sg cbow sisg- sisg
Ar WS353 51 52 54 55
De Gur350 61 62 64 70
Gur65 78 78 81 81
ZG222 35 38 41 44
En RW 43 43 46 47
WS353 72 73 71 71
Es WS353 57 58 58 59
Fr RG65 70 69 75 75
Ro WS353 48 52 51 54
Ru HJ 59 60 60 66
Table 1: Correlation between human judgement and similarity scores on word similarity datasets. We train both our model and the word2vec baseline on normalized Wikipedia dumps. Evaluation datasets contain words that are not part of the training set, so we represent them using null vectors (sisg-). With our model, we also compute vectors for unseen words by summing the -gram vectors (sisg).

We report results for our method and baselines for all datasets in Table 1. Some words from these datasets do not appear in our training data, and thus, we cannot obtain word representation for these words using the cbow and skipgram baselines. In order to provide comparable results, we propose by default to use null vectors for these words. Since our model exploits subword information, we can also compute valid representations for out-of-vocabulary words. We do so by taking the sum of its -gram vectors. When OOV words are represented using null vectors we refer to our method as sisg- and sisg otherwise (Subword Information Skip Gram).

First, by looking at Table 1, we notice that the proposed model (sisg), which uses subword information, outperforms the baselines on all datasets except the English WS353 dataset. Moreover, computing vectors for out-of-vocabulary words (sisg) is always at least as good as not doing so (sisg-). This proves the advantage of using subword information in the form of character -grams.

Second, we observe that the effect of using character -grams is more important for Arabic, German and Russian than for English, French or Spanish. German and Russian exhibit grammatical declensions with four cases for German and six for Russian. Also, many German words are compound words; for instance the nominal phrase “table tennis” is written in a single word as “Tischtennis”. By exploiting the character-level similarities between “Tischtennis” and “Tennis”, our model does not represent the two words as completely different words.

Finally, we observe that on the English Rare Words dataset (RW), our approach outperforms the baselines while it does not on the English WS353 dataset. This is due to the fact that words in the English WS353 dataset are common words for which good vectors can be obtained without exploiting subword information. When evaluating on less frequent words, we see that using similarities at the character level between words can help learning good word vectors.

5.2 Word analogy tasks

sg cbow sisg
Cs Semantic 25.7 27.6 27.5
Syntactic 52.8 55.0 77.8
De Semantic 66.5 66.8 62.3
Syntactic 44.5 45.0 56.4
En Semantic 78.5 78.2 77.8
Syntactic 70.1 69.9 74.9
It Semantic 52.3 54.7 52.3
Syntactic 51.5 51.8 62.7
Table 2: Accuracy of our model and baselines on word analogy tasks for Czech, German, English and Italian. We report results for semantic and syntactic analogies separately.

We now evaluate our approach on word analogy questions, of the form is to as is to , where must be predicted by the models. We use the datasets introduced by mikolov2013efficient for English, by svoboda2016new for Czech, by koper2015multilingual for German and by berardi2015word for Italian. Some questions contain words that do not appear in our training corpus, and we thus excluded these questions from the evaluation.

De En Es Fr
Gur350 ZG222 WS353 RW WS353 RG65
luong2013better - - 64 34 - -
qiu2014colearning - - 65 33 - -
soricut2015unsupervised 64 22 71 42 47 67
sisg 73 43 73 48 54 69
botha2014compositional 56 25 39 30 28 45
sisg 66 34 54 41 49 52
Table 3: Spearman’s rank correlation coefficient between human judgement and model scores for different methods using morphology to learn word representations. We keep all the word pairs of the evaluation set and obtain representations for out-of-vocabulary words with our model by summing the vectors of character -grams. Our model was trained on the same datasets as the methods we are comparing to (hence the two lines of results for our approach).

We report accuracy for the different models in Table 2. We observe that morphological information significantly improves the syntactic tasks; our approach outperforms the baselines. In contrast, it does not help for semantic questions, and even degrades the performance for German and Italian. Note that this is tightly related to the choice of the length of character -grams that we consider. We show in Sec. 5.5 that when the size of the -grams is chosen optimally, the semantic analogies degrade less. Another interesting observation is that, as expected, the improvement over the baselines is more important for morphologically rich languages, such as Czech and German.

5.3 Comparison with morphological representations

We also compare our approach to previous work on word vectors incorporating subword information on word similarity tasks. The methods used are: the recursive neural network of luong2013better, the morpheme cbow of qiu2014colearning and the morphological transformations of soricut2015unsupervised. In order to make the results comparable, we trained our model on the same datasets as the methods we are comparing to: the English Wikipedia data released by shaoul2010westbury, and the news crawl data from the 2013 WMT shared task for German, Spanish and French. We also compare our approach to the log-bilinear language model introduced by botha2014compositional, which was trained on the Europarl and news commentary corpora. Again, we trained our model on the same data to make the results comparable. Using our model, we obtain representations of out-of-vocabulary words by summing the representations of character -grams. We report results in Table 3. We observe that our simple approach performs well relative to techniques based on subword information obtained from morphological segmentors. We also observe that our approach outperforms the soricut2015unsupervised method, which is based on prefix and suffix analysis. The large improvement for German is due to the fact that their approach does not model noun compounding, contrary to ours.

5.4 Effect of the size of the training data

Since we exploit character-level similarities between words, we are able to better model infrequent words. Therefore, we should also be more robust to the size of the training data that we use. In order to assess that, we propose to evaluate the performance of our word vectors on the similarity task as a function of the training data size. To this end, we train our model and the cbow baseline on portions of Wikipedia of increasing size. We use the Wikipedia corpus described above and isolate the first , , , , , and percent of the data. Since we don’t reshuffle the dataset, they are all subsets of each other. We report results in Fig. 1.

(a) De-Gur350
(b) En-RW
Figure 1: Influence of size of the training data on performance. We compute word vectors following the proposed model using datasets of increasing size. In this experiment, we train models on a fraction of the full Wikipedia dump.

As in the experiment presented in Sec. 5.1, not all words from the evaluation set are present in the Wikipedia data. Again, by default, we use a null vector for these words (sisg-) or compute a vector by summing the -gram representations (sisg). The out-of-vocabulary rate is growing as the dataset shrinks, and therefore the performance of sisg- and cbow necessarily degrades. However, the proposed model (sisg) assigns non-trivial vectors to previously unseen words.

First, we notice that for all datasets, and all sizes, the proposed approach (sisg) performs better than the baseline. However, the performance of the baseline cbow model gets better as more and more data is available. Our model, on the other hand, seems to quickly saturate and adding more data does not always lead to improved results.

Second, and most importantly, we notice that the proposed approach provides very good word vectors even when using very small training datasets. For instance, on the German Gur350 dataset, our model (sisg) trained on of the data achieves better performance () than the cbow baseline trained on the full dataset (). On the other hand, on the English RW dataset, using of the Wikipedia corpus we achieve a correlation coefficient of which is better than the performance of cbow trained on the full dataset (). This has a very important practical implication: well performing word vectors can be computed on datasets of a restricted size and still work well on previously unseen words. In general, when using vectorial word representations in specific applications, it is recommended to retrain the model on textual data relevant for the application. However, this kind of relevant task-specific data is often very scarce and learning from a reduced amount of training data is a great advantage.

5.5 Effect of the size of -grams

The proposed model relies on the use of character -grams to represent words as vectors. As mentioned in Sec. 3.2, we decided to use -grams ranging from to characters. This choice was arbitrary, motivated by the fact that -grams of these lengths will cover a wide range of information. They would include short suffixes (corresponding to conjugations and declensions for instance) as well as longer roots. In this experiment, we empirically check for the influence of the range of -grams that we use on performance. We report our results in Table 4 for English and German on word similarity and analogy datasets.

2 3 4 5 6
2 57 64 67 69 69
3 65 68 70 70
4 70 70 71
5 69 71
6 70
(a) De-Gur350
2 3 4 5 6
2 59 55 56 59 60
3 60 58 60 62
4 62 62 63
5 64 64
6 65
(b) De Semantic
2 3 4 5 6
2 45 50 53 54 55
3 51 55 55 56
4 54 56 56
5 56 56
6 54
(c) De Syntactic
2 3 4 5 6
2 41 42 46 47 48
3 44 46 48 48
4 47 48 48
5 48 48
6 48
(d) En-RW
2 3 4 5 6
2 78 76 75 76 76
3 78 77 78 77
4 79 79 79
5 80 79
6 80
(e) En Semantic
2 3 4 5 6
2 70 71 73 74 73
3 72 74 75 74
4 74 75 75
5 74 74
6 72
(f) En Syntactic
Table 4: Study of the effect of sizes of -grams considered on performance. We compute word vectors by using character -grams with in and report performance for various values of and . We evaluate this effect on German and English, and represent out-of-vocabulary words using subword information.

We observe that for both English and German, our arbitrary choice of - was a reasonable decision, as it provides satisfactory performance across languages. The optimal choice of length ranges depends on the considered task and language and should be tuned appropriately. However, due to the scarcity of test data, we did not implement any proper validation procedure to automatically select the best parameters. Nonetheless, taking a large range such as provides a reasonable amount of subword information.

This experiment also shows that it is important to include long -grams, as columns corresponding to and work best. This is especially true for German, as many nouns are compounds made up from several units that can only be captured by longer character sequences. On analogy tasks, we observe that using larger -grams helps for semantic analogies. However, results are always improved by taking rather than , which shows that character -grams are not informative for that task. As described in Sec. 3.2, before computing character -grams, we prepend and append special positional characters to represent the beginning and end of word. Therefore, -grams will not be enough to properly capture suffixes that correspond to conjugations or declensions, since they are composed of a single proper character and a positional one.

5.6 Language modeling

In this section, we describe an evaluation of the word vectors obtained with our method on a language modeling task. We evaluate our language model on five languages (Cs, De, Es, Fr, Ru) using the datasets introduced by botha2014compositional. Each dataset contains roughly one million training tokens, and we use the same preprocessing and data splits as botha2014compositional.

Our model is a recurrent neural network with LSTM units, regularized with dropout (with probability of ) and weight decay (regularization parameter of ). We learn the parameters using the Adagrad algorithm with a learning rate of , clipping the gradients which have a norm larger than . We initialize the weight of the network in the range , and use a batch size of . Two baselines are considered: we compare our approach to the log-bilinear language model of botha2014compositional and the character aware language model of kim2016character. We trained word vectors with character -grams on the training set of the language modeling task and use them to initialize the lookup table of our language model. We report the test perplexity of our model without using pre-trained word vectors (LSTM), with word vectors pre-trained without subword information (sg) and with our vectors (sisg). The results are presented in Table 5.

Cs De Es Fr Ru
Vocab. size 46k 37k 27k 25k 63k
CLBL 465 296 200 225 304
CANLM 371 239 165 184 261
LSTM 366 222 157 173 262
sg 339 216 150 162 237
sisg 312 206 145 159 206
Table 5: Test perplexity on the language modeling task, for 5 different languages. We compare to two state of the art approaches: CLBL refers to the work of botha2014compositional and CANLM refers to the work of kim2016character.
word -grams
autofahrer fahr fahrer auto
freundeskreis kreis kreis> <freun
De grundwort wort wort> grund
sprachschule schul hschul sprach
tageslicht licht gesl tages
anarchy chy <anar narchy
monarchy monarc chy <monar
kindness ness> ness kind
politeness polite ness> eness>
En unlucky <un cky> nlucky
lifetime life <life time
starfish fish fish> star
submarine marine sub marin
transform trans <trans form
finirais ais> nir fini
Fr finissent ent> finiss <finis
finissions ions> finiss sions>
Table 6: Illustration of most important character -grams for selected words in three languages. For each word, we show the -grams that, when removed, result in the most different representation.

We observe that initializing the lookup table of the language model with pre-trained word representations improves the test perplexity over the baseline LSTM. The most important observation is that using word representations trained with subword information outperforms the plain skipgram model. We observe that this improvement is most significant for morphologically rich Slavic languages such as Czech (8% reduction of perplexity over sg) and Russian (13% reduction). The improvement is less significant for Roman languages such as Spanish (3% reduction) or French (2% reduction). This shows the importance of subword information on the language modeling task and exhibits the usefulness of the vectors that we propose for morphologically rich languages.

6 Qualitative analysis

6.1 Nearest neighbors.

We report sample qualitative results in Table 7. For selected words, we show nearest neighbors according to cosine similarity for vectors trained using the proposed approach and for the skipgram baseline. As expected, the nearest neighbors for complex, technical and infrequent words using our approach are better than the ones obtained using the baseline model.

6.2 Character -grams and morphemes

We want to qualitatively evaluate whether or not the most important -grams in a word correspond to morphemes. To this end, we take a word vector that we construct as the sum of -grams. As described in Sec. 3.2, each word is represented as the sum of its -grams: . For each -gram , we propose to compute the restricted representation  obtained by omitting :

We then rank -grams by increasing value of cosine between and . We show ranked -grams for selected words in three languages in Table 6.

For German, which has a lot of compound nouns, we observe that the most important -grams correspond to valid morphemes. Good examples include Autofahrer (car driver) whose most important -grams are Auto (car) and Fahrer (driver). We also observe the separation of compound nouns into morphemes in English, with words such as lifetime or starfish. However, for English, we also observe that -grams can correspond to affixes in words such as kindness or unlucky. Interestingly, for French we observe the inflections of verbs with endings such as ais>, ent> or ions>.

6.3 Word similarity for OOV words

As described in Sec. 3.2, our model is capable of building word vectors for words that do not appear in the training set. For such words, we simply average the vector representation of its -grams. In order to assess the quality of these representations, we analyze which of the -grams match best for OOV words by selecting a few word pairs from the English RW similarity dataset. We select pairs such that one of the two words is not in the training vocabulary and is hence only represented by its -grams. For each pair of words, we display the cosine similarity between each pair of -grams that appear in the words. In order to simulate a setup with a larger number of OOV words, we use models trained on  of the Wikipedia data as in Sec. 5.4. The results are presented in Fig. 2.

We observe interesting patterns, showing that subwords match correctly. Indeed, for the word chip, we clearly see that there are two groups of -grams in microcircuit that match well. These roughly correspond to micro and circuit, and -grams in between don’t match well. Another interesting example is the pair rarity and scarceness. Indeed, scarce roughly matches rarity while the suffix -ness matches -ity very well. Finally, the word preadolescent matches young well thanks to the -adolesc- subword. This shows that we build robust word representations where prefixes and suffixes can be ignored if the grammatical form is not found in the dictionary.

query tiling tech-rich english-born micromanaging eateries dendritic
sisg tile tech-dominated british-born micromanage restaurants dendrite
flooring tech-heavy polish-born micromanaged eaterie dendrites
sg bookcases technology-heavy most-capped defang restaurants epithelial
built-ins .ixic ex-scotland internalise delis p53
Table 7: Nearest neighbors of rare words using our representations and skipgram. These hand picked examples are for illustration.
Figure 2: Illustration of the similarity between character -grams in out-of-vocabulary words. For each pair, only one word is OOV, and is shown on the axis. Red indicates positive cosine, while blue negative.

7 Conclusion

In this paper, we investigate a simple method to learn word representations by taking into account subword information. Our approach, which incorporates character -grams into the skipgram model, is related to an idea that was introduced by schutze1993word. Because of its simplicity, our model trains fast and does not require any preprocessing or supervision. We show that our model outperforms baselines that do not take into account subword information, as well as methods relying on morphological analysis. We will open source the implementation of our model, in order to facilitate comparison of future work on learning subword representations.


We thank Marco Baroni, Hinrich Schütze and the anonymous reviewers for their insightful comments.


  • [Alexandrescu and Kirchhoff2006] Andrei Alexandrescu and Katrin Kirchhoff. 2006. Factored neural language models. In Proc. NAACL.
  • [Ballesteros et al.2015] Miguel Ballesteros, Chris Dyer, and Noah A. Smith. 2015. Improved transition-based parsing by modeling characters instead of words with LSTMs. In Proc. EMNLP.
  • [Baroni and Lenci2010] Marco Baroni and Alessandro Lenci. 2010. Distributional memory: A general framework for corpus-based semantics. Computational Linguistics, 36(4):673–721.
  • [Berardi et al.2015] Giacomo Berardi, Andrea Esuli, and Diego Marcheggiani. 2015. Word embeddings go to Italy: a comparison of models and training datasets. Italian Information Retrieval Workshop.
  • [Bojanowski et al.2015] Piotr Bojanowski, Armand Joulin, and Tomáš Mikolov. 2015. Alternative structures for character-level RNNs. In Proc. ICLR.
  • [Botha and Blunsom2014] Jan A. Botha and Phil Blunsom. 2014. Compositional morphology for word representations and language modelling. In Proc. ICML.
  • [Chen et al.2015] Xinxiong Chen, Lei Xu, Zhiyuan Liu, Maosong Sun, and Huanbo Luan. 2015. Joint learning of character and word embeddings. In Proc. IJCAI.
  • [Chrupała2014] Grzegorz Chrupała. 2014. Normalizing tweets with edit scripts and recurrent neural embeddings. In Proc. ACL.
  • [Collobert and Weston2008] Ronan Collobert and Jason Weston. 2008. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proc. ICML.
  • [Cotterell and Schütze2015] Ryan Cotterell and Hinrich Schütze. 2015. Morphological word-embeddings. In Proc. NAACL.
  • [Cui et al.2015] Qing Cui, Bin Gao, Jiang Bian, Siyu Qiu, Hanjun Dai, and Tie-Yan Liu. 2015. KNET: A general framework for learning word embedding using morphological knowledge. ACM Transactions on Information Systems, 34(1):4:1–4:25.
  • [Deerwester et al.1990] Scott Deerwester, Susan T. Dumais, George W. Furnas, Thomas K. Landauer, and Richard Harshman. 1990. Indexing by latent semantic analysis. Journal of the American Society for Information Science, 41(6):391–407.
  • [dos Santos and Gatti2014] Cicero Nogueira dos Santos and Maira Gatti. 2014. Deep convolutional neural networks for sentiment analysis of short texts. In Proc. COLING.
  • [dos Santos and Zadrozny2014] Cicero Nogueira dos Santos and Bianca Zadrozny. 2014. Learning character-level representations for part-of-speech tagging. In Proc. ICML.
  • [Finkelstein et al.2001] Lev Finkelstein, Evgeniy Gabrilovich, Yossi Matias, Ehud Rivlin, Zach Solan, Gadi Wolfman, and Eytan Ruppin. 2001. Placing search in context: The concept revisited. In Proc. WWW.
  • [Graves2013] Alex Graves. 2013. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850.
  • [Gurevych2005] Iryna Gurevych. 2005. Using the structure of a conceptual network in computing semantic relatedness. In Proc. IJCNLP.
  • [Harris1954] Zellig S Harris. 1954. Distributional structure. Word, 10(2-3):146–162.
  • [Hassan and Mihalcea2009] Samer Hassan and Rada Mihalcea. 2009. Cross-lingual semantic relatedness using encyclopedic knowledge. In Proc. EMNLP.
  • [Joubarne and Inkpen2011] Colette Joubarne and Diana Inkpen. 2011. Comparison of semantic similarity for different languages using the google n-gram corpus and second-order co-occurrence measures. In

    Proc. Canadian Conference on Artificial Intelligence

  • [Kim et al.2016] Yoon Kim, Yacine Jernite, David Sontag, and Alexander M Rush. 2016. Character-aware neural language models. In Proc. AAAI.
  • [Köper et al.2015] Maximilian Köper, Christian Scheible, and Sabine Schulte im Walde. 2015. Multilingual reliability and “semantic” structure of continuous word spaces. Proc. IWCS 2015.
  • [Lazaridou et al.2013] Angeliki Lazaridou, Marco Marelli, Roberto Zamparelli, and Marco Baroni. 2013. Compositionally derived representations of morphologically complex words in distributional semantics. In Proc. ACL.
  • [Ling et al.2015] Wang Ling, Chris Dyer, Alan W. Black, Isabel Trancoso, Ramon Fermandez, Silvio Amir, Luis Marujo, and Tiago Luis. 2015. Finding function in form: Compositional character models for open vocabulary word representation. In Proc. EMNLP.
  • [Lund and Burgess1996] Kevin Lund and Curt Burgess. 1996. Producing high-dimensional semantic spaces from lexical co-occurrence. Behavior Research Methods, Instruments, & Computers, 28(2):203–208.
  • [Luong and Manning2016] Minh-Thang Luong and Christopher D. Manning. 2016.

    Achieving open vocabulary neural machine translation with hybrid word-character models.

    In Proc. ACL.
  • [Luong et al.2013] Thang Luong, Richard Socher, and Christopher D. Manning. 2013. Better word representations with recursive neural networks for morphology. In Proc. CoNLL.
  • [Mikolov et al.2012] Tomáš Mikolov, Ilya Sutskever, Anoop Deoras, Hai-Son Le, Stefan Kombrink, and Jan Černocký. 2012. Subword language modeling with neural networks. Technical report, Faculty of Information Technology, Brno University of Technology.
  • [Mikolov et al.2013a] Tomáš Mikolov, Kai Chen, Greg D. Corrado, and Jeffrey Dean. 2013a. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781.
  • [Mikolov et al.2013b] Tomáš Mikolov, Ilya Sutskever, Kai Chen, Greg S. Corrado, and Jeff Dean. 2013b. Distributed representations of words and phrases and their compositionality. In Adv. NIPS.
  • [Panchenko et al.2016] Alexander Panchenko, Dmitry Ustalov, Nikolay Arefyev, Denis Paperno, Natalia Konstantinova, Natalia Loukachevitch, and Chris Biemann. 2016. Human and machine judgements for russian semantic relatedness. In Proc. AIST.
  • [Qiu et al.2014] Siyu Qiu, Qing Cui, Jiang Bian, Bin Gao, and Tie-Yan Liu. 2014. Co-learning of word representations and morpheme representations. In Proc. COLING.
  • [Recht et al.2011] Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. 2011. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In Adv. NIPS.
  • [Rumelhart et al.1988] David E. Rumelhart, Geoffrey E. Hinton, and Ronald J. Williams. 1988. Neurocomputing: Foundations of research. chapter Learning Representations by Back-propagating Errors, pages 696–699. MIT Press.
  • [Sak et al.2010] Haşim Sak, Murat Saraclar, and Tunga Gungör. 2010. Morphology-based and sub-word language modeling for turkish speech recognition. In Proc. ICASSP.
  • [Schütze1992] Hinrich Schütze. 1992. Dimensions of meaning. In Proc. IEEE Conference on Supercomputing.
  • [Schütze1993] Hinrich Schütze. 1993. Word space. In Adv. NIPS.
  • [Sennrich et al.2016] Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proc. ACL.
  • [Shaoul and Westbury2010] Cyrus Shaoul and Chris Westbury. 2010. The Westbury lab Wikipedia corpus.
  • [Soricut and Och2015] Radu Soricut and Franz Och. 2015. Unsupervised morphology induction using word embeddings. In Proc. NAACL.
  • [Spearman1904] Charles Spearman. 1904. The proof and measurement of association between two things. The American Journal of Psychology, 15(1):72–101.
  • [Sperr et al.2013] Henning Sperr, Jan Niehues, and Alexander Waibel. 2013. Letter n-gram-based input encoding for continuous space language models. In Proc. of the Workshop on Continuous Vector Space Models and their Compositionality at ACL.
  • [Sutskever et al.2011] Ilya Sutskever, James Martens, and Geoffrey E Hinton. 2011. Generating text with recurrent neural networks. In Proc. ICML.
  • [Svoboda and Brychcin2016] Lukáš Svoboda and Tomáš Brychcin. 2016. New word analogy corpus for exploring embeddings of Czech words. In Proc. CICLING.
  • [Turney et al.2010] Peter D. Turney, Patrick Pantel, et al. 2010. From frequency to meaning: Vector space models of semantics. Journal of Artificial Intelligence Research, 37(1):141–188.
  • [Wieting et al.2016] John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. 2016. CHARAGRAM: Embedding words and sentences via character n-grams. In Proc. EMNLP.
  • [Zesch and Gurevych2006] Torsten Zesch and Iryna Gurevych. 2006. Automatically creating datasets for measures of semantic relatedness. In Proc. Workshop on Linguistic Distances.
  • [Zhang et al.2015] Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Adv. NIPS.