What Is Retrieval-Augmented Generation (RAG)?

One Two Three AI — in your inbox

AI news, practical tips and how-to guides. One useful idea a day.

What Is Retrieval-Augmented Generation (RAG)?
Image generated with AI

If you’ve ever wished ChatGPT could reference your company’s internal docs, or Claude could pull from a specific PDF you uploaded, you’ve already bumped into the need for Retrieval-Augmented Generation—better known as RAG.

RAG is one of the most practical ways to make AI more useful without retraining an entire model. It’s how tools like ChatGPT’s file upload, Perplexity’s cited search results, and enterprise AI assistants deliver answers grounded in real, specific information.

Here’s what RAG is, how it works, and when it makes sense to use it.

What RAG Actually Does

At its core, RAG combines two things: a language model (like GPT-4 or Claude) and a retrieval system (like a search engine or database).

When you ask a question, the system first searches a collection of documents, knowledge bases, or web pages to find relevant chunks of information. Then it feeds those chunks to the AI model as context, so the model can generate an answer based on what it just retrieved—not just what it memorized during training.

Think of it like giving the AI a cheat sheet before it answers your question. Instead of relying solely on its pre-trained knowledge (which has a cutoff date and can’t include your private data), the model gets real-time access to external sources.

Why RAG Matters

Language models are powerful, but they have limits. They don’t know anything that happened after their training cutoff. They don’t have access to your company’s internal files, your proprietary research, or the latest product specs. And when they try to fill in gaps, they sometimes hallucinate—confidently making things up.

RAG solves this by grounding the model’s answers in actual documents. If the retrieval step pulls in a relevant paragraph from your user manual, the model can cite it directly. If nothing relevant is found, the system can say so instead of guessing.

This makes RAG especially valuable for:

  • Customer support bots that need to reference help docs or FAQs
  • Research assistants that pull from academic papers or legal databases
  • Internal tools that answer questions using company wikis, Slack history, or Google Drive
  • Any scenario where accuracy and citations matter more than creativity

How RAG Works Under the Hood

Here’s the simplified flow:

  • Step 1: Index your documents. You break your source material (PDFs, web pages, databases) into smaller chunks and store them in a searchable index, often using embeddings—numerical representations of meaning.
  • Step 2: User asks a question. The system converts the question into an embedding and searches the index for the most relevant chunks.
  • Step 3: Retrieve the top matches. The system pulls the most relevant passages (usually 3–10 snippets).
  • Step 4: Generate the answer. The language model receives the question plus the retrieved context and generates a response based on both.

Tools like LangChain, LlamaIndex, and Pinecone make building RAG systems easier by handling the indexing, retrieval, and prompt assembly for you.

When to Use RAG (and When Not To)

RAG is a great fit when you need the AI to work with specific, up-to-date, or private information. If you’re building a chatbot that answers questions about your product, a research tool that searches a corpus of documents, or an assistant that needs to cite sources, RAG is the way to go.

But RAG isn’t always necessary. If you’re writing creative fiction, brainstorming marketing slogans, or generating images, you don’t need retrieval—you just need the model’s generative power. And if your knowledge base is small enough, you might be able to fit it directly into the model’s context window without needing a separate retrieval step.

RAG also requires setup: you need to prepare your documents, build or configure the retrieval system, and tune how many chunks to retrieve and how they’re ranked. For one-off questions or general use, a standard AI chat interface is simpler.

Real Tools Using RAG Right Now

RAG isn’t theoretical—it’s built into tools you likely already use:

  • ChatGPT (with file uploads): When you upload a PDF or text file, ChatGPT retrieves relevant sections to answer your questions.
  • Perplexity: Searches the web in real time, retrieves sources, and generates answers with citations.
  • Claude (with Projects): You can add documents to a project, and Claude will reference them when answering.
  • Microsoft Copilot: Pulls from your Office 365 files, emails, and SharePoint to answer work questions.

These tools make RAG invisible to the end user, but it’s doing the heavy lifting behind the scenes.

If you want to stay sharp on practical AI techniques like RAG—and actually use them—subscribe to the One Two Three AI newsletter. One useful AI idea, delivered daily.

One Two Three AI — in your inbox

AI news, practical tips and how-to guides. One useful idea a day.

Other newsletters you might like

Springbokfans

The best Springbok updates, straight to your inbox. Only when something worth reading actually happens.

Subscribe

Love Florida

Love Florida — in your inbox Sun-drenched beaches, world-famous theme parks, the Keys, springs and wildlife, and the best places to visit in Florida. One short email, every day.

Subscribe

Love California

Love California — in your inbox The Pacific Coast Highway, national parks, beaches, wine country and the best places to visit in California. One short email, every day.

Subscribe

My Local Dublin

The Dublin you don't see from a tour bus — local stories, hidden gems, food, events and the best of the city, by locals for locals.

Subscribe

Newsletters via the One Two Three Send network.  ·  Want your newsletter featured here? Click here

Scroll to Top