← Table of Contents · Page 493 of 868

RETRIEVAL-AUGMENTED GENERATION (RAG)

Part 4 of 9

REDUCING HALLUCINATION BY GROUNDING IN REAL SOURCES Grounding means tying the model's answer to real, checkable source material. RAG is the most common way to ground an answer. It reduces hallucination, but it does not eliminate it. The model might still ignore the retrieved text, misread it, or blend it with its own guesses. Retrieval might fetch the wrong passages, leading to confidently wrong answers that look well-sourced. Good grounding practices include the following. Instruct the model to answer only from the provided passages and to say "I could not find this in the provided documents" when the answer is absent. Require citations, such as naming the document and section for each claim, so a human or a checker can verify. Run a verification step, such as a second pass in which a reviewer checks whether each claim in the answer is actually supported by the passages, drawing on the scoring methods in Chapter 33. Treat retrieved text as untrusted input. A retrieved document may contain hidden instructions placed by an attacker, which is the prompt injection risk from Chapter 38. So the harness should tell the model that retrieved passages are reference material, not commands, and should limit what actions the model can take after reading them. Finally, restrict retrieval by permissions. If a user is not allowed to see a document, the search must not return it, even by accident, or RAG becomes a way to leak secrets. Access control must be enforced in the retrieval step itself.
Advertisement
Read Aloud:
0:00 / 0:00