Page languageFrançaisEnglish
Teacher area
Laurent PoupetClaude trainer and artificial intelligence architectStudent area

Category · Data and retrieval-augmented generation

What is RAG (retrieval-augmented generation)?

RAG (retrieval-augmented generation) means searching before answering. The right passages are first found in a document base, then given to the model along with the question. The answer is up to date, and it cites its sources.

By , Claude trainer and artificial intelligence architect · Updated

How it works

  • The pipeline runs in two stages: documents are prepared in advance, then, for each question, the passages are retrieved and the answer is written.
  • Quality depends above all on retrieval; if the right passage is not found, even the best model in the world cannot give the right answer.
  • It is evaluated in two parts: retrieval, with the recall and precision of the passages, and the answer, with its faithfulness to the sources and its relevance.

The trap to avoid

The trap is permissions; the index must respect the permissions of the source documents, otherwise the assistant shows people what they should never have seen.

A concrete example

An employee asks the internal assistant “how many remote-work days am I entitled to?”. The system first searches the company agreement for the two or three passages on the subject, gives them to the model with the question, and the answer cites the article of the agreement. Without that search, the model would answer from memory, with a general rule that may not be yours.

What is the difference with fine-tuning?

CriterionRAG (retrieval-augmented generation)fine-tuning
What changesThe documents given to the model with each questionThe model’s weights, retrained
UpdatesRe-index a document, and it is immediateThe model must be retrained
Cited sourcesYes, the retrieved passagesNo
Good fitFacts that change, internal documentsA style, a format, a repetitive task

Related terms

Where this is taught

This idea comes up throughout the lessons; we work on it with your own examples during a lesson.

Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.

See the full program

Sources

All glossary terms

Trial lesson · 30 min · $20

Book (new tab)