Skip to content

Glossary

Retrieval-augmented generation

Retrieval-augmented generation supplies retrieved material to a generative model for a particular response.

Context engineering

Also known as: RAG

Retrieval-augmented generation combines a retrieval step with text generation. Material selected from an external collection is made available to a model as it answers a question, allowing the response to draw on information beyond model parameters. The original formulation by Lewis and colleagues studied a model with parametric and retrieved nonparametric memory. In applied systems, retrieval may use lexical, vector, or structured search; the essential distinction is the use of retrieved context during generation.

The retrieval corpus, indexing choices, access controls, ranking, and passage boundaries shape what the model can see. Evaluation should therefore inspect retrieval coverage as well as answer quality. A generated citation is meaningful only if it identifies a real passage that supports the stated claim. Retrieved material can conflict, be stale, or contain instructions irrelevant to the user's task, so it needs explicit handling rather than automatic deference.

RAG can help an organization answer with inspectable sources, but it does not turn a plausible response into a governed record. A retrieved passage may be authentic yet not applicable on the requested date, or may concern a different entity. Grounding concerns support for the output; faithfulness measures whether the output stays within that support. A system of record additionally needs controlled identity, temporal interpretation, and durable provenance for values used in decisions.

Example

A RAG answer about Halden Therapeutics AG (fictional) retrieves a dated registry notice and cites its relevant passage when describing a status change.

Origin and architecture

The term comes from the 2020 paper by Lewis and colleagues, which combined a pretrained sequence-to-sequence model with a dense vector index of Wikipedia, so that the model could draw on retrieved passages in addition to knowledge held in its parameters. The retriever in that line of work was a dense passage encoder of the kind described in Karpukhin and colleagues. In current practice the pattern is more general: a query is used to fetch relevant material from a corpus, database or search service, and that material is placed in the model's prompt. The survey by Gao and colleagues organises the variants into naive, advanced and modular forms, and covers retrieval, generation and augmentation techniques.

Variants decide when to retrieve and how to use what is found. Self-RAG trains a model to decide on demand whether to retrieve and to critique its own output against the retrieved passages. Other systems retrieve iteratively as the answer develops, or combine retrieval from text with queries to structured stores. These designs are tools for a common goal: to make an answer depend on evidence that can be named.

Where it fails and how to tell

Retrieval reduces some errors and introduces others. The study by Shuster and colleagues found that retrieval reduced hallucination in conversation, and the benchmark by Chen and colleagues shows that models still differ in their robustness to noisy retrieved passages, their willingness to decline when nothing relevant is retrieved, their ability to integrate information across passages and their resistance to counterfactual material. In practice, the common faults are the ones listed in Seven Failure Points: the right passage not in the corpus, not retrieved, not selected, not used, or used wrongly.

A retrieved passage is not automatically true. Poisoned or outdated sources can be retrieved and cited with perfect fluency, which is the subject of the article on poisoned sources and cited facts. Evaluation therefore has to examine the corpus, the retrieval and the answer separately, and to check that cited passages support the statements attributed to them. The article on RAG fault isolation gives a matrix for locating the fault in a failed answer.

A worked example

A user asks whether the study sponsored by Halden Therapeutics AG (fictional) has completed enrolment. The retrieval step searches a corpus of registry entries, press releases and filings, and returns five passages: a registry entry updated in May stating that enrolment is complete, a press release from February expecting completion in May, and three directory pages repeating the February release. Placed in the prompt in that order, the model may favour the volume of the repeated February statements. A better pipeline groups the directory copies with the release they repeat, shows the registry entry first with its date, labels each passage by source type, and instructs the model to prefer primary records and to say if sources conflict. The answer then states that the registry reports completion as of May and cites that passage.

Checks a reviewer can run

Take a sample of questions with known answers and measure retrieval recall, meaning whether a supporting passage was retrieved at all, separately from answer correctness. Check that every cited passage supports its statement. Include questions whose answer is not in the corpus and confirm that the system declines. Include a question whose corpus contains a corrected and an uncorrected version of a source, and check which is used.

Related terms and boundaries

RAG is one technique within context engineering. It depends on chunking and vector search, is refined by reranking, aims at grounding and faithfulness, and extends to graph structures in GraphRAG.

Common misreadings

  • Treating retrieval as proof that the cited claim is correct.
  • Ignoring stale or conflicting passages.
  • Evaluating only fluent answers while missing retrieval failures.

Related terms

Appears in

Found an error on this page? See corrections for what counts as one, how to report it and the dated log.

Enquiry

Where does "Retrieval-augmented generation" bear on a decision of yours?

This entry sits under context engineering. If a decision in your organization turns on it, send the entity concerned, the sources you fuse to describe it and who may read which of them. We reply with what a first record would cover.

Or write to [email protected] in your own words.