What Is RAG? A Simple Explanation

Imagine a company has 10,000 documents containing product manuals, company policies, research reports, customer support documents, and other internal knowledge.

When a user asks a question, the answer may already exist somewhere in those documents. However, sending every document to the LLM would not be practical. Instead, the system first finds the information related to the question and then provides that information to the model.

This is the basic idea behind Retrieval-Augmented Generation, or RAG.

What the Article Covers

A simplified RAG process looks like this:

User Question
      ↓
Search the Knowledge Base
      ↓
Retrieve Relevant Information
      ↓
Add the Information to the Prompt
      ↓
Send the Augmented Prompt to the LLM
      ↓
Generate the Answer

An embedding converts text into a numerical representation called a vector. Because the vector represents the meaning of the text, the system can recognize that questions such as “How can I return my order?” and “What is your refund process?” are related even though they use different words.

These embeddings can be stored in a vector database. When a user submits a question, the system converts it into an embedding and searches for similar vectors. The retrieved information is then provided to the LLM so it can generate an answer based on content related to the user’s question.

Read the full article and join the discussion →