Hybrid search for RAG cover

Hybrid Search for RAG: Why BM25 + Vectors Beats Either Alone

Retrieval-augmented generation (RAG) lets an AI assistant answer from your own documents instead of guessing. The model is only as good as what you retrieve, though. In an enterprise document Q&A system I built, the biggest quality jump came from one decision: using hybrid search, keyword and vector search together, instead of vectors alone.

Why vector search alone falls short

Vector search finds text with a similar meaning. Ask “how do I get reimbursed for travel?” and it can find a passage titled “expense claims”, even with no shared words. That is powerful. But it is weak at exact matches: policy codes, product names, error messages, people’s names. A question about “form HR-204” might return passages about other forms that simply feel similar.

Why keyword search alone falls short

Classic keyword search (BM25) is the opposite. It is excellent at exact terms and rare words, and it is fast and explainable. But it misses synonyms and paraphrases. If the user’s words differ from the document’s words, it finds nothing useful.

Hybrid: run both, then merge

Hybrid search runs BM25 and vector search side by side, then combines the two ranked lists into one. Passages that score well in both rise to the top. Each method covers the other’s blind spot: vectors catch the meaning, BM25 catches the exact terms. In my system, BM25 ran alongside FAISS for the vector index.

The rest of a production RAG system

Good retrieval is the foundation, but a system people trust needs more:

  • Conversation memory. Follow-up questions like “what about for contractors?” only make sense with context. I kept multi-turn session memory in Redis.
  • Source citations. Every answer points back to the documents it came from, with a confidence score, so users can check it.
  • Measured quality. I scored answers automatically with RAGAS metrics (faithfulness, answer relevancy, context precision and context recall) instead of judging by feel.
  • Private observability. Traces ran through a self-hosted Arize Phoenix instance, so sensitive company documents never left our infrastructure for monitoring.
  • Helpful suggestions. Contextual follow-up suggestions, with no repeats, help users discover what they can ask.

Takeaways

  • If your documents contain codes, names or jargon, use hybrid search. Vectors alone will miss them.
  • Show your sources. Citations build trust faster than any prompt.
  • Measure retrieval and answers with real metrics, so every change is an improvement you can prove.

Want an assistant that answers from your company’s own documents? Let’s talk about what it would take.