Context precision and recall
Definition
RAG retrieval metrics: precision is the share of retrieved chunks that are relevant, recall the share of needed facts found.
In more detail
If the retriever returns ten chunks and three matter, precision is low, which wastes context and can distract the model. If the answer needed four facts and only two came back, recall is low and the model cannot answer correctly however good it is. Ragas also weights context precision by rank, rewarding retrievers that put relevant chunks first.
Measure retrieval separately from generation using a golden set of questions with known supporting passages. Recall problems point to chunking, embeddings or query rewriting; precision problems point to reranking and filtering.
Related terms
Faithfulness (RAG metric)
How far an answer's claims are supported by the retrieved context it was given, regardless of whether they are true in general.
Golden dataset
A curated set of inputs with expected outputs or grading notes, used as the fixed reference that your evals are scored against.
Reranking
Re-scoring an initial set of retrieved results with a slower, more accurate model before passing only the best few on to the LLM.
Retrieval-augmented generation (RAG)
Retrieving relevant documents and adding them to the prompt before the model generates an answer from them.
Read more about Context precision and recall
- Ragas
Metrics and test-set generation for evaluating RAG pipelines and agents.
- Evaluate RAG answers with a golden dataset
Set up RAG evaluation with a golden dataset and promptfoo: score retrieval, correctness and grounding for every question, and fail CI when answer quality drops.
- Retrieval-augmented generation
Fetching relevant documents and adding them to a prompt to ground answers.