Retrieve, Augment, Generate
The three RAG steps
Retrieval-augmented generation (RAG) connects search to a language model. It retrieves useful chunks, augments (adds to) the prompt with those chunks, and asks the LLM to generate an answer from them. This supplies temporary reference material; it does not retrain or change the model weights.
Put clear markers around the retrieved context and tell the model to answer only from it. Treat every retrieved document as untrusted data. A document may contain prompt injection - text written to trick the model into ignoring the application's real instructions. That text must never override system rules.
Warning: RAG reduces unsupported answers; it does not guarantee correctness. Preserve citations so a user can inspect the evidence.