The Limits of Bag-of-Words
NLP
Chapter 4 · The Limits of Bag-of-Words
nlp1-2 and nlp1-3 both flagged the same loss and moved on. This chapter stops and actually proves it, then reveals a second, entirely separate blind spot neither chapter mentioned at all.
Problem 1: Word Order — Proven, Not Just Asserted
Vocabulary: [bites, dog, man].
"dog bites man" → [1, 1, 1] "man bites dog" → [1, 1, 1]
Identical vectors. Not approximately similar — identical, down to the last digit, whether built with nlp1-2's own raw counts or nlp1-3's own TF-IDF weights. A model trained on either representation has no way whatsoever to distinguish these two sentences, because as far as its own input is concerned, they aren't two sentences at all — they're the exact same input, twice.
Problem 2: No Notion of Meaning — A Genuinely Separate Issue
Every vocabulary word is its own independent, arbitrary dimension. "good" and "great" are just two unrelated vector positions — as far as the representation itself is concerned, "good" is exactly as similar to "great" as it is to "car" or "purple". Nothing about bag-of-words or TF-IDF encodes synonymy or semantic closeness at all.
"great" has no built-in way to recognize "excellent" as equally positive if "excellent" rarely appeared during training — the model can only generalize from the literal, specific words it happened to see, never from what those words actually mean.
This also reframes nlp1-2's own out-of-vocabulary limitation as a direct symptom of this deeper problem, not just an annoying edge case: a genuinely new word like "excellent" gets silently dropped rather than recognized as close in meaning to "great," precisely because nothing in the representation has any concept of "close in meaning" to begin with.
Two Separate Problems, Two Separate Fixes
Word Order
Fixed by nlp1-6 — sequence models, revisiting nn1-8's own RNN/LSTM material, applied to text for real.
Word Meaning
Fixed by nlp1-5 — word embeddings, representing words as dense vectors positioned by genuine semantic closeness.
nlp1-5's own embeddings arrive, order remains completely unaddressed until nlp1-6 adds a sequence model on top.
Hands-On Exercises
Using this chapter's own vocabulary and vectors, explain precisely why "dog bites man" and "man bites dog" produce mathematically identical vectors, not merely similar ones, under both nlp1-2's and nlp1-3's own representations.
📄 View solutionExplain why this chapter reframes nlp1-2's own out-of-vocabulary limitation as "a direct symptom" of the meaning problem rather than a separate, unrelated issue.
📄 View solutionExplain why this chapter insists the order problem and the meaning problem require two genuinely separate fixes, using this chapter's own warn-box, and explain what would still be broken if only nlp1-5's own embeddings were applied without nlp1-6's own sequence modeling.
📄 View solutionChapter 4 Quick Reference
- Problem 1 — Word order: "dog bites man" and "man bites dog" produce mathematically identical vectors under both nlp1-2 and nlp1-3
- Problem 2 — Word meaning: every word is its own unrelated dimension — "good" and "great" are as unrelated as "good" and "car"
- Out-of-vocabulary words (nlp1-2) are a direct symptom of the meaning problem, not a separate edge case
- Two genuinely independent problems, two genuinely independent fixes — neither alone solves both
- Next chapter: Word Embeddings & Word2Vec (fixes meaning) · nlp1-6 fixes order