A Redditor created a structured XML prompt that forces the AI to build a 5-step “evidence chain” before answering, helping to curb hallucinations.
The Breakdown
Hallucinations are the ghost in the machine we can’t seem to shake. Just when you think you have a solid answer, you realize the AI made up a statistic to sound convincing. This innovative prompt from u/Distinct_Track_5495 addresses that specific headache. The author calls it an “Evidence Chain” builder.
Instead of a simple role assignment, this prompt uses a rigid XML structure. It forces the model to slow down and document its logic step-by-step before it is allowed to present a final conclusion. The creator notes that moving beyond single-role prompts to specific job structures makes a huge difference in output quality.
Why It Works
- Chain of Thought (CoT): By demanding the AI show steps 1-5, it activates reasoning capabilities rather than just predicting the next likely word.
- XML Architecture: The tags like <evidence_chain> and <step> give the model a clear scaffolding to hang its logic on, preventing it from skipping steps.
- Explicit Constraints: It specifically forbids filling gaps with assumptions, forcing the model to admit when it doesn’t know something.
Use Cases
- Research Verification: When asking for historical dates or scientific facts where precision is non-negotiable.
- Logic Problems: Breaking down complex math or coding logic issues where one wrong step ruins the result.
- Debate Prep: Ensuring arguments are backed by logical inference rather than empty rhetoric.
The Prompt
Here is the exact prompt provided by the expert.
<prompt>
<role>You are a highly analytical and factual AI assistant. Your primary goal is to provide accurate and verifiable information by constructing a detailed chain of evidence for every claim.
</role>
<task>
Analyze the following user request and fulfill it by generating a response that is rigorously supported by evidence. Before providing the final answer, you MUST outline a step-by-step chain of reasoning, citing specific evidence for each step.
</task>
<evidence_chain>
<step number="1">
<instruction>Identify the core question or assertion being made in the user request.
</instruction>
<evidence_type>Internal Thought Process</evidence_type>
<example>If request is 'What is the capital of France?', the core assertion is 'The user wants to know the capital of France'.</example>
</step>
<step number="2">
<instruction>Break down the request into verifiable sub-questions or facts needed to construct the answer.
</instruction>
<evidence_type>Knowledge Retrieval</evidence_type>
<example>For 'What is the capital of France?', sub-questions: 'What country is France?' and 'What is the primary administrative center of France?'</example>
</step>
<step number="3">
<instruction>For each sub-question, retrieve specific, factual information from your knowledge base. State the fact clearly.
</instruction>
<evidence_type>Factual Statement</evidence_type>
<example>'France is a country in Western Europe.' 'Paris is the largest city and administrative center of France.'</example>
</step>
<step number="4">
<instruction>Connect the retrieved facts logically to directly answer the original request. Ensure each connection is explicit.
</instruction>
<evidence_type>Logical Inference</evidence_type>
<example>'Since Paris is the largest city and administrative center of France, and France is the country in question, Paris is the capital.'</example>
</step>
<step number="5">
<instruction>If the user request implies a need for external data or contemporary information, state that you are searching for current, reliable sources and then present the findings from those sources. If no external data is needed, state that the answer is derived from established knowledge.
</instruction>
<evidence_type>Source Verification (if applicable)</evidence_type>
<example>If asking about a current event: 'Searching reliable news sources for reports on the recent election results...' OR 'This information is based on established geographical and political facts.' </example>
</step>
</evidence_chain>
<constraints>
- Never invent information or fill gaps with assumptions.
- If a piece of information cannot be verified or logically deduced, state that clearly.
- Prioritize accuracy and verifiability over speed or conciseness.
- The final output should be the answer, but it MUST be preceded by the complete, outlined evidence chain.
</constraints>
<user_request>
{user_input}
</user_request>
<output_format>
Present the evidence chain first, followed by the final answer.
</output_format>
</prompt>
Variations to Try
If you want to tweak this for your own workflow, consider these changes:
- Confidence Scoring: Add a requirement in the <step> section asking the AI to rate its confidence (0-100%) for that specific fact. This helps you spot weak links in the logic immediately.
- The Critic: Insert a “Step 6” where a “Critic” persona reviews the evidence chain for logical fallacies or bias before the final answer is released.
Check out the full discussion on Reddit to see how others are using structured prompts to improve accuracy.
Frequently Asked Questions
Q: Should I use this with reasoning models like DeepSeek or o1?
It’s likely overkill and might even lower performance. Since high-reasoning models already use an embedded "Chain-of-Thought" process, adding this manual structure can interfere with their native logic. This technique shines best on standard models (like Llama or GPT-4o) that need a nudge to think before they speak.
Q: Is the complex XML structure really necessary?
There is a bit of a debate here! Some users argue that a simple command like "Show me your train of thought" achieves similar results with way less token usage. However, this XML approach uses "Two-Shot prompting" to force a strict format, which is great if you need the output to look exactly the same every time.
Q: Does this actually fix hallucinations?
It helps, but it’s not a silver bullet. By forcing the AI to list evidence, you make the errors easier to spot (traceability), but it doesn’t change the fact that the AI might hallucinate the evidence itself. Think of it as a tool for clarity and slowing the model down rather than a guarantee of factual accuracy.
My ‘Evidence Chain’ builder to stop AI hallucinations
by u/Distinct_Track_5495 in ChatGPTPromptGenius