StudyAIStudyAI
Pro
Lesson 69 minPro

RAG (Retrieval-Augmented Generation)

Give an LLM your own up-to-date, private knowledge.

What you will learn
  • Why RAG beats fine-tuning for facts
  • The retrieve-then-generate flow
  • What a vector database does

Explanation

LLMs only know what they were trained on, and they can't cite your private documents. RAG fixes this without retraining.

The flow: store your documents as embeddings in a vector database; when a question comes in, retrieve the most relevant chunks; paste them into the prompt; let the LLM answer using that context.

RAG is how 'chat with your PDFs/company docs' products work — accurate, current, and grounded in sources.

Real-world use

A support bot that answers from your latest help-centre articles almost always uses RAG, not a fine-tuned model.

Common mistakes
  • Reaching for expensive fine-tuning when RAG would add fresh knowledge far more cheaply.
Practice

Sketch a RAG pipeline for a chatbot that answers from your company's policy PDFs.

Knowledge check
0/2 answered

1. RAG works by...

2. A vector database stores...

Answer all questions to check.