Concept

What Is Retrieval-Augmented Generation (RAG)?

How RAG lets a language model answer from your own documents, the steps in a RAG pipeline, and common mistakes to avoid.

CraftVoy · Learning programs led by Vijay Gurunathan, Founder & CEO of Researchsyn · Published

The problem RAG solves

A language model does not know your internal policies, product manuals or recent data. Retrieval-augmented generation fixes this by finding the relevant passages at question time and supplying them to the model along with the question.

The pipeline

A basic RAG system has an indexing stage that runs ahead of time and a query stage that runs for each question.

A basic RAG flow
  1. Split documents into chunks
  2. Create embeddings
  3. Store in a vector database
  4. Embed the question
  5. Retrieve top chunks
  6. Generate answer from chunks

What decides quality

  • Chunking: chunks that are too large dilute relevance, and too small lose context.
  • Retrieval: the right passage must be found before the model can use it.
  • Prompting: instruct the model to answer only from the supplied context and to say when it is not there.
  • Evaluation: measure retrieval and answer quality on a fixed set of real questions.

Common mistakes

Teams often skip evaluation and judge by a few demo questions, index low-quality documents, or ignore access control so users retrieve content they should not see. Treat retrieval as a search and security problem, not only a model problem.