How to Stop AI from Hallucinating A
The secret is a technique I call "Negative Constraint Anchoring." Instead of just telling the AI to "be accurate," you give it a social and logical "out"—a specific permission to admit ignorance—and then force it to cite its own internal logic before providing the final answer.
Here is the prompt structure I've been using for high-stakes data extraction and factual summaries:
Act as a Fact-Checking Analyst. Your goal is to extract information from the provided text with 100% accuracy.
Follow these strict operational constraints:
1. Zero-Guessing Policy: If the answer is not explicitly stated in the source text, you must respond with "Information not available in source." Do not use your internal general knowledge to fill gaps.
2. Chain-of-Verification (CoV): Before providing the final answer, create a "Verification" section. In this section, quote the exact sentence from the text that supports your answer. If no such sentence exists, trigger the Zero-Guessing Policy.
3. No Inference: Do not assume relationships. If the text says "A is the CEO" and "B is the CFO," do not state "A and B lead the company" unless that specific phrase is used.
Source Text: [Insert Text Here]
Question: [Insert Question Here]
Output Format:
- Verification: [Exact quote or "Not found"]
- Answer: [Concise answer or "Information not available in source"]Why this actually works is that it changes the model's objective function. Standard prompts reward the AI for being helpful, which is exactly where hallucinations come from—the AI prefers a "plausible" wrong answer over a "boring" I don't know. By implementing a Zero-Guessing Policy, you shift the reward toward accuracy.
The Chain-of-Verification is the real engine here. When the AI is forced to quote the source first, it performs a self-attention check. It has to locate the token in the source text before it generates the answer. If it can't find the token, the probability of it generating a hallucination drops significantly because it has already flagged the absence of the evidence in the verification step.
I tested this on a 50-page technical manual where GPT-4o was previously hallucinating specific voltage requirements. With a standard prompt, it guessed "12V" (which was common for similar devices but wrong for this one). With this prompt, it hit the "Information not available in source" trigger because the specific voltage for that model wasn't in the snippet provided.
Key takeaways for your own prompt iterations:
Force a "null" option. Give the AI a specific phrase to use when it's unsure. This removes the pressure to be "helpful."
Require evidence first. Always make the AI show its work (quotes, citations, or logic steps) before the final answer. If the evidence is wrong, the answer will be wrong, making it instantly obvious to you.
Ban inference. Tell the AI specifically not to "read between the lines." Hallucinations often live in the gap between what is written and what the AI thinks is implied.
All Replies (0)
No replies yet — be the first!
