All jobs / Data science / ML / AI / NLP
Data science / ML / AI interview question · 3–5 years
Your search matches queries to documents by averaging word2vec vectors of the words. Users searching “river bank” get pages about savings accounts.
What is the limitation, and what do you change?
The strongest answer
Static embeddings give one vector per word regardless of context, so both senses of “bank” share it and averaging blurs everything; a contextual model (BERT-style or a sentence-embedding model) encodes the phrase as a whole, sense included
Why it works
Exactly — one-vector-per-word cannot represent polysemy; contextual encoders produce different vectors for the same word in different sentences.
What a good answer covers
- Static: one vector per word.
- Polysemy collapses into one point.
- Contextual encoders embed the phrase.
- Sentence-embedding models for retrieval.
Answers that fall short
- Close, but not the strongest: Add “river” as a boost term so that geography-related pages rank higher for that query
A patch for one query; the underlying representation still cannot tell senses apart. - Weak: Train the word2vec model on more text so it learns the second meaning of bank
More data cannot help: word2vec is defined as one vector per word, so both senses stay merged. - Red flag: Embeddings are unreliable for search; switch to exact keyword matching only
Keyword-only search loses synonyms and paraphrase; the fix is a better representation, not abandoning meaning.
Who gets asked this
More NLP questions
- How do you evaluate a RAG system beyond “users liked it”?
- A stakeholder wants to fine-tune “so the model knows our brand.” When do you push back?
- You need humans to grade model answers. What do you specify?
- RAG chunks are 2k tokens with no overlap because “the model is long-context now.” Pushback?
- Who owns the eval suite for an assistant that can spend money?
- The company wants one platform: “fine-tune everything.” Your staff answer?
- Teams keep adding prompts that their model already passes. How do you protect the suite?
- Why do modern language models split text into subword pieces rather than whole words or single characters?