AI Glossary

Retrieval-Augmented Generation (RAG)

Retrieval-augmented generation (RAG) is a technique that finds relevant documents at question time and gives them to an AI model, so its answer is grounded in real, up-to-date sources.

Definition

Retrieval-augmented generation, or RAG, is a method for making a generative AI model answer questions using specific, trusted information instead of relying only on what it memorised during training. When a user asks a question, a RAG system first retrieves the most relevant passages from a collection of documents — a policy handbook, a product knowledge base, contracts, support tickets — and then passes those passages to the language model along with the question. The model generates its answer from that supplied context and can cite where each point came from.

The approach was formalised in the 2020 paper "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" by Patrick Lewis and colleagues at Facebook AI Research (now Meta), University College London and New York University. It has since become the standard way companies connect AI assistants to their own data. Microsoft Copilot answering from your SharePoint files, a customer-service bot quoting your help centre, and ChatGPT's file-upload and search features all rely on retrieval-based patterns.

Why RAG exists

Large language models have three limits that matter in business:

Retraining or fine-tuning a model every time a document changes would be slow and expensive. RAG solves the problem at question time: keep the model as it is, and simply hand it the right pages whenever someone asks.

How RAG works, step by step

  1. Prepare the documents. Files are split into chunks of a few hundred words.
  2. Create embeddings. Each chunk is turned into an embedding — a list of numbers that captures its meaning — and stored in a vector database or search index.
  3. Retrieve. When a question arrives, it is also turned into an embedding, and the system finds the chunks whose meaning is closest. Many systems combine this semantic search with classic keyword search.
  4. Augment. The top chunks are inserted into the prompt with instructions such as "Answer only from the sources below and cite them."
  5. Generate. The LLM writes the answer, ideally with references to the source documents.

Example

A 2,000-person company receives hundreds of repetitive questions to its HR inbox every month: "How many days of parental leave do I get?", "Can I carry over unused holiday?", "What is the expense limit for client dinners?" The answers are spread across a 90-page handbook, country-specific addenda and a dozen intranet pages.

The HR team builds a RAG assistant on their approved enterprise AI platform. They load the current handbook and policies, and set the instruction: "Answer employee questions using only the documents provided. Quote the policy section. If the documents do not cover the question, say so and suggest contacting HR."

An employee in Germany asks about carrying over holiday. The system retrieves the German addendum and the general leave policy, and the assistant replies with the exact rule, the deadline and a link to section 4.3. When someone asks about a topic not covered, the assistant says it cannot find the answer and routes them to a person. The HR team still reviews a sample of answers each week and updates documents when policies change, which instantly updates the assistant — no retraining needed.

Benefits of RAG

Limits and pitfalls

RAG is not a guarantee of truth. If retrieval finds the wrong chunk, the model will confidently answer from the wrong source. Outdated, duplicated or contradictory documents produce contradictory answers — "garbage in, garbage out" still applies. Tables, scanned PDFs and images can be hard to chunk well. Permissions must be designed carefully so that the assistant never reveals salary data or confidential files to the wrong person. And the model can still occasionally add details not in the sources, so high-stakes answers need human review.

RAG versus fine-tuning

Fine-tuning changes the model's behaviour or style by training it further on examples. RAG changes what the model knows at the moment of answering. A useful rule: use RAG when the problem is "the model doesn't know our facts"; consider fine-tuning when the problem is "the model doesn't behave or write the way we need". Many production systems use both.

Key takeaways

How this relates to our AI course

The AI POWERED course teaches the everyday version of RAG: uploading the right documents and prompting the model to answer only from them, which you practise in the analysis and research modules. For teams, the HR admin panel uses the same grounding idea, generating reports and weekly briefings from your own uploaded data rather than from the model's memory.

See AI training and reporting for HR teams →

Related terms

← All glossary terms