brainax

What is RAG

RAG (retrieval-augmented generation, or in plain words "find first, then answer") is a way to give AI your own documents. A program searches your files for the right piece, pastes it into the prompt next to your question, and the model answers from that piece with a source tag like [1]. Without it, a model only knows what was in its training texts and will simply guess about a deadline in your class notes.

The search works by meaning, not by words: documents are cut into small pieces and each is turned into an embedding, a list of numbers that describes its meaning. That's why "when is the essay due?" finds "paper submission deadline: end of May". RAG means fewer made-up answers, but not zero: the search can bring the wrong piece, or the right one may not exist. Before an important step, open the source and find that exact sentence.

Covered in the lessonWhat Is RAG in AI? Explained Simply with Your Own DocumentsOpen the lesson →

More terms from this course