Nexus Learn

Log in · Create free account

Module 4: Using models with your own data · 11 min

How RAG works, step by step

  1. Prepare: split your documents into small chunks, for example a few paragraphs each.
  2. Index: turn every chunk into an embedding and store it in a vector database.
  3. Retrieve: when a user asks a question, turn the question into an embedding and find the most similar chunks.
  4. Augment: put those chunks into the prompt together with the question.
  5. Generate: the model answers using only that material, and can point to its sources.
Use only the context below to answer. If the answer is not there, say "I don't know".

Context:
[chunk 1]
[chunk 2]
[chunk 3]

Question: What is the refund period?

RAG reduces made-up answers and lets you keep private data on your side, but it is only as good as your documents and your search. If the right chunk is not retrieved, the model cannot use it.

(free account needed to save progress)

← Prompting, RAG or fine-tuning?  |  Checking that your AI app works →