L025 · Under the hood · 2 min
RAG: give AI your documents
RAG lets a chatbot look up the right pages in your own documents before it answers, so it can use facts it was never trained on.
01 · The idea
A model only knows its training data. It does not know your company handbook, your school's rules or last week's prices.
Retrieval-augmented generation, or RAG, fixes this in two steps. First, it searches your documents for the most relevant passages, usually with embeddings stored in a vector database. Second, it gives those passages to the model with your question.
The model then answers using that text, and good systems show which document each answer came from. This reduces hallucination and keeps answers up to date.
You already use RAG when you upload a PDF to a chatbot, or use a company help bot. It is only as good as the documents it finds.
02 · Think of it like this
It is an open-book exam. Instead of answering from memory, the student first finds the right page, then writes the answer.
03 · Do it now
04 · Quick check
Words in this lesson
See also
L005How AI thinks · 2 min
Why AI makes things up
AI is built to produce a likely answer, not a true one, so sometimes it confidently invents facts.
L028Under the hood · 2 min
Fine-tuning vs prompting
Before you train your own AI, try a better prompt and your own documents; that solves most problems faster and cheaper.
L039Under the hood · 3 min
How fine-tuning works
Fine-tuning takes a model that already knows language and trains it a bit more on your own examples, so it picks up a style or a task.
L042Under the hood · 2 min
Synthetic data: when AI makes its own practice material
Synthetic data is training material made by computers, often by other AI models, to fill gaps where real examples are rare, private or costly.