LearnThatStack Ace your next interview
Embeddings & Vector Databases · question
Question 2 of 56

How does semantic search with embeddings differ from keyword search like BM25?

beginner
← All Embeddings & Vector Databases questions
Re-explain

Keyword search like BM25 ranks documents by the words they share with the query, while semantic search ranks them by meaning. The keyword score counts how often the query's words appear in a document, and it favors rare words. Semantic search compares embeddings, vectors that capture meaning, so a query can match a passage that shares no words with it.

A search for "car won't start" can return "vehicle ignition failure": close in meaning, zero shared terms.

Aspect BM25 Semantic
Matches on shared words meaning
Synonyms, paraphrase misses them handles them
Rare IDs, names, codes strong often weak
Per-query cost cheap text scoring embed the query first

BM25 needs no model at query time. It indexes new words the moment you add them. An embedding model only knows the vocabulary it was trained on, so a fresh product code means little to it. Most production systems run both.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for Embeddings & Vector Databases One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

What you can say

  1. Keyword search like BM25 ranks documents by the words they share with the query, while semantic search ranks them by meaning.
  2. BM25 counts how often the query's words appear in each document and gives rare words more weight, and it needs no model at query time.
  3. Semantic search turns the query and the documents into embeddings, vectors that capture meaning, and compares those instead of words.
  4. That's how 'car won't start' can match 'vehicle ignition failure' with zero shared terms, a result BM25 would miss.
  5. The trade-off flips on exact tokens. BM25 is strong on IDs, names and codes, and it indexes a new word the moment you add it.
  6. An embedding model only knows the vocabulary it trained on, so a fresh product code means little to it, which is why most production systems run both.

Weak answers to avoid

  • Says semantic search is strictly better It loses on exact IDs, names and new codes that BM25 handles well. Say where each one wins and that most production systems run both.
  • Describes BM25 as plain word counting Leaving out the rare-word weighting makes BM25 sound naive. Say it scores shared words by frequency and weights rare words higher.
  • Treats embeddings as knowing every term A model only knows what it saw in training, so a new product code carries little meaning to it. Say BM25 catches those terms as soon as they're indexed.
  • No concrete example of a paraphrase match "It understands meaning" with nothing behind it sounds memorized. Give one query and one matching passage that share no words.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Embeddings & Vector Databases cheatsheet.

← Back to all Embeddings & Vector Databases questions
Pro · $10/mo

49 of 56 Embeddings & Vector Databases answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime