LESSON 3 of 6 Intermediate

RAG: Teaching AI Your Data

How do you make AI answer questions about YOUR documents? Learn about Retrieval-Augmented Generation — the technique behind custom AI assistants.

4 min read 4 quiz questions

The Problem

AI models like ChatGPT are trained on public internet data, frozen at a point in time. They don’t know about:

  • Your company’s internal documents
  • Information created after their training cutoff
  • Private data that wasn’t on the internet

So how do you make AI answer questions about your stuff?

Enter RAG

Retrieval-Augmented Generation is a technique that works in three steps:

  1. Store your documents in a searchable format
  2. Retrieve the most relevant pieces when a question is asked
  3. Generate an answer using those pieces as context

Think of it like giving a student a textbook before an exam. The AI uses your documents as reference material to answer questions accurately.

How It Works (Simply)

Step 1: Prepare Your Documents

Your documents (PDFs, web pages, emails, etc.) get broken into small chunks — maybe a paragraph or two each. Each chunk gets converted into an embedding — a list of numbers that represents the meaning of that text.

Step 2: Store in a Vector Database

These embeddings are stored in a special database designed for “meaning-based” search. Similar ideas end up near each other, even if they use different words.

Step 3: Ask a Question

When you ask “What’s our refund policy?”, your question also gets converted to an embedding. The system finds the stored chunks most similar in meaning to your question.

Step 4: Generate Answer

The AI receives your question PLUS the relevant chunks and generates an answer based on your actual documents — not just its general training.

RAG vs Fine-Tuning

RAGFine-Tuning
Speed to set upHoursDays to weeks
CostLowHigh
Update dataJust add new documentsRetrain the model
Best forQ&A over documentsChanging AI’s style/behaviour

Most use cases are better served by RAG. Fine-tuning is for when you need to change how the AI writes or behaves fundamentally.

Real-World Examples

  • Customer support bots that answer questions using your help docs
  • Internal knowledge bases where employees search company documents
  • Legal research assistants that reference case files
  • Healthcare tools that consult medical guidelines

The Limitations

RAG isn’t perfect:

  • If your documents don’t contain the answer, AI may still hallucinate one
  • Quality depends heavily on how well documents are chunked and indexed
  • Complex questions spanning many documents can be tricky

Key takeaway: RAG is how you make AI “know” things about your specific world. It’s the most practical technique for building custom AI assistants over your own data.

Quick Quiz

Test what you just learned. Pick the best answer for each question.

Q1 What does RAG stand for?

Q2 Why can't you just paste all your documents into AI?

Q3 What are 'embeddings' in simple terms?

Q4 What's the main advantage of RAG over fine-tuning?