Metrics for assessing retrieval quality in LLM-based RAG
The retrieval component plays a crucial role in the overall performance of a RAG system. It is responsible for providing the LLM with relevant and accurate information that serves as the basis for generating a response. Therefore, assessing the quality of the retrieval component is a vital aspect of RAG evaluation. We can adapt traditional information retrieval metrics to the RAG setting, focusing on the ability of the retriever to find documents that are not only relevant to the query but also useful for the LLM to generate a high-quality answer.
Recall@k
Recall@k measures the proportion of relevant documents that are successfully retrieved within the top k results. In the context of RAG, we can define a relevant document as one that contains the necessary information to answer the query accurately:
- Formula: Recall@k = (Number of relevant documents retrieved in top k) / (Total number of relevant documents) ...