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

Cover of RAG: Giving LLMs the Right ContextLoading presentation...

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:

  1. Retrieve: Find handbook passages whose meaning is close to the question.
  2. Augment: Place those passages in the model's prompt as evidence.
  3. Generate: Ask the model to answer using only the supplied evidence.
  4. 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

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.