liveBook · Manning

Retrieval index

As explained in Generative AI in Action

A document index is a data structure that organizes documents or their representations to support efficient information retrieval.

A retrieval index organizes documents or document representations so a retriever can efficiently find relevant context for downstream language generation. In retrieval-augmented generation (RAG), it connects an external knowledge source to a language model without changing the model’s initial prompt. section 7.1 section 7.3

A dense retrieval index typically supports this workflow:

  • Encode the input question or statement into a query vector. section 7.3
  • Store documents as pre-encoded vectors in a precompiled document index. section 7.3
  • Search the index with maximum inner product search (MIPS) to identify documents most similar to the query. section 7.3
  • Pass relevant retrieved documents to the language model as context for answering questions, verifying facts, or generating questions. section 7.3

Enterprise knowledge assistant

An organization can index private knowledge sources and retrieve current, relevant documents before generating an answer. The index must be curated and regularly updated because outdated or irrelevant documents produce poor responses. section 7.1 section 7.6

Figure 7.1 RAG architecture overview
figure

Use the RAG architecture overview to trace how the retriever connects the index with the generative model. section 7.1

Production indexing requires attention to scalability, storage and compute costs, retrieval speed, parallel requests, retries, governance, interoperability, and troubleshooting across retrieval and generation. section 7.6

How Generative AI in Action covers it

How deep it goes
Explains vector encoding, MIPS retrieval, contextual generation, and marginalization, but omits detailed implementation procedures.
Examples
Uses pre-encoded document vectors, private knowledge sources, search engines, and MIPS over a precompiled document index.
What it assumes
Assumes familiarity with language models and vectors while explaining query encoding, document encoding, and retrieval from first principles.
What you can do after
Operate/configure a retrieval component that supplies relevant indexed documents to a generative language model.
How it connects
Ties retrieval indexes to RAG, information retrieval, dense retrieval, vector search, language models, and prompt engineering.

Related concepts

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