RAG: Giving LLMs the Right Context
A beginner-friendly introduction to retrieval-augmented generation through a company handbook assistant.
Audience: Students and beginners
Length: 20 minutes
Click the presentation before using its keyboard controls.
What You Will Learn
- Why a language model cannot reliably know private or recently updated information
- How documents become searchable chunks and embeddings
- How retrieval supplies evidence to an augmented prompt
- How the model generates a grounded answer from that evidence
- Where a RAG pipeline can fail
The Pipeline
Before questions arrive, source documents are cleaned, divided into useful chunks, converted into embeddings, and stored in a searchable index.
When a user asks a question, the system follows four steps:
- Retrieve: Find handbook passages whose meaning is close to the question.
- Augment: Place those passages in the model's prompt as evidence.
- Generate: Ask the model to answer using only the supplied evidence.
- Cite: Return the answer with enough source information for the user to verify it.
RAG does not guarantee correctness. Weak source material, poor chunk boundaries, irrelevant retrieval, and unsupported generation can each break the final answer. A useful RAG system must therefore evaluate retrieval and generation separately.
References
- Patrick Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, 2020
- Vladimir Karpukhin et al., Dense Passage Retrieval for Open-Domain Question Answering, 2020
Reuse
You may reuse this deck for learning and internal knowledge sharing with attribution to DuyNK. Verify examples and implementation details before applying them to production systems.