AI Hints
Home›RAG Tutorial›Evaluating Retrieval
RAG · Lesson 70 of 120

Why Evaluate RAG

Measure, don't guess.

⏱ 2 min read▶ Video at 1:09:37🎓 Free
Watch this lesson in the RAG courseWatch on YouTube ↗Full RAG course

We've tried many tricks. But did each one really help? Trying a few questions by hand isn't enough. Evaluation measures a RAG system on many questions, so we change it with confidence.

Why Evaluate RAG
From the video: Why Evaluate RAG
  • Many tricks
  • Did they help?
  • Measure, don't guess

What we measure

We measure two halves. Retrieval, did we find the right chunks? And generation, is the answer correct, grounded, and on topic? A bad answer could come from either half, so we measure both.

keyvalue
Retrievalright chunks found?
Faithfulnessgrounded in context?
Relevanceanswers the question?
Correctnessmatches the truth?

The evaluation loop

Build a test set of questions with known answers. Run the system on every question. Score the results. Change one thing. And run the test set again.

  1. Test set
  2. Run all
  3. Score
  4. Change one thing
  5. Repeat
The evaluation loop
From the video: The evaluation loop

Summary

Evaluation measures retrieval and generation on many questions, so every change is checked. Next, building a test set.

Key takeaways
  • Retrieval
  • Generation
  • Measure every change
Next up: A Test Set — questions with answers