Retrieval Augmented Generation (RAG) represents a groundbreaking approach in information retrieval, where the accuracy of search results directly influences the quality of generated answers. In essence, RAG combines traditional search mechanisms with the Large Language Model's ability to understand and generate answers. Search accuracy becomes particularly significant when considering that the answers generated by RAG are only as accurate as the documents it retrieves.
In this article, we will explore how we improve search accuracy for RAG applications from 65% using basic text search to over 90%.
Our initial setup for testing and improving accuracy involved several key components:
This foundational structure was essential for our subsequent enhancements.
The initial approach was basic text search, a straightforward method:
Though basic text search was a good starting point, it was clear that more sophisticated methods were needed.
To improve upon basic text search, we introduced a Search Term Expansion with the following approach:
Integrating Search Term Expansion was a key move in bridging the gap between simple queries and the complex content within our documents.
While text search is great for finding an initial set of documents, it often lacks a contextual understanding of the questions. As a result, the relevancy score - typically ranked using BM25 or RRF methods for text-based searches - of the resulting documents is often not accurate.
To solve this, we have enabled the Semantic Ranking feature in Cognitive Search, which uses natural language understanding to analyze the initial set of documents returned from the search and then re-ranks them based on its own natural language understanding capability.
The last refinement involved adding sample questions to documents:
In addition to the features that enhanced our search accuracy, we evaluated other functionalities but ultimately chose not to implement them. This includes
Our efforts to boost RAG's search result accuracy from 65% to 90% were marked by innovation and learning.
Through exploring various methods and understanding their trade-offs, we achieved a balance that significantly enhances the precision and efficiency of information retrieval. This journey highlights a significant step forward in search technology and its application in the business world.
Consult with our experts at Amity Solutions for additional information on Improving RAG Search Accuracy here