Course map
Stage 1: Foundations
Stage 2: Machine Learning
Stage 3: Deep Learning
Stage 4: LLMs & Generative AI
Stage 5: Production & Specialization

Part 16 / Topic 3 of 5

Sparse vs dense vectors

Two vector families, different failure modes:

Sparse (TF-IDF, BM25) Dense (neural embeddings)
Matches Shared words Shared meaning
"send back" ≈ "return"? No Yes
Exact ids/SKUs ("A1001") Excellent Can miss
Needs a model No Yes

The lesson's own data shows the sparse failure measured: for "How long do I have to send something back?", TF-IDF's top hit was the damaged items doc, not the returns policy — zero shared keywords with "return" (Part 17 captures this miss in its recall eval). Dense embeddings close exactly that gap.

🧪 Quick quiz

  1. What can neural embeddings do that TF-IDF cannot?
Show the answer

Matching meaning across different words — measured here, where TF-IDF failed to match "send something back" to the returns article at k=1 because they share no keywords.

Done here? The practice set for Part 16 — 4 exercises with solutions — is on the part page.

Search the guide