All jobs / Data science / ML / AI / NLP
Data science / ML / AI interview question · 1–3 years
Before transformers, why did people use recurrent networks for text instead of a bag-of-words model, and what was their weakness?
The strongest answer
Bag-of-words discards order, so “not good” looks like “good”; an RNN reads tokens in order and carries a state — but that state fades over long spans and training cannot run in parallel across the sequence
Why it works
Right — order and state were the win; fading long-range memory and sequential training were the price transformers removed.
What a good answer covers
- Bag-of-words loses order.
- RNN: read in sequence, carry state.
- Weakness: long spans fade.
- Sequential training, no parallelism.
Answers that fall short
- Close, but not the strongest: RNNs were more accurate because they had more parameters than bag-of-words models
Parameter count is not the point; word order is what a bag of words cannot see. - Weak: RNNs could handle sentences of any length, which bag-of-words models could not
A bag of words handles any length by counting; the RNN’s advantage is order, not length. - Red flag: There was no real reason; bag-of-words with a good classifier is still the best choice for most text tasks
Bag-of-words is a fine baseline, but negation, word order and context are real for most tasks; dismissing that is a gap.
Who gets asked this
More NLP questions
- You use an LLM to grade another LLM. What makes that acceptable?
- A RAG answer has no supporting chunk. What should the product do?
- Your search matches queries to documents by averaging word2vec vectors of the words. Users searching “river…
- 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?