Learn how to build and use advanced RAG techniques with R2R
R2R supports advanced Retrieval-Augmented Generation (RAG) techniques that can be easily configured at runtime. This flexibility allows you to experiment with different SoTA strategies and optimize your RAG pipeline for specific use cases. This cookbook will cover toggling between vanilla RAG, HyDE and RAG-Fusion..
Advanced RAG techniques are still a beta feature in R2R. They are not currently supported in agentic workflows and there may be limitations in observability and analytics when implementing them.
Are we missing an important RAG technique? If so, then please let us know at founders@sciphi.ai.
R2R is designed from the ground up to make it easy to implement advanced RAG techniques. Its modular architecture, based on orchestrated pipes and pipelines, allows for easy customization and extension. A generic implementation diagram of the system is shown below:
R2R currently supports two advanced RAG techniques:
You can specify which advanced RAG technique to use by setting the search_strategy
parameter in your vector search settings. Below is a comprehensive overview of techniques supported by R2R.
HyDE is an innovative approach that supercharges dense retrieval, especially in zero-shot scenarios. Here’s how it works:
The diagram which follows below illustrates the HyDE flow which fits neatly into the schema of our diagram above (note, the GraphRAG workflow is omitted for brevity):
RAG-Fusion is an advanced technique that combines Retrieval-Augmented Generation (RAG) with Reciprocal Rank Fusion (RRF) to improve the quality and relevance of retrieved information. Here’s how it works:
This approach helps to capture a broader context and potentially more relevant information compared to traditional RAG.
Here’s a diagram illustrating the RAG-Fusion workflow (again, we omit the GraphRAG pipeline for brevity):
You can readily combine these advanced techniques with other search and RAG settings:
While R2R allows for runtime configuration of these advanced techniques, it’s worth noting that server-side defaults can also be modified for consistent behavior across your application. This includes the ability to update and customize prompts used for techniques like HyDE and RAG-Fusion.
Prompts play a crucial role in shaping the behavior of these advanced RAG techniques. By modifying the HyDE and RAG-Fusion prompts, you can fine-tune the query expansion and retrieval processes to better suit your specific use case or domain.
Currently, these advanced techniques use a hard-coded multi-search configuration in the MultiSearchPipe
:
This configuration will be made user-configurable in the near future, allowing for even greater flexibility in customizing these advanced RAG techniques.
By leveraging these advanced RAG techniques and customizing their underlying prompts, you can significantly enhance the quality and relevance of your retrieval and generation processes. Experiment with different strategies, settings, and prompt variations to find the optimal configuration for your specific use case. The flexibility of R2R allows you to iteratively improve your system’s performance and adapt to changing requirements.
Learn how to build and use advanced RAG techniques with R2R
R2R supports advanced Retrieval-Augmented Generation (RAG) techniques that can be easily configured at runtime. This flexibility allows you to experiment with different SoTA strategies and optimize your RAG pipeline for specific use cases. This cookbook will cover toggling between vanilla RAG, HyDE and RAG-Fusion..
Advanced RAG techniques are still a beta feature in R2R. They are not currently supported in agentic workflows and there may be limitations in observability and analytics when implementing them.
Are we missing an important RAG technique? If so, then please let us know at founders@sciphi.ai.
R2R is designed from the ground up to make it easy to implement advanced RAG techniques. Its modular architecture, based on orchestrated pipes and pipelines, allows for easy customization and extension. A generic implementation diagram of the system is shown below:
R2R currently supports two advanced RAG techniques:
You can specify which advanced RAG technique to use by setting the search_strategy
parameter in your vector search settings. Below is a comprehensive overview of techniques supported by R2R.
HyDE is an innovative approach that supercharges dense retrieval, especially in zero-shot scenarios. Here’s how it works:
The diagram which follows below illustrates the HyDE flow which fits neatly into the schema of our diagram above (note, the GraphRAG workflow is omitted for brevity):
RAG-Fusion is an advanced technique that combines Retrieval-Augmented Generation (RAG) with Reciprocal Rank Fusion (RRF) to improve the quality and relevance of retrieved information. Here’s how it works:
This approach helps to capture a broader context and potentially more relevant information compared to traditional RAG.
Here’s a diagram illustrating the RAG-Fusion workflow (again, we omit the GraphRAG pipeline for brevity):
You can readily combine these advanced techniques with other search and RAG settings:
While R2R allows for runtime configuration of these advanced techniques, it’s worth noting that server-side defaults can also be modified for consistent behavior across your application. This includes the ability to update and customize prompts used for techniques like HyDE and RAG-Fusion.
Prompts play a crucial role in shaping the behavior of these advanced RAG techniques. By modifying the HyDE and RAG-Fusion prompts, you can fine-tune the query expansion and retrieval processes to better suit your specific use case or domain.
Currently, these advanced techniques use a hard-coded multi-search configuration in the MultiSearchPipe
:
This configuration will be made user-configurable in the near future, allowing for even greater flexibility in customizing these advanced RAG techniques.
By leveraging these advanced RAG techniques and customizing their underlying prompts, you can significantly enhance the quality and relevance of your retrieval and generation processes. Experiment with different strategies, settings, and prompt variations to find the optimal configuration for your specific use case. The flexibility of R2R allows you to iteratively improve your system’s performance and adapt to changing requirements.