Vector Search vs Keyword Search (BM25)
Why neither is enough on its own
Vector Search vs Keyword Search (BM25)
Why neither is enough on its own
Part of the series: How Search Understands Meaning
In the last post, we used this mental model:
- similarity search = engine
- semantic search = full car
But that raises another question: What powers the car itself?
Because semantic systems don’t rely on a single retrieval method.
They usually combine:
- vector search (meaning)
- keyword search (exact matching)
And both solve different problems.
What
Modern search systems generally use two approaches:
- Keyword search → exact term matching
- Vector search → semantic similarity
Most production systems use both.
Because each one fails differently.
Why
Users don’t always search using exact words.
Example:
“affordable notebook”
A user probably means:
“cheap laptop”
Keyword search may miss that entirely.
But vector search can understand the semantic similarity.
Now reverse it.
Query:
“iPhone 13 Pro”
Here, exact words matter.
And keyword search often performs better than vectors.
That’s the core tradeoff.
Now, how it actually works 👇
1. Keyword search (BM25)
Traditional search engines use approaches like BM25.
The idea is simple:
- match exact terms
- score documents based on relevance
- rank results accordingly
Keyword search cares about:
- which words appear
- how often they appear
- how rare they are across documents (Inverse Document Frequency / IDF)
Rare terms like: “PostgreSQL” carry more ranking weight than common words like: “database”
2. What keyword search is good at
Keyword search is excellent for:
- exact names
- product IDs
- error codes
- technical terms
- precise queries
Example:
Query: “iPhone 13 Pro”
Keyword search understands:
- exact words matter
- exact ordering matters
That gives it very high precision.
3. Where keyword search fails
It does not understand meaning.
Example:
Query: “affordable notebook”
Document: “cheap laptop for students”
The meaning matches. The words don’t.
So keyword systems may rank it poorly or miss it entirely.
4. Vector search (semantic retrieval)
Vector search works differently.
Instead of matching exact words:
text
↓
embedding model
↓
embedding vector
↓
similarity comparison
An embedding model converts text into vectors that capture semantic meaning.
Example embedding models:
- OpenAI text-embedding-3-small
- Google Gemini text embeddings
- Cohere Embed v3
Example:
"cheap laptop"
↓
[0.12, -0.98, 0.44, ...]
Now the system can compare:
- meaning
- intent
- semantic similarity
instead of exact keywords.
At scale, systems usually use Approximate Nearest Neighbor (ANN) indexes like HNSW or FAISS to make similarity search fast enough for millions of vectors.
5. What vector search is good at
Vector search is strong when:
- wording changes
- queries are conversational
- users describe intent naturally
Example:
“how to fix wifi”
can match:
“troubleshooting internet connectivity”
Even though almost none of the keywords overlap.
That’s the power of semantic similarity.
6. Where vector search fails
Vector search can lose precision.
Example:
Query:
“iPhone 13 Pro”
Vector search might retrieve:
- iPhone 14
- Apple accessories
- other premium phones
Because semantically:
- they are related
But the user wanted:
exact match
This is where keyword search wins.
7. Side-by-side comparison
| Problem | Keyword Search | Vector Search |
|---|---|---|
| Exact match | ✅ Strong | ❌ Weaker |
| Synonyms | ❌ Weak | ✅ Strong |
| Semantic understanding | ⚠️ Limited | ✅ Strong |
| Precision | ✅ High | ⚠️ Variable |
| Conversational queries | ❌ Weak | ✅ Strong |
8. The real insight
These systems fail in opposite ways.
Keyword search:
- understands exact words
- misses meaning
Vector search:
- understands meaning
- misses exact precision
That’s why modern retrieval systems rarely rely on only one.
9. Mental model

keyword vs vector search
Think of it like this:
- keyword search = literal matching
- vector search = meaning matching
One matches what you said. The other matches what you meant.
Final takeaway
Keyword search and vector search solve different problems.
And the key idea: Precision and meaning are separate signals.
Modern systems combine both.
What’s next
In the next post, we’ll combine these ideas:
Hybrid search: combining sparse and dense signals into one retrieval system.
That’s where modern search systems start to get really powerful.
Series
- Part 1 — How Machines Measure Meaning
- Part 2 — Semantic Search vs Similarity Search
- Part 3 (this)— Vector Search vs Keyword Search (BM25)
- Part 4 (next)— Why Hybrid Search Wins
메타데이터
- post_id
- d1b96eb46c4b
- slug
- vector-search-vs-keyword-search-bm25-d1b96eb46c4b
- url
- https://medium.com/@nerdapplabs/vector-search-vs-keyword-search-bm25-d1b96eb46c4b
- canonical_url
- https://medium.com/@nerdapplabs/vector-search-vs-keyword-search-bm25-d1b96eb46c4b
- author_url
- https://medium.com/@nerdapplabs
- status
- ok
- fetched_at
- 2026-07-16 16:12:24