Continuous Bag of Words (CBOW)
Delete one word from a sentence and ask someone to fill the gap: “she poured the ___ into the mug”. They will say coffee, or tea. Continuous bag of words has a model do that exercise millions of times — and the useful product is not the guesses, it is the word vectors learned along the way.
How the model is set up
CBOW is one of the two Word2Vec architectures. For each position in the corpus it takes the words inside a surrounding window, averages their input vectors, and from that single averaged vector predicts the word in the middle:
- “Bag”, because the context words are pooled without order — “into the mug she poured” would serve just as well.
- “Continuous”, because the representation is a dense vector rather than a sparse count.
- The output layer is never computed in full: negative sampling or hierarchical softmax approximates it, which is what makes training on billions of tokens feasible.
CBOW or skip-gram
Its sibling skip-gram inverts the task and predicts the context from the centre word. In practice CBOW trains faster and gives smoother vectors for frequent words, because each update averages several contexts at once; skip-gram makes a separate prediction per context word and so learns rare words better. In Gensim's Word2Vec the two are one switch apart.
Why it matters
CBOW was among the first demonstrations that the distributional hypothesis could be turned into cheap, reusable geometry — vectors where similar words sit close together and analogies become arithmetic. Its limitation is built in: one vector per word, averaged over every sense that word ever had, which is precisely what contextual embeddings later removed.
Continuous bag of words is one of the two Word2Vec training schemes: it averages the vectors of the words surrounding a position and predicts the word in the middle, ignoring order. Negative sampling or hierarchical softmax keeps training tractable, and the learned input vectors — not the predictions — are the goal. CBOW trains faster than skip-gram and represents frequent words well, but assigns each word a single context-free vector.
Here is a game. Cover one word in a sentence and guess it from its neighbours: “she poured the ___ into the mug” — coffee, probably.
Continuous bag of words has software play that game across enormous amounts of text. Nobody wants its guesses. What matters is the side effect: to guess well, it has to learn which words keep similar company, and it ends up storing every word as a list of numbers that places “coffee” near “tea”. Those number lists became the raw material for search, translation and recommendation tools. The catch is that each word gets one fixed list, whatever the sentence.