Word2Vec-CBOW
Mikolov's continuous bag-of-words model: average the context word vectors and predict the word in the middle.
Language · 4 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.
At a glance
- Task
- Language
- Parameters
- 28.5M
- Operations
- 4
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICLR 2013 workshop
- Cited by
- 26,001 (as of 17 October 2026)
- Authors
- Tomas Mikolov, Kai Chen, Greg Corrado, Jeffrey Dean
- Source
- GitHub: tmikolov/word2vec
- 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 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.
Details
- Stable ID
- m3415
- Graph hash
- 611297dc78d62fe686c48138a87b200bd4d5c2e285055ebdef5358958de25917
- Skeleton hash
- 8d99749fde71b3ac2df74828ebfabc38e47cb71a007fe7cb18263efe38319da2
- Architecture hash
- 8535eaf81d4ed2e8293ae69da2894693233bebbb915afb9da8a6391fb8443912
- Diagram SHA-256
- a81b37e72103d119a571ca08a5921034de0bede97f686e7920dd8b90e1b49e48
- 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
Word2Vec CBOW, the continuous bag-of-words model, is one of two architectures Mikolov and colleagues proposed for computing continuous vector representations of words from very large data sets. The appeal was speed as much as quality: the authors observed 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 word data set. The reasoning was to explore simpler models that might not represent the data as precisely as neural networks but could be trained on much more data efficiently.
CBOW is the feedforward neural net language model with the non-linear hidden layer removed and the projection layer shared for all words, so that every context word gets projected into the same position and their vectors are averaged. It is called a bag-of-words model because the order of words in the history does not influence the projection. The training criterion is to correctly classify the current, middle word from a log-linear classifier fed with both history and future words. The name marks the difference from a standard bag-of-words model: CBOW uses a continuous distributed representation of the context. In the paper's own training setup the output is a hierarchical softmax in which the vocabulary is represented as a Huffman binary tree.
The official word2vec tool asks the user to choose the vector dimensionality, the context window size and whether to train with hierarchical softmax and/or negative sampling. Its demo script downloads a small (100MB) text corpus from the web and trains a small word vector model. On the paper's Semantic-Syntactic test set, CBOW worked better than the NNLM on the syntactic tasks and about the same on the semantic one. Its sibling Skip-gram did slightly worse on the syntactic task but much better on the semantic part of the test than all the other models. On a subset of the Google News data, the CBOW model trained in about a day, while the Skip-gram model took about three days.
Key idea. CBOW removes the non-linear hidden layer of the feedforward neural net language model and averages shared context-word projections to predict the middle word. That simplification brought large improvements in accuracy at much lower computational cost.
- word2vec
- CBOW
- continuous bag-of-words
- word embeddings
- word vectors
- Mikolov
- Efficient Estimation of Word Representations in Vector Space
- distributed representations
- text8
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},
}