Hybrid search & reranking
Combine semantic search with old-school keyword search (hybrid), then have a smarter model re-order the candidates (reranking) - the two standard upgrades when plain RAG plateaus.
In plain terms
Embeddings are great at meaning but weirdly bad at exact codes: search 'error TS-4401' and semantic search returns pages about errors, missing the one page containing TS-4401. Keyword search nails codes but misses synonyms. Hybrid runs both and merges. Reranking then adds a picky second interviewer: retrieval shortlists 25 candidates fast; the reranker reads each one carefully against the query and reorders the top picks.
Why it matters
Product names, SKUs, legal clause numbers, function names - real corpora are full of exact strings embeddings fumble. And bi-encoder retrieval (query and doc embedded separately) is inherently cruder than a cross-encoder that reads them together. These two fixes buy the biggest retrieval gains per hour of work.
How it works
Hybrid: run vector search + BM25 (keyword ranking) in parallel; merge with Reciprocal Rank Fusion (RRF - combines rank positions, no score calibration needed). Most vector DBs ship this as a flag. Rerank: over-retrieve (top 25-50), send each (query, chunk) pair to a reranker (Cohere Rerank API or an open cross-encoder), keep the top 3-5 for the prompt. Adds ~100-300ms and a small cost.
When you use it
After measuring plain RAG and finding retrieval misses - especially exact-term queries. Not on day one; measure first.
Common mistakes
- Adding both upgrades before having a retrieval eval, so you can't tell if they helped.
- Reranking only 5 candidates - the point is giving the reranker a WIDE net to fix.
- Merging keyword and vector scores by raw addition (incomparable scales - use RRF).
Best practices
- Keep the golden-set retrieval eval from Phase 04; measure hit-rate before/after each upgrade.
- Typical winning stack: hybrid retrieve 30 -> rerank -> top 4 to the model.
Try it yourself
Add 10 exact-term queries (codes, names) to your golden set. Measure vector-only vs hybrid hit-rate. Then bolt on a reranker and measure again - three numbers, full story.
Resources
- Cohere - Rerank docs Drop-in reranking with a free tier.