AI term · last reviewed 2026-07-07
RAG
Also known as: Retrieval-Augmented Generation
RAG (Retrieval-Augmented Generation) grounds a model's answer in documents retrieved at query time rather than only its training data, reducing hallucination and enabling answers over private or fresh data.
How it works
RAG (Retrieval-Augmented Generation) is a technique that grounds a language model's answer in documents retrieved at query time rather than relying only on what the model memorized in training. The pipeline: convert the user's query into an embedding, search a vector database for the most relevant passages, and pass those passages into the model's context window as supporting material. The model then writes an answer grounded in the retrieved text, which reduces hallucination and lets you answer over private or fresh data the base model never saw.
When it matters
RAG matters for any application that needs current, proprietary, or citable answers: internal knowledge assistants, support bots, and the generative search engines behind GEO. It is also the mechanism by which AI answer engines ground and cite the web, which is why RAG is central to What Is GEO. On the security side, RAG introduces an indirect prompt injection surface: a retrieved document can carry hostile instructions.
Common misconceptions
- "RAG eliminates hallucination." It reduces it. A model can still misread or ignore retrieved context.
- "RAG is fine-tuning." No. RAG retrieves at query time; fine-tuning changes the model's weights.
- "Retrieved text is trusted." It is untrusted data and can carry injected instructions.
Explained in depth