← Volver al programa
Prompting That Works: Write Requests AI Can Execute Well · Lección 4 de 7

4. Ground Your Answers and Stop Invention

Learn to attach sources, restrict the model to provided material, and ask for citations to prevent hallucination.

AI models generate the most plausible continuation of your input — but "plausible" and "true" are not the same thing. When a model lacks source material, it fills the gap with confident-sounding invention. The fix is grounding: attach the actual documents, data, or search results the model should use, then add an explicit constraint — "answer only from the provided sources, and say 'not in the sources' otherwise." This turns the model from a creative writer into a careful reader. Grounding works because it changes what counts as the most plausible answer: with sources present and a clear restriction, quoting the material becomes more plausible than guessing. Without grounding, you are relying on the model's training memory, which is unverifiable and often wrong on specifics.

Asking for citations is the second layer of defense. When you tell the model to reference which source supports each claim, two things happen: (1) the model is forced to trace its statements back to material, which makes unsupported claims harder to produce, and (2) you can verify the answer quickly by checking the cited passages. A good grounding instruction combines both elements: restrict and cite. Example constraint block:

"Use only the documents attached below. For every factual claim, cite the document name and section. If the answer is not in the documents, say: 'This is not covered in the provided sources.'"

This is a constraint in the five-part prompt framework — it tells the model what must be true and what to avoid.

Consejo

Put your grounding instruction before the source material, not after it. Models weight early instructions more heavily. Structure: instruction → constraint ("sources only, cite them") → pasted or attached material → desired output format. This order follows the principle: essential instruction first, material after, format at the end.

Not every claim can be grounded in attached documents. For facts you cannot provide sources for — general knowledge, estimates, or emerging topics — ask the model to state its confidence level and flag uncertain points. Then verify those points yourself. Grounding is not all-or-nothing: ground what you can, flag what you cannot, and never assume the model's confidence equals accuracy. Combining grounding with the "show the format" principle helps too: if you show an example output that includes inline citations, the model will replicate that pattern consistently.

Consejo

When the model invents despite your grounding instruction, iterate in the same conversation: "Your second paragraph cites a statistic not present in the sources. Remove it or replace it with a direct quote from Document B." Targeted feedback corrects the behavior without losing the rest of the good output.

Ahora tú

Go to your Knowledge Bases in OUPI. Upload a short document (a policy, a product sheet, an FAQ). Then open a chat and attach it. Write a prompt that includes: the goal, the constraint "answer only from this document and cite the section," and a question the document answers. Check whether every claim in the response traces back to your file.

Seguir este curso en OUPI → Este ejercicio se realiza en la plataforma OUPI.
Para recordar

To stop invention: (1) attach the source material the model should use, (2) add an explicit constraint — "answer only from these sources; say 'not in the sources' otherwise," (3) require citations so you can verify, (4) for ungroundable facts, ask for confidence and check yourself, and (5) iterate with targeted feedback when the model slips. Grounding turns a guesser into a reader — but you remain the editor.