Arxiv:1712.09405V1

Arxiv:1712.09405V1

Advances in Pre-Training Distributed Word Representations Tomas Mikolov, Edouard Grave, Piotr Bojanowski, Christian Puhrsch, Armand Joulin Facebook AI Research {tmikolov, egrave, bojanowski, cpuhrsch, ajoulin}@fb.com Abstract Many Natural Language Processing applications nowadays rely on pre-trained word representations estimated from large text corpora such as news collections, Wikipedia and Web Crawl. In this paper, we show how to train high-quality word vector representations by using a combination of known tricks that are however rarely used together. The main result of our work is the new set of publicly available pre-trained models that outperform the current state of the art by a large margin on a number of tasks. Keywords: fastText, word2vec, word vectors, pre-trained 1. Introduction known modifications and data pre-processing strategies that Pre-trained continuous word representations have become are rarely used together: the position dependent features in- basic building blocks of many Natural Language Process- troducedby Mnih and Kavukcuoglu (2013), the phrase rep- ing (NLP) and Machine Learning applications. These resentations used in Mikolov et al. (2013b) and the use of pre-trained representations provide distributional infor- subword information (Bojanowski et al., 2017). mation about words, that typically improve the gen- We measure their quality on standard bench- eralization of models learned on limited amount of marks: syntactic, semantic and phrase-based data (Collobert et al., 2011). This information is typically analogies (Mikolovetal.,2013b), rare words derived from statistics gathered from large unlabeled cor- dataset (Luonget al., 2013), and as features in a ques- pus of text data (Deerwester et al., 1990). A critical aspect tion answering pipeline on Squad question answering of their training is thus to capture efficiently as much statis- dataset (Rajpurkar et al., 2016; Chen et al., 2017). tical information as possible from rich and vast sources of data. 2. Model Description A standard approach for learning word representations is In this section, we briefly describe the cbow model as it to train log-bilinear models based on either the skip-gram was used in word2vec, and then explain several known im- or the continuous bag-of-words (cbow) architectures, as provements to learn richer word representations. implemented in word2vec (Mikolov et al., 2013a) and fast- 1 Text (Bojanowski et al., 2017) . In the skip-gram model, 2.1. Standard cbow model nearby words are predicted given a source word, while in the cbow model, the source word is predicted according to The cbow model as used in Mikolov et al. (2013a) learns its context. These architectures and their implementation word representations by predicting a word according to its have been optimized to produce high quality word repre- context. The contextis defined as a symmetric windowcon- sentations able to transfer to many tasks, while maintaining taining all the surrounding words. More precisely, given a a sufficiently high training speed to scale to massive amount sequence of T words w1,...,wT , the objective of the cbow of data. model is to maximize the log-likelihood of the probability Recently, word2vec representations have been widely used of the words given their surrounding, i.e.: in NLP pipelines to improve their performance. Their im- arXiv:1712.09405v1 [cs.CL] 26 Dec 2017 T pressive capability at transfering to new problems suggests log p (w | C ) , (1) X t t that they are capturing important statistics about the train- t=1 ing corpora (Baroni and Lenci, 2010). As can be expected, the more data a model is trained on, the better the represen- where Ct is the context of the t-th word, e.g., the words tations are at transferring to other NLP problems. Training wt−c,...wt−1, wt+1,...,wt+c for a context window of such models on massive data sources, like Common Crawl, size 2c. For now on, we assume that we have access to can be cumbersome and many NLP practitioners prefer to a scoring function between a word w and its context C, use publicly available pre-trained word vectors over train- denoted by s(w, C). This scoring function will be later ing the modelsby themselves. In this work, we providenew parametrized by the word vectors, or representations. A pre-trained word vectors that show consistent improvement natural candidate for the conditional probability in Eq. 1 is over the currently available ones, making them potentially a softmax function over the scores of a context and words very useful to a wide community of researchers. in the vocabulary. This choice is however impractical for We show that several modifications of the standard large vocabulary. An alternative is to replace this proba- word2vec training pipeline significantly improves the qual- bility by independent binary classifiers over words. The ity of the resulting word vectors. We focus mainly on correct word is learned in contrast with a set of sampled negative candidates. More precisely, the conditional proba- 1https://fasttext.cc/ bility of a word w given its context C in Eq. (1) is replaced by the following quantity: 2.3. Phrase representations The original cbow model is only based on unigrams, which log 1+ e−s(w,C) + log 1+ es(n,C) , (2) X is insensitive to the word order. We enrich this model with n∈NC word n-grams to capture richer information. Directly incor- porating the n-grams in the models is quite challenging as it where NC is a set of negative examples sampled from the vocabulary. The objective function maximized by the cbow clutters the models with uninformative content due to huge model is obtainedby replacingthe log probabilityin Eq. (1) increase of the number of the parameters. Instead, we fol- by the quantity defined in Eq. (2), i.e.: low the approach of Mikolov et al. (2013b) where n-grams are selected by iteratively applying a mutual information T criterion to bigrams. Then, in a data pre-processing step we −s wt,Ct s n,Ct log 1+ e ( ) + log 1+ e ( ) . X X merge the words in a selected n-gram into a single token. t=1 n∈NCt For example, words with high mutual information like ”New York” are merged in a bigram token, ”New York”. A naturalparametrizationfor this model is to represent each This pre-processing step is repeated several times to word w by a vector vw. Similarly, a context is represented ′ form longer n-gram tokens, like ”New York City” or by the average of word vectors ′ of each word in its uw w ”New York University”. In practice, we repeat this pro- window. The scoring function is simply the dot product cess 5 − 6 times to build tokens representing longer between these two quantities, i.e., ngrams. We used the word2phrase tool from the word2vec 2 1 T project . Note that unigrams with high mutual information s(w, C)= uw′ vw. (3) are merged only with a probability of 50%, thus we still |C| X′ w ∈C keep significant number of unigram occurrences. Interst- Note that different parametrizations are used for the words ingly, even if the phrase representations are not further used in a context and the predicted word. in an application, they effectively improve the quality of the Word subsampling. The word frequency distribution in word vectors, as is shown in the experimental section. a standard text corpus follows a Zipf distribution, which 2.4. Subword information implies that most of the words belongs to small subset of Standard word vectors ignore word internal structure that the entire vocabulary (Li, 1992). Considering all the oc- contains rich information. This information could be useful curences of words equally would lead to overfit the param- for computing representations of rare or mispelled words, eters of the model on the representation of the most fre- as well as for mophologically rich languages like Finnish quent words, while underfitting on the rest. A common or Turkish. A simple yet effective approach is to enrich the strategy introduced in Mikolov et al. (2013a) is to subsam- word vectors with a bag of character n-gram vectors that ple frequent words, with the following probability p of disc is either derived from the singular value decomposition of discarding a word: the co-occurence matrix (Sch¨utze, 1993) or directly learned fromalargecorpusof data(Bojanowski et al., 2017). In the pdisc(w)=1 − t/fw (4) p latter, each word is decomposed into its character n-grams where fw is the frequency of the word w, and t > 0 is a N and each n-gram n is represented by a vector xn. The parameter. word vector is then simply the sum of both representations, i.e.: 2.2. Position-dependent Weighting 1 The context vector described above is simply the average vw + xn. (6) |N| X of the word vectors contained in it. This representation is n∈N oblivious to the position of each word. Explicitly encod- In practice, the set of n-grams N is restricted to the n-grams ing a representation for both a word and its position would with 3 to 6 characters. Storing all of these additional vec- be impractical and prone to overfitting. A simple yet effec- tors is memory demanding. We use the hashing trick to tive solution introduced in the context of word representa- circumvent this issue (Weinberger et al., 2009). tion by Mnih and Kavukcuoglu (2013) is to learn position representations and use them to reweight the word vectors. 3. Training Data This position dependent weighting offers a richer context We used several sources of text data that are publicly avail- representation at a minimal computational cost. able and the Gigaword dataset, as described in Table 1.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us