← Retrieval-augmented generation (RAG)
Lesson 4 of 4
Evaluating RAG
Watch, read the card, then practise. Retrieval metrics · Answer quality
The video for this lesson is being recorded.
Meanwhile, the notes below and the 60-second cards cover the same ideas.
Practise this topicRetrieval metrics
Retrieval metrics check whether the right chunks were found, before you judge the answer.
Remember: If retrieval misses, no prompt can fix the answer.
Answer quality
Answer quality checks two things: is it faithful to the sources, and does it answer the question asked?
Remember: Check both: faithful but off-topic is still a bad answer.
Try the example in Code Lab
relevant, found_in_top5 = 4, 3
print(f"recall@5 {found_in_top5 / relevant:.0%}, precision@5 {found_in_top5 / 5:.0%}")