Hybrid Search and Reranking for Better Retrieval
Combine keyword and vector search, then rerank, to find the right passage.
Hello. In this lesson I will take you through 4 ideas, one at a time.
Why it matters: Combine keyword and vector search, then rerank, to find the right passage. After each idea I will ask you one quick question.
In this lessonFollows you as you read
Why one method is not enough
The short version: Vector search finds passages with similar meaning even when words differ, which suits natural questions.
Vector search finds passages with similar meaning even when words differ, which suits natural questions. Keyword search such as BM25 finds exact terms, which suits product codes, clause numbers, names and acronyms that embeddings can blur. Business questions mix both.
Hybrid search runs both and merges the results, commonly with reciprocal rank fusion, which combines rankings without needing comparable scores.
Which search finds exact product codes best?
Reranking
The short version: Retrieval returns candidates quickly but roughly.
Retrieval returns candidates quickly but roughly. A reranker, often a cross-encoder model that reads the question and each passage together, scores the top candidates more accurately. Retrieve 30 to 50 candidates, rerank, and pass the best handful to the generator.
Reranking usually improves answer quality more than switching embedding models.
What does a reranker do?
Filters and query rewriting
The short version: Use metadata filters before ranking: document type, product, country, date range and access group.
Use metadata filters before ranking: document type, product, country, date range and access group. A question about the UAE office policy should not retrieve the India policy.
For conversational questions, rewrite the latest message into a standalone query that includes context from earlier turns before retrieving.
What does recall at 5 tell you?
Measure retrieval separately
The short version: Measure retrieval on its own: for each test question, is the passage containing the answer in the top results?
Measure retrieval on its own: for each test question, is the passage containing the answer in the top results? Recall at 5 and at 20 tell you whether the problem is finding the passage or ranking it.
Fix retrieval before tuning the generator.
- Combine keyword and vector search
- Merge with rank fusion and rerank the top candidates
- Filter by metadata including access
- Rewrite conversational questions into standalone queries
- Measure retrieval recall separately
Run your test questions through keyword-only, vector-only and hybrid retrieval, record whether the answer passage appears in the top 5 and top 20 for each, and add a reranker to the best one.
Mark it complete to track your progress on this device.