tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > RAG Pipelines > Multi-Query RAG - Expanding Retrieval with Query Variants

Multi-Query RAG - Expanding Retrieval with Query Variants

Author: Venkata Sudhakar

Standard RAG retrieves documents using a single query vector, which often misses relevant information when the user phrasing does not closely match the stored document text. Multi-Query RAG solves this by generating multiple semantically different versions of the original query and retrieving documents for each variant. The results are merged and deduplicated before passing to the LLM, significantly improving recall.

For a ShopMax India product knowledge base, a customer asking "how do I claim warranty" might not match documents titled "Product Guarantee Policy" or "After-Sales Service Process". Multi-query generates variants like "warranty claim procedure", "product guarantee process", and "repair or replacement policy" to capture all relevant chunks.

The below example implements Multi-Query RAG using LangChain's MultiQueryRetriever to answer ShopMax India policy questions with higher recall than single-query retrieval.


It gives the following output,

Retrieved 4 unique documents:
- ShopMax warranty: All electronics carry a 1-year manufacturer warranty...
- After-sales service: ShopMax partners with authorised service centres...
- Product guarantee policy: Defective items within 10 days are eligible...
- Extended warranty: ShopMax Premium members can purchase 2-year extended...

Single-query retrieval with the same question typically returns only 2 documents. Multi-Query retrieval found 4 relevant documents by generating variants such as "warranty repair process", "authorised service centre ShopMax", and "product defect claim procedure". The LLM then synthesises a more complete answer from this richer context. Use Multi-Query RAG on any ShopMax knowledge base where document titles and customer language may not align.


 
  


  
bl  br