What Is RAG? Retrieval-Augmented Generation Explained Simply
RAG retrieves relevant documents and adds them to the prompt so the model answers from sources. See how it works and how to prompt for grounded, cited answers.
Grounding
Grounding means making a model answer from sources you provide instead of from memory. Retrieval-augmented generation (RAG) does this automatically: it searches your documents, puts the relevant passages into the prompt and asks the model to answer from them. Good grounding prompts tell the model to cite the passage it used and to say when the sources do not contain the answer.
Your app parses the model’s JSON, but sometimes the reply starts with “Sure! Here is the JSON:”. What is the most robust fix?
A RAG assistant answers confidently even when the retrieved passages don’t cover the question. Which instruction helps most?
B. “Answer only from the passages below. If they don’t contain the answer, say so.” Giving the model an explicit, allowed way to say “not in the sources” reduces made-up answers. “Be accurate” gives it nothing to act on.
RAG is a pattern where a system retrieves relevant passages from a document store and adds them to the prompt, so the model answers from that material instead of only from its training data. The term comes from Lewis et al. (2020).
No. It reduces them, but the model can still misread or go beyond the passages. Asking for citations and allowing “I don’t know” makes errors easier to spot.
RAG retrieves relevant documents and adds them to the prompt so the model answers from sources. See how it works and how to prompt for grounded, cited answers.
Prompt injection tricks an AI into following attacker instructions hidden in input or documents. Learn direct vs indirect attacks and the mitigations that work.
The prompt engineering mistakes that cause most bad AI output, from missing context to conflicting rules and untested changes, each with a concrete fix.
Short quizzes on real prompting decisions, with an explanation for every answer. Free to start on iPhone and Android.