[JEAST 2023] Optimizing RAG: Hybrid Search and Contextual Chunking – The Cure for LLM Hallucinations

Optimizing RAG with Hybrid Search and Contextual Chunking

Summary
Problem
Method
Results
Takeaways

This paper introduces an optimized Retrieval-Augmented Generation (RAG) framework that integrates Hybrid Search (combining BM25 and Dense Vector search) with Contextual Chunking. The method employs Reciprocal Rank Fusion (RRF) and dynamic Markdown-based partitioning to achieve a significant boost in retrieval accuracy, converting "near misses" into successful context extractions.

TL;DR

Retrieval-Augmented Generation (RAG) is the industry standard for grounding LLMs in proprietary data, but it often fails due to poor retrieval precision. This paper addresses the "Retriever Bottleneck" by fusing BM25 keyword search with Dense Vector search and replacing naive text splitting with Contextual Chunking. The result is a 4% absolute increase in retrieval success and the total elimination of "near-miss" errors in their benchmark.

The "Semantic Gap" and Naive Splitting

In many enterprise AI deployments, developers rely solely on Vector Search. While excellent at capturing "intent," vector embeddings often wash out specific entities like product IDs, acronyms (e.g., "SOP," "KVI"), or rare names. This leads to the "Bank of America" vs. "River Bank" dilemma: vector space might cluster them too closely or miss the lexical nuance entirely.

Furthermore, the common practice of Character-Level Splitting acts as a "meat grinder" for data—chopping sentences in half and separating headers from their supporting tables, leaving the LLM with fragments that lack context.

Methodology: The Two Pillars of Optimization

1. Hybrid Search & Reciprocal Rank Fusion (RRF)

The authors introduce a weighted scoring mechanism to combine the best of both worlds:

  • Sparse Embeddings (BM25): Handles exact keyword matching and term frequency saturation.
  • Dense Embeddings (Vector): Handles semantic relationships and "fuzzy" matching.

The fusion is governed by a hyperparameter :

Hybrid Search Implementation

2. Contextual & Recursive Chunking

Instead of fixed windows, the paper advocates for:

  • Markdown-Aware Splitting: Dividing content based on # H1, ## H2 headers to ensure subsections stay together.
  • Table and Image Handling: Using Vision Language Models (VLM) for images and ensuring table headers are replicated across chunked rows to keep data interpretable.

Experimental Battlefront: Vectors vs. Hybrid

The study compared pure vector search (using OpenAI's ADA model) against a Hybrid setup.

MethodSuccess (Top 5)Near Miss (Top 6-10)
Pure Vector Search67%7%
Hybrid Search ()71%0%

The "Near Miss" category is crucial. By moving results from the top 10 into the top 5, the system ensures the LLM actually "sees" the answer within its limited context window.

Performance Comparison

Critical Insight: Why This Matters

The most profound takeaway is that Search is not a solved problem for AI. While LLMs are flashy, they are only as good as the documents we provide them. The move toward "Hybrid" search signifies a return to classical Information Retrieval (IR) wisdom, updated for the era of embeddings.

Limitations: The paper focuses on . In practice, the optimal balance between keyword and semantic search often shifts depending on whether the query is "fact-seeking" (keyword heavy) or "concept-seeking" (semantic heavy). Future work should explore dynamic adjustment.

Conclusion

By treating the "Retriever" with the same level of complexity as the "Generator," this research provides a roadmap for building more reliable, enterprise-ready AI. If your RAG system is hallucinating, don't just upgrade the LLM—fix your search and your chunking.

Find Similar Papers

Try Our Examples

  • Search for recent papers on advanced Reciprocal Rank Fusion (RRF) variants that dynamically adjust weights based on query intent.
  • Which original study established the BM25 algorithm, and how have modern "Neural BM25" approaches integrated it with Transformers?
  • Explore research applying Contextual Chunking and Vision Language Models to multi-modal RAG systems for technical manual processing.
Contents
[JEAST 2023] Optimizing RAG: Hybrid Search and Contextual Chunking – The Cure for LLM Hallucinations
1. TL;DR
2. The "Semantic Gap" and Naive Splitting
3. Methodology: The Two Pillars of Optimization
3.1. 1. Hybrid Search & Reciprocal Rank Fusion (RRF)
3.2. 2. Contextual & Recursive Chunking
4. Experimental Battlefront: Vectors vs. Hybrid
5. Critical Insight: Why This Matters
6. Conclusion