liveBook · Manning

Retriever

As explained in Retrieval Augmented Generation, The Foundational Ideas

A retriever is a model or system component that searches an indexed collection and returns potentially relevant documents or passages.

A retriever searches an external document index and returns passages that might answer a query. In retrieval-augmented generation (RAG), it supplies evidence to a reader or generator rather than writing the answer itself. If it misses the useful passage—or ranks a lookalike above it—the downstream model may have little chance to answer well. section 1.6 section 3.0

Choose the retrieval objective before choosing the model:

  • For exact terminology and strong query–document vocabulary overlap, start with keyword retrieval such as BM25. It is fast, inexpensive, and avoids some semantic-search ambiguity. section 2.1.6
  • For conversational queries that use different wording from the documents, consider semantic retrieval. A dense encoder maps queries and passages to vectors for similarity search; question-answering benefits from learning which passages answer questions, not merely which sound similar. section 2.1.6 section 3.0
  • Match ranking to the reader. A reader handling few passages needs high precision near the top; Fusion-in-Decoder can work with a recall-oriented top-k set, but extra passages add noise and cost. Measure the useful range rather than assuming more is better. section 5.3.1
Table 3.1 Symmetric search vs asymmetric search
  Feature  
  Symmetric Search  
  Asymmetric Search  
 Goal 
 Find similar text (twins) 
 Find answers to questions 
 Input 
 Similar length/structure 
 Short query vs. Long doc 
 Model 
 SBERT 
 DPR 
 Use Case 
 Paraphrase detection 
 Open Domain QA 

The comparison distinguishes symmetric similarity search from asymmetric question-to-answer-passage retrieval—the distinction that matters when a short question must find evidence in a longer document. section 3.1

Indexing and querying are separate decisions. The document encoder produces vectors for the searchable corpus; at query time, the query encoder produces a vector and the retriever ranks candidates. In canonical RAG, DPR’s document encoder and prebuilt index stay fixed while its query encoder is fine-tuned with the BART generator. Keeping the index external also allows knowledge to be refreshed by changing indexed documents rather than retraining the generator, though retrieval adds an inference step. section 4.1 section 6.1

A ranking failure in financial search

An analyst asks why operating margins declined. A sentence repeating the company, quarter, and margin figures ranks above the passage explaining the cause. Both are indexed, so widening top-k exposes the answer, but does not fix the ordering. This is a reason to evaluate answer-bearing rank—not just whether the document exists in the corpus. section 6.7

Training can target that failure directly. REALM jointly trains a retriever and language model so useful evidence improves the language-model objective; its retriever still performs vector search, but training changes the encoder weights and thus the ranking. Atlas likewise uses reader performance to favor useful documents. These approaches offer stronger alignment than a static similarity retriever, at greater training complexity; a pretrained, modular retriever remains a practical baseline. section 3.0 section 3.2 section 6.8

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Explains sparse and dense selection, encoder-based ranking, joint training objectives, and precision–recall tradeoffs; REALM code is examined rather than run.
Examples
Uses a financial-document ranking failure, a symmetric-versus-asymmetric search comparison, and code scoring candidate document vectors.
What it assumes
Assumes familiarity with queries, documents, and model pipelines while explaining sparse retrieval and retriever–reader roles.
What you can do after
Evaluate/understand it by choosing keyword or semantic retrieval, checking answer-bearing ranks, and balancing top-k recall against noise.
How it connects
Connects retrieval to BM25, dense passage retrieval, vector indexes, readers, generators, and Fusion-in-Decoder.

Also explained in

Compare how 6 books explain Retriever →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.