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

  1. πŸ“š The Librarian Analogy
  2. πŸ”Ž What is Recall in RAG?
  3. 🎯 What is Precision in RAG?
  4. 🌍 Real-World RAG Example
  5. πŸ“Š Side-by-Side Comparison
  6. πŸ“Œ 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?”

  1. The AI looks into its knowledge base.

  2. 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)?