RAG, short for Retrieval-Augmented Generation, is a technique that connects a large language model to an external knowledge base before generating a response. Instead of answering from its training data alone, a RAG system first searches a set of documents — your company’s internal wiki, a product manual, a legal database — retrieves the most relevant excerpts, and feeds them into the model alongside the user’s question. The result is an answer grounded in your documents, not guessed from memory.

The concept was introduced by researchers at Meta AI (then Facebook AI Research) in a 2020 NeurIPS paper by Patrick Lewis and colleagues, who combined a language model with a Wikipedia retrieval engine and set new benchmarks on open-domain question answering. Since then, RAG has become one of the most widely used architectures in enterprise AI.

What problem does RAG solve?

Standard large language models have two structural weaknesses that make them difficult to trust in professional settings. First, their knowledge is frozen at a training cutoff — they cannot know about events, policy changes, or product updates that happened after that date. Second, they hallucinate: when asked about something they do not know, they often generate plausible-sounding but wrong answers rather than admitting uncertainty.

RAG addresses both problems without retraining the model. You update the knowledge base; the model stays the same. Because the model receives the source material directly in its context window, it can cite where each answer came from — making errors detectable and correctable.

A third problem RAG solves is privacy. An LLM trained on public internet data knows nothing about your internal processes, customer records, or proprietary research. RAG lets you keep that data in your own infrastructure and retrieve from it selectively, without ever exposing it to model training.

How RAG works

A RAG pipeline has four main stages:

1. Index. Your documents (PDFs, wikis, support tickets, database rows) are split into chunks, converted into numerical representations called embeddings, and stored in a vector database. This is a one-time setup step; adding new documents means re-indexing only those documents, not retraining the model.

2. Retrieve. When a user asks a question, the question is converted into an embedding using the same model. The vector database finds the chunks whose embeddings are most similar — semantically, not just by keyword match.

3. Augment. The retrieved chunks are prepended to the user’s question, forming a richer prompt: “Here is relevant context: [document excerpts]. Now answer: [question].”

4. Generate. The LLM produces an answer using the augmented prompt, drawing on both its general language ability and the retrieved material.

Who uses RAG and for what

RAG is now the standard architecture for any application that needs an AI to answer questions reliably over a specific body of knowledge:

  • Customer support bots that answer from product manuals and FAQs, citing the exact policy section
  • Internal search tools that let employees query HR documentation, engineering wikis, or financial reports
  • Legal and compliance Q&A that retrieves from regulations and internal policy, with citations
  • Sales enablement tools that pull from case studies and competitive intelligence on demand
  • Medical reference systems that ground answers in clinical guidelines rather than general training data

How to get started

The two most widely used frameworks for building RAG systems are LlamaIndex and LangChain, both open-source and free. LlamaIndex is built specifically around the data pipeline — loading, chunking, indexing, and querying; LangChain is broader and treats RAG as one step in a larger agent workflow.

For a vector database, Chroma is a good free starting point: it installs with pip install chromadb and runs locally with no account required. Cloud-hosted options like Pinecone offer a free tier up to 100,000 vectors, with paid plans starting around $50/month (as of July 2026, per Pinecone’s pricing page).

The underlying LLM call is the main ongoing cost driver. RAG queries use more tokens than plain queries because retrieved context is included with every request; budgeting for the LLM API is the primary cost variable, while the retrieval infrastructure is relatively modest.

In the news

Microsoft’s new Frontier Company initiative — embedding AI engineers directly inside enterprise clients — is a large-scale example of RAG-centric deployment. These engineers help companies index their proprietary knowledge into retrieval pipelines and integrate the results into business workflows. Read the full brief: Microsoft Launches $2.5B Frontier Company to Embed AI Engineers in Enterprises.