# Retrieval-augmented generation

URL: https://sellmydatatoai.net/glossary/retrieval-augmented-generation

Retrieval-augmented generation is a method in which an AI model fetches relevant documents at query time and uses them to ground its answer.

Retrieval-augmented generation (RAG) is a technique in which a language model retrieves relevant documents from an external index when it receives a query and uses them to produce its answer. The term comes from a [May 2020 paper by Patrick Lewis and colleagues](https://arxiv.org/abs/2005.11401), which paired a pretrained model, as parametric memory, with a dense vector index of Wikipedia, as non-parametric memory.

## How is RAG different from training?

RAG differs from training because the content is read at the moment of each answer and is not built into the model's weights. The model can cite sources, use content newer than its training cutoff and stop using content when access ends.

## Why does RAG matter for licensing?

RAG matters for licensing because it needs continuing access to current content, which suits recurring fees rather than one payment. A license for retrieval is usually separate from a training license and often requires attribution and limits on how much text is shown. The [grounding license](https://sellmydatatoai.net/glossary/grounding-license) entry covers these deals, and the [AI data deals tracker](https://sellmydatatoai.net/ai-data-deals) lists published examples.

Retrieval is also a common use for internal company documents, where the buyer is building an assistant over a customer's own records rather than training a general model.