What Is RAG in AI?

RAG stands for Retrieval-Augmented Generation. Before a language model answers, the system retrieves relevant passages from a set of documents and adds them to the prompt, so the answer is generated from that material.

How RAG works

  1. Split documents into chunks and index them as embeddings.
  2. Turn the question into an embedding and find the closest chunks.
  3. Add those chunks to the prompt.
  4. The model answers from them.

FAQ

What does RAG stand for in AI?

RAG stands for Retrieval-Augmented Generation. Before a language model answers, the system retrieves relevant passages from a set of documents and adds them to the prompt, so the answer is generated from that material.

What is RAG in AI, in simple terms?

It is "look it up, then answer". The question is used to search your documents (usually with embeddings and a vector search), the best-matching passages are pasted into the model's context, and the model writes its answer from them.

What is RAG used for?

Answering questions over information the model was not trained on or that changes often: company docs, support knowledge bases, product manuals, policies and codebases. It also lets the answer point to the sources it used.

How is RAG different from fine-tuning?

RAG supplies knowledge at question time and leaves the model unchanged; fine-tuning changes the model's weights, which is better for adjusting style or behaviour. With RAG you update knowledge by updating the documents, not retraining the model.

Does RAG stop AI hallucinations?

No. It reduces them when retrieval finds the right passages, but the model can still misread or ignore the context, and poor retrieval gives poor answers. Testing retrieval quality is part of building a RAG system.