All models

Word2Vec-SkipGram-NegSampling

Skip-gram word2vec: learn a vector per word by predicting the words around it, with full softmax or negative sampling.

Language · 7 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (11 KB)

Open in a new tab

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.

At a glance

Family
word2vec
Parameters
14.3M
Operations
7
Framework
PyTorch
Recurrent
No
Published
2013
Cited by
43,704 (as of 17 November 2026)
Authors
Tomas Mikolov, Kai Chen, Greg Corrado, Jeffrey Dean
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m3417
Graph hash
59f93d7ad06648f90eea55397306898767c07cdb5cd8181ad7d23c6290e6d9cd
Skeleton hash
ff01cc2cf257c370077a90d9da9443ce63c4086afbbb897436064a9d532d08c2
Architecture hash
c3a73534d62ceb526675df7d3d99d1c4d0d6c05a606df88e110cd6b9140142f4
Diagram SHA-256
d169ef51a906a01f9bfee94aea86b98250c58fce21ce768f6d64ca5a82c97ba5
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

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.

  • word2vec
  • Skip-gram
  • SGNS
  • negative sampling
  • CBOW
  • Continuous Bag-of-Words
  • word embeddings
  • word vectors
  • Mikolov
  • distributed representations
  • hierarchical softmax
  • Efficient Estimation of Word Representations in Vector Space

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@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}, 
}