Quick answer
Retrieval-augmented generation is a technique that grounds an LLM in your own data. You retrieve relevant chunks, then ask the LLM to answer using only those chunks.
What it is
RAG (retrieval-augmented generation) pairs an LLM with a search step. Before generating an answer, the system searches your knowledge base, retrieves the most relevant chunks and passes them to the LLM as context. The LLM answers using only those chunks, with citations.
Why it matters
RAG makes LLMs accurate on your data without retraining. It reduces hallucination, keeps answers current and lets you cite sources.
How to use it
- Chunk your knowledge base into small, self-contained passages.
- Embed each chunk and store the vectors in a vector database.
- At query time, embed the question, retrieve the top K chunks and pass them as context.
- Ask the LLM to answer using only the retrieved chunks and cite the sources.
Examples
- A support chatbot grounded in product docs answers with citations.
- A legal assistant grounded in case law answers with case citations.