liveBook · Manning

Corpus

As explained in Generative AI in Action

A corpus is a collection of documents or passages assembled for information retrieval or language processing.

A corpus is a managed collection of documents or passages that a retriever searches for information relevant to a query. In retrieval-augmented generation (RAG), retrieved passages are provided to a generator model so it can produce more specific, current, and reliable responses. section 7.4 section 8.8

Select retrieval behavior according to query characteristics, domain needs, and available resources:

  • Use sparse retrieval with techniques such as TF-IDF and inverted indexes for fast, keyword-dependent search at scale; it may miss synonyms and nuanced phrasing. section 7.4
  • Use dense retrieval to encode queries and documents as vectors, capturing semantic relationships and context; it generally requires more computation and training data. section 7.4

Production corpora require quality control, regular updates, security, privacy protection, access control, testing, documentation, and resource planning. Enterprise teams can align retrieved information with internal policies and industry regulations while retaining control over proprietary data. section 8.4.1 section 8.8

Enterprise RAG corpus

An enterprise can assemble proprietary documents and diverse information sources into a retrieval corpus. RAG then retrieves relevant, up-to-date passages for time-sensitive questions and can provide supporting sources for generated content. section 8.8

Figure 7.3 Custom data on LLMs
figure

Use the custom-data diagram to relate an enterprise corpus to the larger LLM and RAG architecture. section 7.4

How Generative AI in Action covers it

How deep it goes
Explains sparse and dense retrieval mechanisms, trade-offs, selection criteria, and production quality controls.
Examples
Uses proprietary enterprise documents, diverse sources, current information, internal policies, and industry regulations as corpus contents.
What it assumes
Assumes familiarity with RAG, retrievers, queries, documents, and generator models.
What you can do after
Operate/configure a retrieval corpus and choose sparse or dense retrieval according to query, domain, and resource requirements.
How it connects
Connects corpora to RAG, retrievers, sparse retrieval, dense retrieval, TF-IDF, inverted indexes, vectors, and large language models.

Also explained in

Compare how 4 books explain corpus →

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.