RAG (Retrieval-Augmented Generation)
Inject external knowledge into an LLM at query time.
/ 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.
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.
Related workflows
Turn this into a repeatable process.
- →Build an Internal Knowledge Bot
Ship a Slack bot that answers questions from your company docs.
- →AI Customer Onboarding Flow
Walk every new user through activation with an AI guide.
- →RAG Content Ingestion Pipeline
Convert messy docs into searchable, cited knowledge chunks for AI systems.
- →Personal Research Assistant Workflow
A repeatable system to research any topic deeply in under 30 minutes.
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.
Related prompts
Reusable prompts for this job.
- →Grounded Answer Prompt
Force the model to answer only from provided sources, with citations.
Comparisons & alternatives
Pick between the options.
- →ChatGPT vs Claude
Two leading conversational AI assistants compared across reasoning, writing, coding, and pricing.
- →Lovable vs Bolt
Two AI app builders compared on speed, backend, deployment, and production readiness.
- →OpenAI API vs Anthropic API
Choosing between the two leading LLM API providers for production apps.