Retrieval-augmented generation (RAG) combines information retrieval with language-model generation: retrieval supplies external knowledge, while the model synthesizes an answer from the user’s question and retrieved context. This separates knowledge from intelligence and supports narrow-domain or up-to-date applications. section 6.0 section 6.1
A RAG system can be understood through its components and operating modes:
- Retrieval selects external documents or passages from sources such as search engines, vector databases, structured databases, APIs, or file systems. section 6.1 section 6.1.1
- Generation receives the question and retrieved context, then produces a synthesized response. section 6.1
- Single-turn RAG retrieves once before generation; agentic RAG lets the model choose queries, tools, and additional searches. section 6.1
- Evaluate retrieval and generation separately because either component can fail, and their errors can interact. section 6.0 section 6.5
Financial research assistant
A system retrieves an earnings report stating that Q3 revenue was $2.3 billion, grew 15% year over year, and was driven by cloud services. An answer repeating those claims is supported; claims about European expansion, a new CEO, or 30% international growth are extrinsic hallucinations because the retrieved documents contain no such evidence. section 6.0
RAG evaluation separates retrieval quality from generation quality. Precision and recall test document coverage; rank-aware metrics test whether relevant results appear before the context cutoff. RAGAS measures faithfulness, answer relevance, context recall, and context precision, helping identify retrieval gaps or unsupported generation. section 6.5
Figure 6.1 The basic single-turn Retrieval-Augmented Generation architecture. A user question is routed to a retrieval system, which queries a knowledge base and returns relevant documents. The LLM synthesizes an answer to the question and retrieves context, producing responses supported by sources.
Trace the basic single-turn flow from user question to retrieval, context injection, and generated answer. section 6.1













































