Retrieval-augmented generation (RAG) exists to solve one problem: language models don't know your data, and retraining one every time your documents change isn't realistic. RAG instead retrieves relevant text at query time and hands it to the model as context.

The minimum viable pipeline

  1. Ingest your documents — split them into chunks small enough to retrieve precisely, large enough to keep context.
  2. Embed each chunk into a vector and store it in a vector database.
  3. Retrieve the chunks most similar to a user's query.
  4. Generate an answer, with the retrieved chunks in the prompt.

Where beginners stop, and where production starts

That four-step pipeline works in a demo and falls apart on real questions. Production RAG needs hybrid retrieval (vector search alone misses exact terms like product names), reranking (a second, more precise pass over the top candidates), and a confidence threshold that refuses to answer when nothing retrieved is actually relevant. I cover the last one in detail in why my RAG platform says "I don't know".

The one mistake that wastes the most time

Building the pipeline before building an evaluation set. Without a fixed set of question-answer pairs with known correct sources, every change you make is a guess dressed up as an improvement.