Part II · Chapter 8 of 42

Retrieval and Grounding: How an AI Answer Gets Assembled

Queries, retrieved content, and citations

Retrieval-augmented generation, or RAG, supplies retrieved information to a model before it writes an answer. Retrieval can use web search, a document collection, or another data source. The implementation varies by product.

From question to answer

For a question such as “best CRM for a small consulting firm,” a search-based system may perform the following operations:

  1. Related queries. The product may generate searches about the category, requirements, pricing, or alternatives.
  2. Retrieval. A search or other source returns candidate information.
  3. Passage processing. The system may split documents and assess relevant passages. The implementation can combine several matching methods.
  4. Selection and context limits. The system selects information for the model within the supported input limits.
  5. Generation. The model produces a response from its parameters and supplied context.
  6. Citations. The response or product interface identifies sources associated with claims.

Use these operations to organize an investigation. Tool logs may expose some of them. A finished answer rarely establishes every intermediate step.

Related searches from one prompt

Google documents query fan-out as issuing related searches across subtopics and sources. A single user prompt may therefore produce several search queries. This documented behavior does not establish that every provider follows the same process.Google's AI Mode announcement: "breaking down your question into subtopics and issuing a multitude of queries simultaneously on your behalf."Google's guide to optimizing for AI features, which gives "how to fix a lawn full of weeds" fanning out into herbicide and lawn-care queries as its example.

Related searches can address different parts of the customer’s question, such as price, integrations, or service availability. Cover those subjects when they help the reader. Treat queries suggested by a model as research candidates unless a tool log records them as executed searches.

Retrieved, read, credited: three different events

Separate a page returned by search, content supplied to the model, and a page cited in the answer. These are different observations. A citation list is not a complete retrieval log, and absence from the citation list does not prove that a source was never considered.

Keep separate fields for these events where your tools expose them. Mark unavailable information as unknown. Do not diagnose a missing citation as a passage-quality problem without evidence about the preceding operations.Research sources and limitations. Identifies the available report data and the analysis still needed to support earlier draft figures.

The research behind RAG

The 2020 RAG paper combined retrieval with a generative model. It provides a research foundation for systems that use external documents during generation. Current products may implement retrieval and generation differently.Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (2020), which notes that parametric knowledge alone limits models on knowledge-intensive tasks.

Make essential information available in readable text and keep qualifications attached to each claim. Images, tables, and layout can also carry meaning, particularly in multimodal systems. Check what the relevant retrieval tool actually returns before deciding which page element needs work.

Follow one request without inventing missing steps

Suppose a buyer asks for weekend HVAC service in central Phoenix. A search-enabled system may issue a local-service query, receive result extracts, open selected pages, and use the returned information in an answer. That is an illustrative sequence. The actual records determine which steps occurred.

Retain each exposed operation: the submitted query, returned URL, opened page, and final citation. If the product exposes only citations, record only those as observed sources. Do not fill the missing query field with a plausible query generated afterward.

OpenAI’s web-search API has documented source and citation fields. Other products expose different records. A system you build from this API is useful for a controlled test, but it does not automatically reproduce ChatGPT’s consumer interface.OpenAI web search guide. Documents tool actions, source lists, and citation annotations for supported API requests.