CertBrain
Sign in
← Back to decks
Sign in to save your progress.Sign in

Retrieval Augmented Generation

Retrieval Augmented Generation (RAG) gives a foundation model access to your own information at the moment it answers. Instead of retraining the model, the application looks up relevant passages from your documents and adds them to the prompt, so the answer is based on current, company-specific…

10 cards

Retrieval Augmented Generation

In this lesson · 5 sections
Step 2 of 5

How RAG Works

RAG has two phases.

Preparing the data (done once, then refreshed):

  1. Documents are converted to text and split into chunks.
  2. An embedding model turns each chunk into a vector, a list of numbers that captures its meaning.
  3. The vectors and their text are stored in a vector database.

Answering a question (every request):

  1. The user's question is turned into a vector with the same embedding model.
  2. The vector database returns the chunks whose meaning is closest to the question.
  3. Those chunks are added to the prompt as context.
  4. The model writes an answer using that context.

When a document changes, you update its chunks and vectors. The model itself never changes.