AI series · Part 2: Retrieval (RAG)
RAG Explained: Give Your LLM an Open-Book Exam
Retrieval-Augmented Generation searches your own documents first, then has the LLM answer from what it found, with a citation. Here's how the pipeline works.
RAG (Retrieval-Augmented Generation) means: before answering, search your own documents, then hand the best pieces to the LLM so it answers from real data. It turns a closed-book exam into an open-book exam.
The pipeline
Prepare once: documents → chunks → embeddings → vector DB
Every question: question → find best chunks → LLM (chunks + question) → answer with sourceWhere you've seen it
- Bank and telecom support bots that answer from their own help-centre articles.
- Perplexity, which searches the web first and then answers with sources.
RAG in our HR assistant
Question: "Can an intern take maternity leave?" The retriever finds this chunk from the intern policy:
Interns are not entitled to company maternity leave… up to 4 weeks unpaid leave.
- Acme Intern Policy
The LLM answers from that chunk and cites it, instead of guessing from general knowledge.
RAG grounds the LLM in our own documents, so answers are accurate, up to date and cite their source, which reduces hallucination.
- The short version
Next in the GenAI series: Chunking Strategies: How to Cut Documents Without Losing Meaning
Start from the top: GenAI Quick Answers and Series Guide
We deploy these patterns across production engagements in fintech, healthcare, and eCommerce. Talk to a senior engineer about how they apply to your platform.
