MORAIDICTIONNAIRE IA
Inférence & Prompting

Retrieval-Augmented Generation (RAG) (RAG)

Connect a language model to an external knowledge base for grounded, up-to-date answers.

Retrieval-Augmented Generation (RAG) connects a language model to an external knowledge base: instead of answering only from what it memorized during training, the model first retrieves relevant documents and then writes its answer grounded in them. It is the equivalent of a student checking their notes before answering, rather than reciting from memory.

How it works

The RAG pipeline unfolds in three stages:

The similarity between a query $q$ and a document $d$ is typically measured as:

$$\text{sim}(q, d) = \frac{\mathbf{q} \cdot \mathbf{d}}{\lVert \mathbf{q} \rVert \, \lVert \mathbf{d} \rVert}$$

Why use it

Criterion Model alone With RAG
Up-to-date knowledge frozen at training refreshable without retraining
Hallucinations frequent reduced (grounded answers)
Traceability none citable sources
Cost heavy retraining index update

Real-world uses

RAG has become the backbone of enterprise document assistants, support chatbots, and conversational search engines. It lets you query private and recent data without any retraining cost.

RAG does not make the model smarter: it hands it the right page at the right time.

Explore the full AI dictionary →