Skip to Content

How Does Adding BM25 Lexical Search Improve RAG for Technical Terms?

What Retrieval Method Should You Add When Semantic Search Fails on Exact Keywords?

Discover why adding BM25 lexical search to your semantic search system creates a powerful hybrid approach that perfectly retrieves exact product names and technical terms.

Question

Your semantic search works well for conceptual queries but fails on exact product names and technical terms. What retrieval method should you add?

A. Use larger embeddings
B. Add BM25 lexical search for keyword matching
C. Increase the number of retrieved chunks
D. Use a different embedding model

Answer

B. Add BM25 lexical search for keyword matching

Explanation

When a semantic search system successfully understands broad concepts but struggles to find specific entities like exact product names, IDs, or technical jargon, the best solution is to implement a hybrid search approach by adding a lexical (keyword) retrieval method like BM25. BM25 works by looking for the exact tokens (words) from the user’s query within the documents and scoring them based on term frequency and rarity, ensuring that highly specific, exact-match terms are reliably retrieved alongside the conceptual results from your vector embeddings.