Grounded Prompts and Citations

Harry · 13 Sep 2026 · 1 views

Write a Grounding Prompt

The prompt tells the model where its answers may come from. Without it, the model drifts back to memory.

SYSTEM = (
    "You are a support assistant. Answer ONLY from the notes "
    "below. If the notes do not contain the answer, say you "
    "don't know. Do not invent details."
)
prompt = f"{SYSTEM}

Notes:
{context}

Question: {question}"

Requiring Citations

Ask the model to reference chunks by their IDs, so users can read the original text and trust the answer.

prompt = (
    "Answer from the notes and end with the chunk ids you used.

"
    f"Notes:
{with_ids}

Question: {question}"
)

Handling No-Context

When retrieval returns nothing useful, answer honestly. Falling back to memory quietly reintroduces hallucinations.

Key Points

  • Restrict the model to the retrieved notes.
  • Ask for chunk IDs to cite sources.
  • Let the model say it doesn't know.
  • Clean prompt design beats bigger models for grounded answers.
Share this post:

Comments (0)

Please login or register to comment.