What is RAG (retrieval-augmented generation)?

RAG, or retrieval-augmented generation, means fetching relevant information from your own sources and giving it to an AI model along with the question, so the answer is based on your data instead of only the model's training.

RAG is how most "chat with your docs" and support-assistant features work. It has two steps:

  1. Retrieve. Search your content (help articles, policies, tickets, a database) for the passages most relevant to the question. This often uses embeddings and a vector database, plain keyword search, or both.
  2. Generate. Put those passages in the context window and ask the model to answer from them, ideally with citations.

Why teams use it

  • The model can use private and up-to-date information without retraining.
  • Answers can cite sources, which makes hallucinations easier to catch.
  • Access control stays in your systems: retrieve only what this user is allowed to see.

Where it goes wrong

Most RAG failures are retrieval failures: the right passage was never found, or was cut in half, or five near-duplicates crowded it out. When answers are bad, look at what was retrieved before you touch the prompt.

RAG or fine-tuning?

Use RAG to give a model knowledge. Consider fine-tuning to change behaviour (style, format, a narrow skill). Many products need only RAG.

The Canadian angle

RAG keeps your source documents in your own storage, which helps with data residency conversations, but the retrieved passages are still sent to the model on every request. Know where that model runs.

Articles that mention RAG

All 27 terms in the AI glossary →