
Retrieval-Augmented Generation
How retrieval-augmented generation selects external evidence for a model, where grounding can fail, and how people should evaluate retrieval and answers separately.
Fuentes
Resumen completo

Retrieval-augmented generation, commonly called RAG, combines a generative model with an external collection of information. Instead of relying only on patterns stored in model parameters, the system first searches for material related to a question and then places selected passages into the model's current context. The model uses the question, instructions, and retrieved passages to compose a response. This design can make changing or specialized knowledge available without retraining the entire model, and it can provide evidence that a reader can inspect.
A typical pipeline prepares documents before any question arrives. Files are cleaned, divided into chunks, described with metadata, and indexed. Many systems convert each chunk into an embedding so that a new query can be compared with candidate passages by semantic similarity. Keyword search, filters, rerankers, or hybrid retrieval may also be used. The highest-ranked passages enter the prompt, subject to a limited context budget. Every choice matters: chunk boundaries can separate a claim from its qualification, metadata can exclude relevant sources, and a similarity score can favor topically related text that does not answer the question.
Retrieval and generation are separate stages with separate failure modes. The retriever may miss the best evidence, select an outdated version, or return duplicated and conflicting passages. The generator may ignore a retrieved qualification, merge claims from different sources, or produce a statement that no passage supports. A citation can point to a real document while still failing to support the sentence beside it. RAG therefore reduces some forms of unsupported generation but does not guarantee truth, completeness, or faithful citation.
Evaluation should inspect the whole chain. Retrieval measures can ask whether relevant evidence appears among the selected passages and how highly it is ranked. Answer measures can examine accuracy, completeness, attribution, and whether each claim is entailed by its cited source. Testing should include ambiguous questions, missing evidence, adversarial documents, access restrictions, and cases where the collection contains no answer. Human reviewers need to see the query, retrieved passages, source dates, and final response rather than judging fluent output alone.
In education, learners can build a small RAG activity from a bounded set of approved readings. They can predict which passages should be retrieved, compare keyword and semantic search, and mark every answer claim as supported, contradicted, or absent. Teachers should distinguish source quality from retrieval relevance and require students to open original documents. Sensitive records need access controls before indexing, not only after generation. Versioned source collections and reproducible test questions also help a class notice when retrieval quality changes after an index or model update. The useful mental model is evidence-assisted composition: retrieval changes what information is available, while accountable readers still decide whether the selected evidence is appropriate and whether the response represents it faithfully.


