
Word2Vec-SkipGram
Language3 ops14.3M params
Skip-gram word2vec: learn a vector per word by predicting the words around it, with full softmax or negative sampling.
Language · 7 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
About this model's family
word2vec is a tool for computing distributed representations of words: given a text corpus, it learns a vector for every word in the vocabulary using the Continuous Bag-of-Words or the Skip-Gram neural network architectures. The paper that introduced it proposed two novel model architectures for computing continuous vector representations of words from very large data sets, and reported large improvements in accuracy at much lower computational cost, taking less than a day to learn high quality word vectors from a 1.6 billion words data set.
The two captured members are both Skip-gram models, whose training objective is to find word representations that are useful for predicting the surrounding words in a sentence or a document. Unlike most of the earlier neural network architectures for learning word vectors, training of the Skip-gram model does not involve dense matrix multiplications, which makes it extremely efficient. The basic formulation defines the probability of an output word with a softmax over the whole vocabulary, which is impractical because the cost of the gradient is proportional to W, the number of words in the vocabulary.
The second member uses the follow-up paper's Negative sampling, a simple alternative to the hierarchical softmax, where the task becomes distinguishing the target word from draws from a noise distribution using logistic regression, with k negative samples for each data sample. The authors found that values of k in the range 5 to 20 are useful for small training datasets, while for large datasets k can be as small as 2 to 5, and that a unigram distribution raised to the 3/4 power as the noise distribution outperformed significantly the unigram and the uniform distributions. The learned vectors explicitly encode many linguistic regularities: the result of vec(Madrid) - vec(Spain) + vec(France) is closer to vec(Paris) than to any other word vector.
Key idea. word2vec made high quality word vectors cheap to learn with a Skip-gram model whose training does not involve dense matrix multiplications.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{mikolov2013efficientestimationwordrepresentations,
title={Efficient Estimation of Word Representations in Vector Space},
author={Tomas Mikolov and Kai Chen and Greg Corrado and Jeffrey Dean},
year={2013},
eprint={1301.3781},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/1301.3781},
}