RAG (RETRIEVAL-AUGMENTED GENERATION)

Looking up relevant documents first and giving them to the model, so its answer is grounded in real sources.

Zero retention: everything you type stays in this browser. Verify it yourself in DevTools.
Plain-language definition

What Does RAG (retrieval-Augmented Generation) Mean?

RAG stands for retrieval-augmented generation. Before the AI model answers, the application retrieves relevant information, such as help articles, code files or database rows, and puts it into the prompt. The model then writes its answer from that material instead of relying only on what it learned in training. Retrieval can use keyword search, embedding-based search by meaning, or both. RAG is how many AI apps answer questions about private or recent information the model was never trained on, and it lets them show which sources an answer came from.

Why Does RAG (retrieval-Augmented Generation) Matter?

RAG is usually the right first tool when a model needs your specific knowledge, because updating documents is instant and cheap compared with retraining. The answer can only be as good as what was retrieved, so most RAG problems are search problems: wrong chunks, too many chunks, or missing documents. Coding agents do a version of RAG when they search the repository and read files before editing.

What Does RAG (retrieval-Augmented Generation) Look Like in Practice?

A user asks an internal assistant "what is our refund window?" The app searches the policy documents, finds the paragraph saying "30 days from delivery," and sends it with the question to the model, which answers "30 days from delivery" and links the policy page. Without retrieval, the model might guess a common number instead. When the policy changes, updating the document is enough; nothing needs retraining.

What Do People Get Wrong About RAG (retrieval-Augmented Generation)?

RAG does not guarantee correct answers. The model can still misread or ignore the retrieved text, and if retrieval returns the wrong document, the answer will be confidently wrong. Showing sources lets users check.

Which Terms Are Related?

  • Embedding: A list of numbers that represents the meaning of text, so similar texts can be found by comparing numbers.
  • Context engineering: Deciding what goes into a model context window, including instructions, files and tool output, so the model can do the task well.
  • Hallucination: When a model confidently produces something false or made up, such as an API that does not exist.
  • Fine-tuning: Extra training on your own examples that adjusts a model weights so it handles a specific task or style better.
  • Context window: The maximum amount of text, measured in tokens, that a model can take into account in a single request.

All 28 terms are in the AI glossary. For models side by side, see frontier vs open-weight.

Frequently Asked Questions

Is RAG better than fine-tuning?

For giving a model facts or documents, usually yes: it is cheaper, updates instantly and can cite sources. Fine-tuning is better for teaching a consistent style, format or narrow skill. Many systems use both.

Does RAG need a vector database?

No. Plain keyword search works well for many cases, and small collections can be searched in memory. Vector search helps when questions use different words from the documents.

Do coding agents use RAG?

In a broad sense, yes. They search the codebase, read relevant files and put them in context before writing code. Some tools also index the repository with embeddings for faster lookup.

Was this helpful?