--- title: "What is retrieval-augmented generation (RAG)?" excerpt: "RAG fetches relevant documents at query time and feeds them to the model, so answers cite your data, not its memory. The retrieval half is where it breaks." definition: "Retrieval-augmented generation (RAG) is a pattern where a system retrieves relevant documents from your own corpus at query time and passes them to an LLM as context, so the model answers from your data rather than its training memory." date: "2026-07-09" lastModified: "2026-07-09" author: "Teo Deleanu" authorAvatar: "/team/teo.jpg" tags: ["RAG", "AI Engineering", "Retrieval"] keywords: - "what is retrieval augmented generation" - "RAG explained" - "retrieval augmented generation vs fine-tuning" --- Retrieval-augmented generation (RAG) is the default way to make an LLM answer from data it was never trained on. Instead of hoping the model memorized your docs, you retrieve the handful of passages that matter for the current question and hand them to the model as context. ## Why it matters in production RAG is the difference between a [hallucination](/glossary/hallucination) about your product and the model quoting your actual documentation. It also means you can update knowledge by re-indexing a document, not by [fine-tuning](/glossary/fine-tuning) the model — retrieval is almost always the right tool for facts, and training the wrong one. That decoupling is the whole point. ## The common mistake Teams treat RAG as a generation problem when it is almost always a retrieval problem. If the right passage never makes it into the context window, no prompt engineering saves you — the model can only reason over what it was handed. When a RAG system gives bad answers, look at what got retrieved before you touch the prompt. Nine times out of ten the retriever pulled the wrong chunks, or the [chunking](/glossary/chunking) split a fact across two pieces that never travel together. ## How we actually use it We build retrieval first and generation last: get relevant [embeddings](/glossary/embeddings) into a [vector database](/glossary/vector-database), add a [reranking](/glossary/reranking) pass to sharpen the top results, then measure retrieval quality with [evals](/blog/evals-as-ci) before anyone judges the final answer. See our full walkthrough of [how RAG works in production](/blog/how-rag-works-in-production) and where it hits its ceiling versus [agentic RAG and big-context approaches](/blog/rag-vs-agentic-rag-vs-big-context).