ailiteracynepal 🇳🇵
Text size

Chapter 03 · Section III · 10 min read

3.3 Grounding with sources: quote before you answer

The single strongest prompt technique against hallucination — forcing the model to quote from provided material before it draws any conclusion.

The single most effective way to stop a model from making things up is to give it a specific source and tell it to quote from that source before answering. This is grounding — and it’s the difference between “the model said so” and “here is the exact passage that says so.”

The pattern

Answer the question using ONLY the material inside <source> tags below.

For each claim in your answer:
1. Quote the exact sentence(s) from <source> that support it, inside
   <quote> tags.
2. Only then state your conclusion.

If the source does not contain the information to answer the question,
say exactly: "The source does not answer this."

<source>
Nepal's Land Revenue Act 2034 requires that any property transfer be
registered within 35 days of the sale deed being signed. Registrations
after that period incur a late fee of 1% per month, capped at 12%. A
property under joint ownership requires the signed consent of all
owners at the time of registration.
</source>

<question>
What happens if I miss the registration deadline by two months, and
what does the law say about property owned by two siblings?
</question>

The output will look like:

<quote>Registrations after that period incur a late fee of 1% per
month, capped at 12%.</quote>
Missing the deadline by two months means a 2% late fee.

<quote>A property under joint ownership requires the signed consent
of all owners at the time of registration.</quote>
Both siblings must sign at registration.

Every claim is anchored. If the model tries to add “you may also need a lawyer” it has no quote to support it, so it drops the claim (or you catch it in review).

Why this works

Language models hallucinate because next-token prediction is smooth — the next plausible word is available even when the correct answer isn’t. Making the model produce a verbatim quote before the conclusion has two effects:

  • It forces the model to attend to the actual source material, not its priors.
  • It makes hallucination visible: if there’s no quote, or the quote doesn’t actually say what the conclusion claims, you can catch it.

The “I don’t know” instruction

Give the model an explicit escape hatch:

If the source does not contain the information to answer the question,
say exactly: "The source does not answer this."

Without this line, the model treats “I have to answer” as an implicit rule and will generate a plausible-sounding non-answer. With it, “no answer” becomes a first-class output.

The retrieval version

For anything larger than one document, this pattern is the foundation of retrieval-augmented generation (RAG):

  1. Store your documents (policy PDFs, product docs, past tickets) in a searchable index.
  2. When a question arrives, retrieve the top few relevant passages.
  3. Feed those passages into a grounded prompt like the one above.
  4. The model answers using retrieval context, quoting as it goes.

You don’t need to build a RAG system to use grounding — it’s just as useful for a single pasted document. But if you keep hitting the same “the model needs to know the whole handbook” problem, retrieval is the answer.

What grounding can’t fix

  • The source itself being wrong. If your policy doc is outdated, the model will faithfully quote outdated policy.
  • Retrieval missing the right passage. If the search step returns the wrong three paragraphs, the model has no way to know what it doesn’t know.
  • The model quoting and then adding an unsupported conclusion. Rare with a well-written prompt, but it happens. Include the conclusion in your review criteria.

Check your understanding

Quick check

—

Why does asking the model to "quote the source sentence before drawing any conclusion" reduce hallucination?