563
Dictionary

RAG (Retrieval-Augmented Generation)

Inject external knowledge into an LLM at query time.

2 min readupdated 2026-06-17

/ quick answer

Retrieval-Augmented Generation is a pattern where relevant documents are retrieved from a vector store and inserted into the model's context before generation, grounding answers in source material. Inject external knowledge into an LLM at query time.

Retrieval-Augmented Generation (RAG) is the pattern of grounding an LLM's answer in documents fetched at query time instead of relying only on what the model memorised during training. A RAG system turns your knowledge base into embeddings, stores them in a vector database, and at question time retrieves the most relevant chunks to inject into the prompt. This gives the model fresh, private, citable information — customer docs, internal wikis, product data — without expensive fine-tuning and without the hallucinations that come from asking a model about things it never saw. RAG is the default architecture for AI assistants, support bots, internal search and any use case where accuracy and provenance matter more than raw creativity. In 2026 the state of the art has evolved into hybrid retrieval (vector + keyword), reranking, and agentic RAG where the model plans its own multi-step searches.
Definition
Retrieval-Augmented Generation is a pattern where relevant documents are retrieved from a vector store and inserted into the model's context before generation, grounding answers in source material.
Example
A support bot retrieves the 3 most relevant help-center articles for a user question and asks the LLM to answer using only those sources.
Related Workflows
Related Tool Stacks
Related Prompts
/ frequently asked

What does RAG stand for?

Retrieval-Augmented Generation. The model retrieves relevant documents at query time and generates an answer grounded in them.

When should I use RAG instead of fine-tuning?

Use RAG for factual, changing or private knowledge — docs, tickets, product data. Use fine-tuning for consistent style, format or a narrow behaviour that prompting cannot reach.

Do I always need a vector database for RAG?

No. For small corpora, in-memory search or keyword search (BM25) can outperform a naive vector setup. Vector DBs shine when you have thousands+ documents and need semantic recall.

How does RAG reduce hallucinations?

By passing the retrieved passages into the prompt and asking the model to answer only from them (with citations), the surface area for fabrication drops sharply — though prompt design and reranking still matter.

/ continue exploring

Related concepts

The vocabulary this page depends on.

  • Retrieval

    Selecting the most relevant chunks for a query before generation.

  • Agentic RAG

    RAG where an agent decides what to retrieve, when, and from which source — instead of a single static query.

  • Embedding

    A numerical vector representation of text, image or audio that captures meaning for similarity search.

  • Reranker

    A second-stage model that reorders retrieved chunks for precision.

all dictionary

Related workflows

Turn this into a repeatable process.

all workflows

Related tool stacks

The tools that run it in production.

  • RAG Starter Stack

    Minimum viable stack to ship a production RAG chatbot.

  • RAG Context Enrichment Stack

    A technical stack designed to enrich the contextual data provided to a Retrieval Augmented Generation (RAG) system, improving the quality and depth of LLM responses.

  • Low-Cost RAG Stack

    This stack combines open-source and cost-efficient components to build a Retrieval-Augmented Generation (RAG) system with minimized operational expenses.

  • Multi-Agent Orchestration Stack (CrewAI)

    This stack outlines the essential components for deploying a robust multi-agent system using CrewAI, focusing on agent definition, tool integration, and monitoring for collaborative task execution.

all tool stacks

Related prompts

Reusable prompts for this job.

all prompts

Comparisons & alternatives

Pick between the options.

all comparisons