Glossary
AI engineering

Retrieval-augmented generation (RAG)

RAG is a technique that retrieves relevant documents at query time and feeds them to a language model as context, so answers are grounded in specific source material rather than only the model's training.

A RAG system converts a knowledge base into searchable embeddings, retrieves the passages most relevant to a question, and inserts them into the prompt. The model then answers using that supplied context, which keeps responses current and lets them cite sources the model was never trained on.

RAG is often reached for to reduce hallucination and add private or fresh knowledge without retraining. Its quality depends heavily on retrieval: if the right passage is not fetched, the model cannot use it, so chunking, embedding quality, and ranking matter as much as the model itself.

More ai engineering terms