RAG Recall V/s Precision
Imagine youβre asking your school librarian for books about World War II. Whether they bring you all the right books (recall) or only the useful ones (precision) makes a huge difference in how well you study.
Now replace the librarian with an AI system β thatβs what happens in RAG (Retrieval-Augmented Generation).
π Table of Contents
- π The Librarian Analogy
- π What is Recall in RAG?
- π― What is Precision in RAG?
- π Real-World RAG Example
- π Side-by-Side Comparison
- π Key Takeaways
π The Librarian Analogy
- Recall = Did the librarian bring all the right books?
- Precision = Did the librarian avoid bringing irrelevant books?
Same idea applies to AI when it searches documents before answering your question.
π What is Recall in RAG?
In RAG, Recall means: β‘οΈ Out of all the useful documents in the knowledge base, how many did the AI manage to retrieve?
- High recall = AI fetched all the key documents.
- Low recall = AI missed something important.
π― What is Precision in RAG?
In RAG, Precision means: β‘οΈ Out of all the documents the AI retrieved, how many were actually useful for answering the question?
- High precision = AI brought only relevant information.
- Low precision = AI added a lot of noise (irrelevant text).
π Real-World RAG Example
Letβs say a student asks an AI tutor:
βHow many articles are there in the Selenium WebDriver Python course?β
-
The AI looks into its knowledge base.
-
It retrieves 3 documents:
- Document A: Course overview with 23 articles β
- Document B: Introduction to Selenium β
- Document C: Blog post about Python β
Evaluation:
- Recall π: The answer (23 articles) was found β recall is good.
- Precision π―: Only 2 out of 3 were helpful β precision is lower.
π Side-by-Side Comparison
π§© Concept | π High Value Means | π Low Value Means | π Librarian Example | π€ RAG Example |
---|---|---|---|---|
Context Recall π | You got all the important material. | You missed some key material. | Librarian brought all the World War II books. | AI retrieved the doc that contains 23 articles. |
Context Precision π― | You got only the useful material. | You got too much irrelevant stuff. | Librarian brought 10 books, but only 2 are about World War II. | AI retrieved 3 docs, but 1 was irrelevant. |
π Key Takeaways
- Recall = Donβt miss important info.
- Precision = Donβt include irrelevant info.
- In RAG, the best systems balance both β fetch all the right documents, and only the right ones.
π¬ If you had to choose, would you prefer your AI assistant to bring everything (high recall) or only the best (high precision)?