BM25 vs Semantic Search vs Hybrid RAG: What My Benchmarks Revealed A developer building an open-source codebase RAG system called AI Codebase Intelligence benchmarked four retrieval methods and found that equal-weight hybrid RRF underperformed semantic search alone, scoring an MRR@5 of 0.692 versus 0.854. Adding cross-encoder reranking after RRF recovered the gap, reaching a Hit@5 of 1.000 and MRR@5 of 0.875, slightly above semantic search. The developer cautioned that the evaluation set was small and measured retrieval quality only, not end-to-end answer accuracy or latency. I built a codebase RAG system using BM25, semantic search, reciprocal rank fusion RRF , and cross-encoder reranking. I expected hybrid search to outperform semantic search alone. It didn't. On my evaluation set, semantic search achieved an MRR@5 of 0.854, while hybrid RRF dropped to 0.692. Adding cross-encoder reranking changed the result. Here's what I tested and what I learned. Searching a codebase isn't the same as searching ordinary text. A developer might ask: Where does the application check whether a user is logged in? But the relevant implementation could be a function named decode access token . BM25 can find exact identifiers. Semantic search can match questions to code with different wording. I wanted to see whether combining both approaches would improve retrieval quality. My project, AI Codebase Intelligence , indexes software repositories and lets developers ask questions about their code. The system uses: The retrieval pipeline looks like this: Question | v BM25 + Semantic Search | v Reciprocal Rank Fusion | v Cross-Encoder Reranking | v Relevant Code Chunks | v Local LLM | v Answer + Source Citations I created a small ground-truth evaluation set and compared four retrieval methods. I measured: Hit@5: Whether at least one relevant result appears in the top five. MRR@5: How highly the first relevant result ranks within the top five, averaged across queries. Here are the results: | Retrieval Method | Hit@5 | MRR@5 | |---|---|---| | BM25 | 0.750 | 0.500 | | Semantic Search | 1.000 | 0.854 | | Hybrid RRF | 0.875 | 0.692 | | RRF + Reranking | 1.000 | 0.875 | These results come from my project's evaluation set, not a standardized public benchmark. Hybrid RRF performed worse than semantic search alone. Combining BM25 and semantic search actually reduced both Hit@5 and MRR@5 in this experiment. The initial hybrid implementation used equal-weight RRF. One possible explanation is that combining the ranked lists pushed some relevant semantic results lower. However, I haven't isolated the exact cause. The important point is that adding another retrieval component did not automatically improve the results. I added a cross-encoder reranker after RRF. Instead of relying only on the original retrieval rankings, the cross-encoder evaluates the query and each candidate together to produce a new ordering. The result: Compared with semantic search alone, the final pipeline achieved the same Hit@5 and a slightly higher MRR@5. That improvement gave me a measurable reason to keep the reranking stage. The project also includes the engineering needed to make the retrieval system usable. Repository indexing runs asynchronously using Celery and Redis. Repeated RAG responses can be cached in Redis. Generated answers include source file and line-range citations, making it easier to verify the retrieved evidence. I also added read-only MCP tools for searching code, retrieving files, listing symbols, and asking questions about a repository. This was a small evaluation, so the results shouldn't be treated as universal. Different datasets, repositories, embedding models, fusion parameters, and rerankers may produce different outcomes. I also measured retrieval quality, not end-to-end answer accuracy or latency. Those would be important next steps. The biggest lesson from this project wasn't that hybrid RAG is better or worse than semantic search. It was that retrieval quality needs to be measured instead of assumed . My first hybrid implementation added complexity while reducing performance. Cross-encoder reranking improved the results, but the benefit only became clear after running the evaluation. A more complicated RAG architecture isn't automatically a better one. Read the full technical article, including the architecture and implementation details: BM25 vs Semantic Search vs Hybrid RAG: What My Benchmarks Revealed https://borjan.ladinski.com/articles/bm25-semantic-hybrid-rag-benchmarks/ I'm Borjan Ladinski, an AI Engineer and AI Consultant based in Skopje, North Macedonia. I work on AI agents, LLM applications, RAG, machine learning, and business automation.