How RAG Works
12%
Lesson 1 of 8

How RAG Works

RAG lets an AI retrieve useful information from your documents before it writes the answer.

Active reading
The whole idea
QUESTION → RETRIEVE RELEVANT CHUNKS → ADD CONTEXT → LLM → ANSWER

Why retrieval matters

A language model does not automatically know the contents of your private files. RAG adds a retrieval step so the model can answer using selected source material instead of relying only on its general model knowledge.

Example

Question: What is our refund policy?

Retrieval: Find the policy paragraph in the company handbook.

Generation: Give the model the retrieved paragraph together with the question.

Five parts to remember

1. Documents
Your source material
2. Chunks
Smaller searchable pieces
3. Embeddings
Represent semantic meaning
4. Retrieval
Find likely useful chunks
5. Generation
Answer using the retrieved context
Try it · Chunking demo
Change the chunk size and compare the result.
Common mistake

RAG is not the same thing as training the model.

RAG supplies retrieved context at answer time. Fine-tuning changes model behavior through training.

Key takeaway

RAG is a retrieval pipeline: find useful source material first, then give that context to the model so it can answer more usefully.

Next lesson

Chunking

Continue to the next lesson.

Continue →