Tutorials AI & LLM Engineering for .NET Architects
Hybrid Search: Combining Keyword and Semantic search for accuracy
On this page
The Gold Standard: Hybrid Search
Pure vector search is great for "Meaning," but it's bad at "Exact Matches." If a user searches for a product ID like 'SKU-9901,' a vector search might return 'SKU-9902' because the meaning is similar. We solve this with Hybrid Search.
1. Vector + Keyword
Hybrid search runs two searches in parallel:
- Vector Search: Finds things similar in meaning.
- BM25 / Keyword Search: Finds exact word matches and product IDs.
2. Reciprocal Rank Fusion (RRF)
How do we combine the two lists? We use **RRF**. It merges the results and gives a higher score to items that appear at the top of BOTH lists. This provides the most accurate and "human-like" search experience possible.
4. Interview Mastery
Q: "What is a 'Semantic Reranker'?"
Architect Answer: "A reranker is an expensive but smart model that takes the top 50 results from a hybrid search and spends more compute power to re-order them perfectly. It looks at the actual *relevance* between the question and the snippet. In Azure AI Search, this is called **Semantic Ranking**. It significantly increases accuracy for complex questions, but adds ~200ms of latency to the search."