RedLectern topic

Retrieval-augmented generation

Retrieve external information for generation · ingestion · grounding · citations · failure modes.

For: Builders · knowledgeable users.

After this page you can: Design a basic RAG workflow and identify its failure points.

Page reviewed

Part of: Artificial Intelligence

About Retrieval-augmented generation

Retrieval-augmented generation (RAG) combines a generative model with a separate information retrieval system. For a query, the system selects information from a collection and supplies it as context for an answer. This makes the collection a part of the answer process; it does not establish that the retrieved material is complete, current, or correct.

A basic workflow has two paths. During ingestion, collect source material, extract and split it into pieces, preserve source and access metadata, and make it searchable. At query time, retrieve candidate pieces, optionally rerank them, give selected evidence and the user’s question to a generator, then check the answer and its citations. Test each stage separately: retrieval can miss useful evidence, an answer can stray beyond the context, a cited source can fail to support a claim, and access controls can expose material to the wrong user.

Start here

route

Start with the RAG workflow

Read the short overview, then sketch the ingestion and query paths for a small document collection.

Start with: Retrieval-Augmented Generation (RAG) agent

Learn the foundations

1.The retrieval and answer pipelineRAG adds retrieved material to a generation request: the user’s question is used to find candidate documents, and selected material is passed along with the qu…

RAG adds retrieved material to a generation request: the user’s question is used to find candidate documents, and selected material is passed along with the question to a generator. The retrieval system may use different indexes and search methods; semantic search is one option, not the definition of RAG. A reranker can reorder candidates before selection.

Grounding means relating an answer to supplied evidence. Faithfulness asks whether the answer’s claims are supported by that context. A citation points readers to a source meant to support a claim, but the presence of a citation alone does not show that the source supports it. Keep the source identity and location attached to retrieved passages so claims can be checked.

Retrieval-augmented generation

Generating an answer using information retrieved from an external collection.

Grounding

Connecting an output to supplied evidence or observations.

Chunking

Splitting source material into pieces for processing or retrieval.

Retriever

A component selecting potentially relevant information for a query.

Reranker

A component reordering retrieved candidates by a relevance score.

Citation

A reference to a source intended to support a statement.

Faithfulness

How well an answer stays supported by its supplied context.

Try it

A query returns three passages. One is relevant but outdated, one is current but unrelated, and one is relevant and current. Which should you pass to generation, and what source details should you preserve?

Select the relevant, current passage and preserve its source identity and location so the generated claims can be checked against it.

2.Prepare a searchable collectionIngestion turns source material into records that a query-time system can search.

Ingestion turns source material into records that a query-time system can search. A basic path loads documents, extracts usable text, splits it into chunks, converts or indexes the chunks for search, and retains metadata that points back to the original source. Chunk boundaries affect what evidence is available together: splitting too coarsely can add irrelevant material, while splitting too narrowly can separate facts from needed context.

Treat ingestion as a maintained data pipeline. Decide which sources are in scope, how updates and deletions propagate, and which users may retrieve each item. Preserve useful fields such as document identity, location, version or update time, and access information. The downstream workflow can only retrieve evidence that entered the collection and remains searchable.

  • Component architecture

    Maps document loaders and splitters to ingestion, then embeddings, storage, retrieval, and generation.

Try it

Choose one document collection for a prototype. Name two metadata fields you would preserve so a retrieved passage can be traced to its source and filtered for access.

A reasonable answer includes a stable document ID and a source location, plus an access field or user/group permission that can be checked before returning a passage.

3.Find and test failure pointsRAG can reduce unsupported guessing by supplying external evidence, but it does not guarantee a correct answer.

RAG can reduce unsupported guessing by supplying external evidence, but it does not guarantee a correct answer. Inspect distinct failure points: retrieval quality (did the system find useful evidence?), answer faithfulness (does each claim follow from the supplied context?), factual correctness (is the evidence itself reliable?), citation support (does each reference substantiate the linked claim?), and permissions (could this user retrieve every returned passage?). A citation can be present and still fail to support a claim.

Build a small evaluation set of real questions with expected evidence and access conditions. Check retrieval before generation, then review answers claim by claim against both retrieved passages and source documents. Track failures by stage so a retrieval miss is not mistaken for a generation error, and test that restricted records stay unavailable to unauthorized users. Re-run checks when the source collection or retrieval configuration changes.

Try it

An answer cites a retrieved paragraph, but the paragraph supports only two of its three claims. Name the failure and one check that would catch it.

Citation support failed for the unsupported claim. Check each answer claim against its cited passage, and verify the passage against the original source.

Explore subtopics

Latest

No recent updates are available.

See the sources list

Books

Glossary

7 terms on this page.

Browse the AI glossary

Questions and comments