liveBook · Manning

Retriever

As explained in Build an Advanced RAG Application (From Scratch)

A software system that retrieves and ranks information in response to user queries, commonly using lexical or exact-term matching.

A retriever is the search component that finds and ranks information relevant to a user query. It relies on indexed content for fast lookup across a growing corpus, returning documents or passages ordered by relevance rather than generating an answer itself. section 3.0 section 5.3.1

In a RAG pipeline, the retriever acts as a knowledge retriever between query processing and generation. Its selected context gives a decoder factual, domain-specific material to use when composing a response, helping ground output in external information. section 6.1

A practical semantic retriever can be built as a short pipeline:

  • Collect a knowledge base, such as hotel reviews, and select the documents to search. section 6.1
  • Encode documents into embeddings, normalize them, and add them to a FAISS inner-product index. section 6.1
  • Encode and normalize the query, search for the top K nearest entries, then return ranks, text, and similarity scores. section 6.1
  • Pass the retrieved results as context to a decoder when an end-user answer is needed. section 6.1

Hotel-view retrieval

For the query “Hotel with a view of the Eiffel tower,” a semantic search over Paris hotel reviews ranks reviews for Pullman Paris Eiffel Tower Hotel at the top and exposes their cosine-similarity scores. Those ranked reviews can then become cited context for an answer about suitable hotels. section 6.1

Retriever quality is evaluated separately from generation quality. Precision@K measures noise among top results; recall measures coverage of relevant documents; MRR emphasizes the first relevant result; NDCG weighs relevance by rank; and context relevance asks whether retrieved material can answer the query. section 6.5.1

Figure 6.1 Architecture of a Retrieval Augmented Generation (RAG) system showcasing the integration of retrieval and generative components for enhanced natural language processing tasks.

Use the RAG architecture diagram to locate the retriever between the knowledge base and the context supplied to the decoder. section 6.1

How Build an Advanced RAG Application (From Scratch) covers it

How deep it goes
Walks through embedding, normalization, FAISS indexing, top-K search, and component-level retrieval metrics.
Examples
Uses Paris hotel reviews, an Eiffel Tower view query, ranked similarity results, and a generated hotel recommendation.
What it assumes
Builds on transformer encoder, self-attention, positional encoding, and multi-head attention concepts.
What you can do after
Apply it via SentenceTransformer and FAISS to rank corpus entries and provide context for a generated answer.
How it connects
Connects information retrieval, semantic search, document embeddings, FAISS, RAG, decoder models, and retrieval evaluation.

Also explained in

Compare how 6 books explain Retriever →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build an Advanced RAG Application (From Scratch). The section links point to the parts of the book it draws on.