AI · LESSON 19 / 25 · English
Retrieval-Augmented Generation (RAG)
Find the evidence before drafting the answer.
Content reviewed: 22 October 2026 · தமிழில் படிக்க ↗
Understand it in plain language
Retrieval-augmented generation retrieves relevant material and supplies it as context for generation. A practical system needs document ingestion, chunking, indexing, retrieval, and answer construction. Dense vectors are one retrieval option, not a requirement for every system. Retrieval does not update model weights and does not guarantee that the answer is correct. Document permissions and freshness must be enforced before retrieved content is exposed.
How the AI approach works
RAG combines retrieval with generation. It separates a model’s learned parameters from an external collection that can be updated independently. At question time, the system retrieves relevant authorized evidence and conditions the generator on it. The generator still produces predictions; source access does not automatically ensure faithful use of the source.
An offline ingestion path extracts documents, preserves source and version metadata, divides content into useful chunks, builds representations, and indexes them. Chunk boundaries should preserve meaning, such as keeping a rule with its exception. A query path retrieves candidates, optionally reranks them, assembles bounded context, and generates an answer with usable citations. Keyword, dense-vector, and hybrid search are alternative retrieval strategies.
Retrieval and generation fail differently. The right document may be missing, a chunk may omit an exception, a relevant result may rank too low, or the generator may contradict good evidence. Measure retrieval relevance and answer faithfulness separately. Embedding similarity measures a learned relationship, not factual truth. Citations should point to evidence that actually supports the attached statement.
Respect document permissions before exposing content. Track freshness, deleted sources, conflicting versions, and the date relevant to the question. If evidence is insufficient, ask a focused clarification or state the limit. Treat retrieved text as untrusted content, not as an authority to override application instructions or execute tools.
Break the idea into steps
- Keep document IDs, timestamps, and access permissions with each chunk.
- Evaluate retrieval separately from the generated answer.
- Cite supporting material and abstain when suitable evidence is missing.
Worked example: connect the method to the task
A student asks whether a course purchase can be refunded after ten days. Search returns a current “seven-day” policy and an old “fourteen-day” policy. Simply taking both snippets and generating a confident answer is risky. Preserve effective dates, choose the applicable policy, and cite its actual rule and exceptions.
Test three cases: the correct policy is retrieved; only the old policy is retrieved; no relevant policy is retrieved. These cases reveal whether the system can distinguish supported answers from missing evidence.
Apply the idea: check your reasoning
Think before revealing the answer
Should a wrong answer always be fixed by changing the prompt?
Reveal the answer and reasoning
No. Inspect the retrieved evidence first. Missing or incorrect chunks may require ingestion, indexing, filtering, or ranking changes; a correct retrieved source with an unsupported answer points to generation or context-use problems.
A common mistake: Retrieved text is data, not permission to override application instructions or access controls.
Before you move on
- Explain the main idea without repeating the technical label.
- Identify the approach, its assumptions, and the evidence needed to trust the result.
- Complete the challenge, then compare your reasoning with the answer.
Sources & a deeper next step
The refresh uses primary papers and official documentation. These optional links are in English; you can understand this lesson without reading them first. Product versions and availability can change.