Agents and beyond
RAG, retrieval-augmented generation
Instead of answering from what it memorized in training, the model is handed the relevant chunks of your documents at question time and told "answer from these."
How it works, in four steps
- Chunk. Split your documents into pieces.
- Embed. Turn each chunk into an embedding, a list of numbers that captures its meaning.
- Retrieve. At question time, find the chunks nearest to the question.
- Generate. Put those chunks in the prompt with "answer from these," and get citations you can check.
When to use what
| Situation | Use | Why |
|---|---|---|
| Document fits in context and is used once | Just attach it | Simplest; the model sees everything |
| Corpus is large, changes often, or many users query it | RAG | Only relevant chunks are sent; stays current without retraining; citations |
| You need the model to speak differently (tone, format), not know something | Fine-tuning | Advanced, rarely the right first tool |
Novice on-ramp: NotebookLM (consumer Gemini) is RAG with a friendly face. On GenAI.mil, a Project with files is RAG-lite.