Inside a real RAG system: 15 key ideas
A basic RAG demo takes an afternoon; a reliable RAG system needs many more pieces. Here are the 15 ideas teams use, grouped by stage.
Everyday analogy
A great reference librarian doesn't just grab the first book: they understand your question, search the catalogue in two ways, check you're allowed to see each book, pick the best pages, and tell you exactly where the answer came from.
Example
Question: "Best travel policy for Europe?" The system rewrites it ("Europe travel allowance policy"), runs both keyword and meaning search, filters to documents the employee may see, reranks, and answers "30 days of travel allowed [1]" with a link to the policy, section 2.1.
1. Prepare the documents
Parsing: extract clean text, tables and images from PDFs, Word and Excel. Chunking: split into meaningful pieces. Embeddings: turn chunks into vectors. Metadata & access control: tag each chunk with date, department and who may see it.
2. Understand the question
Query understanding: detect the intent, rewrite or expand the question, add keywords.
3. Search
Vector search (ANN indexes) finds chunks with similar meaning. Lexical search (BM25) finds exact keywords. Hybrid search combines both and fuses the rankings (e.g. reciprocal rank fusion).
4. Refine
Reranking: a stronger model re-orders the top results. Small-to-big: find small chunks, then pass the larger section around them. Context assembly: combine and format the best chunks for the LLM.
5. Answer
Grounding & citation: answer only from the chunks and link each claim to its source.
6. Run it well
Evaluation: measure retrieval (precision, recall) and answer quality. Serving: keep it fast, scalable, monitored and up to date.
Try it yourself
About 15 minGrade a RAG answer
- Repeat the RAG-by-hand task with a long document.
- Score the answer: is it grounded (from the text), complete, and cited?
- Write one improvement, e.g. smaller chunks or better question wording.
What you should see: You've just done a mini evaluation, which is what teams run every day on real RAG systems.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.