Search⌘ K
AI Features

Retrieval-Augmented Generation

Learn how retrieval-augmented generation grounds answers in evidence: building a versioned, permission-aware knowledge base offline, retrieving and assembling context online, handling missing, stale, unauthorized, and unsupported answers, and extending the pattern to agents that call tools within strict limits.

Retrieval-augmented generation (RAG) is a design pattern in which the system retrieves supporting documents first and then asks the model to answer from that evidence rather than from memory alone. The model still writes the response, but answer quality depends mostly on whether the system found the right evidence.

A model’s built-in knowledge has three gaps that RAG addresses:

  • Freshness: A model knows only what was in its training data, which stops at a cutoff date. Retrieval brings in documents that changed yesterday.

  • Private knowledge: Internal wikis, tickets, and contracts were never part of the training data.

  • Access control and traceability: Retrieved passages can be filtered by the user’s permissions and cited, so every answer can be checked against its source.

For example, when an employee asks an internal assistant about the current travel reimbursement limit, retrieving this year’s policy produces a correct, cited answer. Relying on model memory could produce last year’s figure, or an invented one.

The illustration below contrasts the two approaches.

Answering from memory vs. from evidence
Answering from memory vs. from evidence

RAG is not always the right tool. When the relevant content is small and already known, such as one product manual, passing it directly in the prompt is simpler. Fine-tuning changes how a model behaves, such as its tone or output format, but it is a poor way to add facts that change often.

In this lesson, we will explore knowledge base design, retrieval workflows, safeguards for generating reliable, grounded answers, and how agents extend RAG into multistep tool use. ...