NATURAL LANGUAGE PROCESSING · INTERVIEW QUESTION
Compare Word2Vec, GloVe, and contextual embeddings (BERT). When would you use each?
🟡 intermediate · Word Embeddings
Hint: Static vs contextual, training objective differences.
Answer
Word2Vec: learns fixed embeddings via skip-gram (predict context from word) or CBOW (predict word from context). Fast, captures semantic relationships (king - man + woman ≈ queen). GloVe: factorizes co-occurrence matrix, similar quality to Word2Vec but uses global statistics.
Interview reasoning
Both produce static embeddings (one vector per word regardless of context). BERT embeddings: contextual — 'bank' gets different vectors in 'river bank' vs 'bank account'. Generated by transformer encoder, captures polysemy and long-range dependencies.
Use static embeddings for: simple similarity tasks, limited compute, interpretability.
Use contextual for: NLU tasks, when polysemy matters, downstream fine-tuning.
Static embeddings give each word type one vector, while contextual encoders produce representations conditioned on surrounding text. Word2Vec learns local predictive relationships; GloVe models corpus co-occurrence structure. Contextual models handle polysemy but cost more and still need a task-appropriate pooling/evaluation procedure.
Worked example. Word2Vec or GloVe can be efficient for lexical similarity; a contextual encoder better distinguishes finance versus river uses of 'bank'.
Validation
Compare quality, memory and latency on ambiguous domain examples; evaluate sentence pooling separately from token representations.
Common pitfalls
A contextual model's raw CLS vector is not automatically an optimal similarity embedding. Pretraining data and domain transfer confound model-family comparisons.