← Learn AI
C_000079 · llms and generative ai · advanced

Context Precision and Recall

Retrieval metrics for RAG: precision measures how much retrieved context was relevant, recall whether the needed context was retrieved at all.

Step 1 of 5

In words

What it is, why it matters, and what it is like.

Why am I learning this?

This concept gives you the two numbers that tell you whether your system for fetching documents is actually finding the right evidence for your AI assistant. Without these, you are flying blind — you cannot tell if a bad answer came from poor document retrieval or from flaws in the writing process itself. Mastering this lets you diagnose and fix retrieval problems, which is the first step toward building reliable AI systems that answer from your documents, not from guesswork. This unlocks further study in components like reordering fetched results, searching by both keywords and meaning, and using automated agents to find more data — all of which are about improving accuracy or completeness.

The idea, in plain terms

Imagine you ask an AI assistant a question, and it goes to a library to find the answer before responding. The library returns a stack of books, but you want to know: Did it give me the right books, and did it miss any important ones? Accuracy and completeness are exactly these two questions, measured with numbers. Accuracy: Of all the books it gave me, how many were actually relevant? Completeness: Of all the books that were relevant in the whole library, how many did it actually give me? High accuracy means no junk — every book it pulled is on-topic. High completeness means no misses — every book that had the answer was pulled. Most real systems trade one off against the other: if you pull only one book, accuracy might be high but completeness low; if you pull fifty, completeness goes up but accuracy drops. In AI document retrieval, we measure these on the snippets of text that get inserted into the model's context before it writes an answer.

An analogy

Here is a richer analogy to carry through. Suppose you are a detective looking for clues about a crime. You have a file cabinet (the collection of all documents). You send your assistant to pull files. Accuracy: Of the files pulled, how many actually contain relevant clues? Completeness: Of all files in the cabinet that contain relevant clues, how many did the assistant bring back? If the assistant brings back 10 files but only 3 have relevant clues, accuracy is 30%. If there were 20 relevant files in the cabinet but only 3 were brought, completeness is 15%. Now here is the crucial asymmetry: if accuracy is low, you can throw away the irrelevant files — no harm to the investigation, just wasted space. But if completeness is low, you have missed clues entirely — you might never solve the case. That is why the library notes say 'Low completeness is unfixable downstream — the evidence simply is not there.' In AI, low accuracy wastes the model's available space (it gets distracted by irrelevant snippets), but low completeness means the model can only guess or invent facts. The analogy stops when you realise that in retrieval, you do not know the true set of relevant files — you can only estimate it by judging the retrieved set and maybe sampling the rest of the cabinet.

Definition

Context accuracy is the fraction of retrieved text snippets that are relevant to the query; context completeness is the fraction of all relevant text snippets in the entire document collection that were successfully retrieved.

Where this sits

This concept belongs to retrieval evaluation, part of the broader field of locating information in large collections. It connects forward to evaluation frameworks like RAGAS, which break down quality into context accuracy, context completeness, answer relevancy, and answer correctness. It also underlies every technique you will learn later: reordering improves accuracy, searching by both keywords and meaning improves completeness by combining different search methods, automated agents improve completeness through iterative search, and splitting text directly affects both. Your library notes say that retrieval and answer quality are separately measurable and separately fixable — knowing these two numbers lets you fix the right half of a system that retrieves and then generates answers.

Signal from the Frontier

Get the next essay on mind, machine, and meaning

Essays at the intersection of AI, philosophy, and Indian governance. No promotional content.

We'll send a one-click sign-in link to confirm. No password needed.

Views expressed are personal and do not represent the Government of India or the Government of Uttarakhand.