← the late compiler
C_000329 · llms and generative ai · foundation

Retrieval Quality

Measuring the retrieval stage independently of generation, so you know which half of a RAG system is failing.

Step 1 of 4

In words

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

Why am I learning this?

When a RAG system gives a wrong answer, you need to know which half is at fault: the retriever or the generator. Measuring retrieval quality separately tells you exactly that. If recall at k is low, the evidence was never found, and no generator can fix it. If precision is low, the retrieved context is cluttered, wasting the model's attention. By mastering this, you can diagnose and fix RAG pipelines systematically, rather than guessing. This unlocks further study in hallucination mitigation, agentic retrieval, and reranking.

The idea, in plain terms

Think of a RAG system as a two-person team: a librarian who fetches documents and a writer who drafts the answer. If the librarian does a poor job, the writer has nothing good to work with. But how do you know whose fault the bad answer is? Retrieval quality measures the librarian's work alone, before the writer touches it. You look at the documents the librarian brought and ask two questions: Did they bring the right ones? And did they miss any essential ones? That gives you two numbers: precision and recall. Precision is 'of everything brought, how much was actually relevant?' Recall is 'of everything relevant, how much was actually brought?' If recall is low, the librarian left key documents in the archive. No writer can compensate for missing evidence. If precision is low, the librarian dumped a pile of irrelevant papers on the desk, distracting the writer and crowding out the useful ones.

An analogy

Imagine you are searching a library for information to write a report on the history of the Indian space programme. You ask a librarian for help. The librarian returns with a stack of books. Precision asks: of those books, how many are actually about the Indian space programme? If half are about NASA, precision is 50%. Recall asks: of all the books in the library that are about the Indian space programme, how many did the librarian bring? If the library has twenty such books and the librarian brought five, recall is 25%. The analogy holds well in retrieval: you always have a fixed set of documents to search, and you retrieve a subset. The total relevant set is usually unknown, but in experiments it is known, so recall is computable. Where the analogy breaks down: in a real library, the librarian can be asked follow-up questions, but in basic RAG, retrieval is a single step. Also, relevance is not binary here — some documents are more useful than others, whereas the library analogy suggests a clean relevant/not-relevant division. This is where metrics like nDCG come in, but for beginners, precision and recall are the starting point.

Definition

Retrieval quality is a measure of how well the retrieval stage of a RAG system selects relevant documents from a corpus, evaluated independently of the generation stage, typically using metrics like precision at k and recall at k.

Where this sits

Nothing yet — this is your first concept. It builds directly on the idea of a retrieval process, which we will define here. Later, you will connect this to chunking (how documents are split changes what can be retrieved), to hybrid search (combining keyword and semantic search to improve retrieval), and to reranking (a second stage that re-orders the retrieved set). It also connects to adjoining topics in your library: context precision and recall, agentic retrieval, and citations — where retrieval quality determines whether an answer can be cited at all. AI Without Mathematics notes that the vector database is the retrieval engine, so retrieval quality is really about how well that engine performs.

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.