liveBook · Manning

Retrieve-and-read

As explained in AI-Powered Search

A retriever-reader pattern is a question-answering architecture that retrieves relevant content and then uses a reader component to derive an answer from it.

A retrieve-and-read system answers questions by first finding likely source documents, then reading their text to extract the answer. The retriever uses search to rank candidate documents; the reader identifies the most likely answer span within them. section 14.1 section 14.1.2

A typical extractive question-answering pipeline proceeds as follows:

  • Send the question to a search engine and retrieve ranked candidate documents. section 14.1.2
  • Run the reader over the most relevant contexts and score possible answer beginnings and endings. section 14.6
  • Rerank answers using reader confidence; repeated answers across contexts can provide an additional correctness signal. section 14.5.4

Minimalist shoes

For “What are minimalist shoes?”, the retriever finds a relevant document. The reader extracts “shoes intended to closely approximate barefoot running conditions” rather than returning the entire document. section 14.1.2

Listing 14.18 QA function combining retriever, reader, and reranker
def ask(question):
  documents = retriever(question)
  answers = reader(documents)
  reranked = reranker(answers)
  print_answer(question, reranked)

ask('What is the best mosquito repellent?')
ask('How many miles can a person hike day?')
ask('How much water does a person need per day?')

The implementation separates retrieval, reading, reranking, and answer display in a compact Python QA function. section 14.5.4

How AI-Powered Search covers it

How deep it goes
Explains retrieval, span extraction, confidence reranking, and training-data preparation, but defers abstractive generation.
Examples
Uses minimalist-shoe questions and practical queries about mosquito repellent, hiking distance, and daily water needs.
What it assumes
Assumes search-based document retrieval and introduces reader models, silver data, golden data, and validation splits.
What you can do after
Builds an end-to-end QA pipeline by combining a search retriever, reader model, and reranker.
How it connects
Connects search engines with extractive question answering, highlighting, reader models, reranking, and fine-tuning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.