What is RAG?
RAG stands for retrieval-augmented generation. It is an architecture that retrieves relevant material from an external collection and supplies that material to a generative model when answering a request. The model’s response can then use selected evidence rather than rely solely on patterns learned during training.
By Ai Flowi · Published
Retrieval and generation are separate operations. A system can find a passage and still produce an unsupported answer, or generate polished text after retrieving the wrong passage. RAG therefore needs checks on both the evidence selected and the claims made from it.
The retrieval-plus-generation architecture
Preparation makes source content searchable. Depending on the design, that can involve splitting documents into passages, preserving metadata and generating representations for an index. This is different from the answering path, which uses a question to retrieve candidates from the prepared collection.
At request time, retrieval selects candidate material. Context construction chooses which candidates to send to the model and how to label them. Generation produces an answer under the task instructions. A later check compares the answer with the supplied evidence and the user’s actual question.
Preparation: source documents → searchable collection
Answering: question → retrieval → selected source passages
→ labelled model context → generated answer
→ evidence and applicability review
The arrows identify architectural responsibilities rather than a verified wiring recipe; use the knowledge-base guide for ingestion and the knowledge-base chatbot guide for the table-to-answer implementation.
An invented policy-answering example
Assume a fictional workshop policy says visitors may use the workspace after induction, and that the equipment cage is staff-only. A visitor asks whether completing induction allows cage access. The relevant evidence includes both the general workspace permission and the narrower cage restriction.
| Stage | Expected material | Possible defect |
|---|---|---|
| Retrieval | The visitor-access policy and equipment-cage restriction. | Only the general permission is found. |
| Context construction | Both passages with their source identity and scope. | The restriction is dropped to shorten the prompt. |
| Generation | An answer distinguishing workspace access from cage access. | The model broadens induction permission to every area. |
| Review | Each access claim compared with its supporting passage. | A citation is accepted without checking what it supports. |
The authored target denies the inference that induction alone grants cage access. It is not a recorded answer. The illustration shows why a relevant document title is insufficient: the answer needs the qualification within the document.
What is the difference between model-only answers, fixed RAG and agentic retrieval?
A model-only answer uses the provided request without a separate external retrieval stage. That may suit drafting from supplied text, but it does not establish access to a changing internal policy. A fixed RAG design follows a predefined retrieval and answer sequence.
Agentic retrieval allows a model-guided process to decide when to search, refine a query or request another observation within the application’s controls. It adds decision points rather than automatically making evidence more reliable. Tool permissions, stopping conditions and source selection still need explicit treatment.
The Agent component describes a tool-capable interface, but its presence does not prove a working agentic RAG system. For a glossary definition, the distinction is about who determines the retrieval sequence, not a claim that a particular combined runtime has passed.
Related: RAG Chunking Strategy; RAG Reranking.
The collection is a separate source of change
See fine-tuning for the comparison between trained parameters and retrieved context.
For the workshop architecture, the operational question is which handbook revision the answering path can reach. The handbook, prepared collection and answering request are separate artifacts. Replacing the handbook does not establish that preparation finished, that retrieval used the intended collection or that the amended passage entered this request.
That separation also defines the handoff between preparation and answering. The preparation side needs to identify the revision it made searchable; the answering side needs to identify the revision it consumed. A failure between those responsibilities can persist even when each side produces a plausible-looking artifact. Keep that handoff visible when assigning the repair, rather than treating the whole design as one opaque model call.
Where the catalogue exposes RAG stages
The Knowledge Base guide documents the retrieval setup used at the first answering stage.
Use the Prompt Template reference for request assembly and the Language Model reference for generation configuration.
For the workshop question, retain three inspectable artifacts: the retrieval result, the exact selected context and the answer. If the cage restriction is present in retrieval but absent from the selected context, revising the search query targets the wrong stage. If it appears in both artifacts but the answer grants cage access, the repair belongs after selection.
Replay a stage with a fixed input when diagnosing a failure. Supply the complete authored evidence packet to the answering step to ask whether generation respects the restriction. Separately inspect retrieval for the same access question. These checks isolate two dependencies that a polished end-to-end demonstration can hide; they are proposed checks, with no run reported here.
A changed source needs a corresponding preparation and retrieval check. Suppose the fictional handbook is amended so induction no longer permits workshop attendance. An answer based on the old passage may follow its context faithfully while being obsolete. Verify the searchable collection’s version before blaming the answer instruction or assuming that a document upload reached the answering path.
documented in the catalogue; not production-tested by Ai Flowi
The catalogue index identifies these stages; the linked Language Model reference covers the provider account/API key you supply and separately billed generation.
RAG evaluation and failure boundaries
Use RAG evaluation for the question corpus, passage labels and retrieval-versus-answer assessment procedure.
The evidence packet should include only material available for this request; context engineering covers selection and trust boundaries.
A larger result set can add irrelevant workshop notices without restoring a missed restriction. Review whether the decisive passage was found, not just whether retrieval produced rows. If the question is about a policy exception absent from the handbook, retrieving more general policy text does not make the exception answerable.
If the original workshop handbook permits attendance after induction but its amendment withdraws that permission, the two versions cannot be merged into one access rule. The request must identify which revision governs the visitor’s question. If that choice is unavailable, the architectural output is an unresolved source-version decision, rather than a permission inferred from whichever passage ranked first.
Related concepts
Context engineering covers evidence selection and context budgeting. Prompt engineering covers the answer instruction. LLM grounding covers claim support, while LLM hallucination describes unsupported or fabricated output. Retrieving a source is a useful stage, but the answer must still be assessed against it.
Further reading
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.