RAG
Also known as: retrieval-augmented generation
RAG (Retrieval-Augmented Generation) is a pattern: before answering, the AI retrieves โ searches โ the documents you care about, stuffs the relevant parts into the prompt, and then answers.
The pipeline in three moves:
- Chunk & index โ your documents (notion, wiki, PDFs, code) are cut into pieces and indexed so they can be searched quickly.
- Retrieve โ when you ask a question, the system finds the ~5 most relevant chunks.
- Generate โ the model answers using those chunks as notes: “Here are the relevant excerpts โ answer the question based on them.”
Why it exists:
- A model only knows what was in its training data โ nothing about your company, your server, your 2025 contract.
- Its context window can’t hold your entire wiki.
- RAG bridges both gaps: the model gets fresh, private, specific material โ and can even cite which page it used.
RAG vs fine-tuning, in one line: RAG gives the model *notes to consult* (instant, cheap, updatable); fine-tuning changes the model's *brain* (slow, permanent). Most "my AI knows my company" use cases are RAG, not fine-tuning.