Learn AI

Track progress · learn offline

Get

Glossary

What is RAG?

Giving the AI your own documents to pull answers from, so it responds from real sources instead of memory alone.

RAG — retrieval-augmented generation — is the trick that lets an AI answer from your documents instead of only its training. Before answering, the system searches your files for the relevant passages and pastes them into the prompt, so the model responds from real, quotable sources rather than memory.

Question
Search your docs
Top passages
Model
Grounded answer

The model reads your sources at answer time — no retraining.

RAG is how most "chat with your data" tools work, and it's the main cure for hallucination on private or fresh information. It has limits too: an answer is only as good as what search finds, so how you chunk and index your documents matters.

Related terms

Appears in these lessons

See it live

Build a "chat with your docs" in miniature

See retrieval feed the answer, step by step — free in the app.