Continuous Bag of Words (CBoW)

Predicts a middle word giving surrounding context words, i.e. predict word with in the middle with index k of a sequence of 2k+1 words.

2025-04-28_21-20-01_Continuous Bag of Words_Model architecture.png

Use a sliding window with size k to generate pairs of (x,y) values, where x=2k words and y= middle word

Input: Start with one-hot vectors eiR|V| for 2k context words, with k as the span of the model

Embedding Layer:

Context Aggregation Layer:

Prediction Layer:

Training:


This and SkipGram are referred to as Word2Vec approaches.