Skip to main content

Your buyers are asking AI. Are you the answer?

Find out with OptimizeCamp →
Back to Blog
hallucinationsaccuracygroundingprompt engineeringverificationRAG2026

How to Stop AI Hallucinations: 9 Prompting Fixes That Work

Practical techniques to stop AI hallucinations: ground the model in sources, allow 'I don't know', demand citations, verify claims, and route risky tasks.

July 18, 2026
Updated November 27, 2026
12 min read

TL;DR

AI hallucinations are confident, fluent, wrong answers, and most of them are preventable at the prompt level. The highest-leverage fixes: paste the source material instead of relying on the model's memory, explicitly permit 'I don't know', demand citations tied to the text you provided, and split generation from verification with a second pass. For knowledge beyond the context window use retrieval, route math to code execution, and route current events to search-grounded models. None of this requires an API, just better prompts.

An AI hallucination is a confident, fluent, completely wrong answer: a fabricated statistic, a paper that doesn't exist, or a quote nobody said. It is the single biggest reason professionals distrust AI output, and here is the part most people miss: the majority of hallucinations are preventable with better prompting. Not eliminated by some future model, but preventable today with techniques that take one extra sentence. This guide covers why models make things up, the nine fixes that work, and how to build a workflow where fabrications get caught before they cost you.

Why AI Makes Things Up

A language model is not a database with a lookup function. It is a prediction engine: given your prompt, it generates the most statistically likely continuation, token by token. When you ask a question, you are not retrieving a stored fact; you are sampling from a probability distribution shaped by training data.

That design has a built-in failure mode, which the OWASP Top 10 for LLM Applications tracks as a primary reliability and misinformation risk for production AI systems. When the true answer is thinly represented in training data, or absent entirely, the most likely-sounding continuation is still a fluent, specific, confident answer. "I don't know" is rarely the highest-probability output, because training corpora are full of questions followed by answers, not questions followed by abstentions. The model is not lying; it is doing exactly what it was built to do, in a situation where that produces hallucination.

Understanding this explains both halves of the problem:

  • Why it happens where it happens: niche facts, precise citations, post-cutoff events, and arithmetic are all places where prediction and truth diverge
  • Why prompting fixes it: every technique below works by changing what the most likely output is, anchoring it to provided text, licensing abstention, or making fabrication structurally harder

21.8 / 100

Average quality score of 1,324 real-world prompts in our State of AI Prompting study, with most missing the context and constraints that prevent hallucination

That number matters here: our study of 1,324 real prompts found the average prompt supplies almost none of the grounding that keeps a model honest. The hallucination problem and the prompt-quality problem are substantially the same problem.

The 9 Fixes, In Order of Leverage

1. Ground the Model in Your Source Material

The highest-leverage fix by a wide margin. Instead of asking from the model's memory:

❌ "What were the key findings of the Henderson report?"

Paste the material and scope the task to it:

✅ "Here is the Henderson report: [pasted text]. Using only this document, list the key findings. Do not add information from outside the document."

This converts the task from recall, where fabrication thrives, to reading comprehension, which models do far more reliably. Grounding is the difference between asking someone to recite a book from memory and handing them the book. Separating your instructions from pasted reference text with clear delimiters or XML tags, as recommended in Anthropic's Claude prompting best practices, further reduces ambiguity about what counts as source evidence.

With late-2026 context windows, "paste the source" scales further than most people think: OpenAI's GPT-6.2 Sol documentation lists a 1.05M-token context window (922K max input, 128K max output, shared with GPT-6.2 Astra), while Claude Opus 5.5, Claude Sonnet 5.5, Gemini 4 Neon, Gemini 4 Carbon (detailed on Google AI Studio pricing), and DeepSeek V4 Pro (listed in DeepSeek's API pricing docs) each support 1M-token windows. Entire report sets fit in one prompt. For choosing the right model for long-document work, retrieval accuracy at depth matters more than raw window size.

2. Give Explicit Permission to Say "I Don't Know"

One sentence, outsized effect:

"If the provided material doesn't contain the answer, say 'The source doesn't cover this' instead of guessing."

Models are trained on text where questions get answered, so answering is the default even when the honest move is abstaining. Explicit permission, or better yet an explicit instruction, to abstain changes the probability landscape. The model no longer has to choose between fabricating and disobeying.

This works on ungrounded prompts too: "If you're not confident this is accurate, say so" measurably reduces confident fabrication on factual questions.

3. Demand Citations Tied to Your Source

"For every claim, quote the specific sentence from the document that supports it."

Fabricating a fact is easy. Fabricating a verbatim quote that must exist in text sitting in the context window is much harder, and instantly checkable. Citation requirements do double duty: they suppress fabrication during generation and give you a ten-second verification path afterward.

Important distinction: citations to your provided source are reliable; citations to the open web from memory are one of the highest-hallucination outputs that exist. Never ask an ungrounded model for a bibliography, because that is how professionals end up citing cases or papers that do not exist.

4. Constrain the Scope of the Question

Broad questions invite padding. "Tell me everything about our competitor's pricing strategy" will get gaps filled with plausible invention. Narrow it to what is answerable:

"Based on the pricing page copied below, list each plan, its price, and its stated limits. If a detail isn't on the page, mark it 'not stated.'"

The tighter the question maps to the source, the fewer gaps exist for the model to fill incorrectly. This is the same principle behind role and context in prompt structure: specificity is not pedantry, it is error prevention.

5. Lower the Temperature for Factual Work

When you control sampling settings in an API, playground, or builder tool, the temperature setting governs randomness. High temperature encourages creative, less-probable continuations: useful for brainstorming, harmful for facts. For factual tasks on models that expose temperature, set it at or near 0 so the model commits to its most probable answer.

This is a supporting fix, not a primary one: a low-temperature model still hallucinates confidently when ungrounded, and always-on reasoning models like GPT-6.2 Sol and Claude Opus 5.5 rely primarily on reasoning effort rather than sampling temperature. Still, when temperature is configurable, lowering it removes the variance where a model that knows the right answer occasionally samples a wrong one.

6. Separate Generation from Verification

Models are meaningfully better at checking claims than at not making false ones, because verification is a different task with different incentives. Use that:

"List every factual claim in your answer above. For each, state whether the provided source directly supports it, partially supports it, or doesn't mention it."

Run this as a second message after any answer that matters. Self-consistency approaches extend the idea by sampling multiple answers and checking consensus, and a chain-of-thought request ("show the reasoning that led to each claim") exposes fabrications by making the model show work it does not have.

For the highest stakes, verify across models: paste Model A's answer into Model B and ask it to challenge every claim against the source. Independent errors rarely agree. Treating verification as a separate operational control aligns with the measurement and governance practices in the NIST AI Risk Management Framework. In production pipelines this second pass is automated as AI hallucination detection: the answer is split into atomic claims, and each claim is checked for entailment against the retrieved source, so unsupported claims are flagged before a human ever reads the output.

7. Use Retrieval When Knowledge Exceeds the Context

When the knowledge base is too large to paste, such as a documentation set, knowledge archive, or product catalog, retrieval-augmented generation automates grounding: fetch the passages relevant to each question and inject them into the prompt at ask time. The model answers from retrieved text, not memory, with all the benefits of fix #1 at scale.

RAG has its own failure modes, because retrieval that misses the right passage produces a grounded-looking wrong answer. If you are building a retrieval pipeline, start with our RAG prompt engineering guide and the fine-tuning vs prompting vs RAG decision framework.

Two categories of hallucination are best solved by routing around the problem entirely:

  • Numbers: A language model predicts arithmetic rather than computing it, and plausible-looking wrong totals are the signature failure. For anything quantitative, use a model with code execution: GPT-6.2 Sol and GPT-6.2 Astra paired with a Python sandbox run real calculations against your data and return verified numbers instead of estimates
  • Current events: Anything after the training cutoff is fabrication territory by definition. Use search-grounded tools such as Grok 4.7's live X integration, Perplexity's cited search, or a flagship model's web browsing mode so the model looks instead of remembers

The general principle is straightforward: do not prompt-engineer your way through a task the model is structurally wrong for. Route it to code execution for math or to dedicated search tools like Perplexity's cited research plans for live web facts.

9. Make Uncertainty Visible

The final layer: instruct the model to expose its own doubt.

"Flag any claim you're not highly confident in with [UNVERIFIED], and note what would be needed to confirm it."

This does not prevent hallucination; it converts silent fabrication into reviewable doubt, which is what makes the difference in a real workflow. An answer with two [UNVERIFIED] flags tells you exactly where to spend your checking time. An answer with none and no grounding tells you to check everything.

Info

Most of these fixes are one sentence each; the problem is remembering all of them every time. The SurePrompts builder bakes grounding instructions, abstention permission, and output constraints into generated prompts automatically, and the prompt scorer shows you exactly which accuracy safeguards your current prompts are missing.

Where Hallucination Risk Is Highest

Calibrate your checking effort to the risk zones:

Risk zoneWhy it's dangerousPrimary fix
Citations, quotes, URLs, case lawAssembled from plausible fragments; often unresolvableGround + demand verbatim quotes (#1, #3)
Niche/specialist factsThin training coverage; prediction fills the gapGround in authoritative source (#1)
Numbers and arithmeticPredicted, not computedRoute to code execution (#8)
Post-cutoff eventsModel literally cannot knowRoute to search grounding (#8)
Long reasoning chainsOne early invention compoundsVerification pass (#6)
Broad "tell me everything" asksGaps invite paddingConstrain scope (#4)

A Practical Anti-Hallucination Workflow

For any output where being wrong has a cost, run this sequence:

  • Ground: paste the source; scope the answer to it; permit abstention (fixes #1, #2, #4)
  • Cite: require claims tied to quoted passages (#3)
  • Verify: run a second pass asking the model to check each claim against the source (#6)
  • Route: send numbers to a sandbox and current events to search (#8)
  • Spot-check asymmetrically: manually verify only the claims that carry consequences, meaning anything you will repeat, cite, or decide on

This takes two extra minutes per task. Against the cost of repeating a fabricated statistic in front of a client, it is the cheapest insurance in your workflow.

Model Notes: Matching Models to Grounding Needs

Model choice is the last 20%, and it is workload-specific. As outlined in Anthropic's Claude Opus 5.5 prompting guide and current provider model specs, each family brings different architectural levers to accuracy:

  • Claude Opus 5.5 and Claude Fable 5.2 ($4/$20 and $8/$40 per 1M API tokens) include a flat 1M-token context window and always-on thinking, making them well suited to pasting large source packets and running explicit XML-delimited citation checks (see our guide to long-context document analysis)
  • GPT-6.2 Sol and GPT-6.2 Astra ($2/$10 and $8/$40 per 1M API tokens, 1.05M context window) combine always-on reasoning (starting at medium effort) with code execution in ChatGPT and developer sandboxes, eliminating mental-arithmetic errors on quantitative tasks
  • Gemini 4 Neon and Gemini 4 Carbon ($3/$15 and $4/$20 per 1M API tokens, 1M shared context window) pair high-effort thinking with long-horizon verification capabilities for sprawling technical and document workflows
  • Grok 4.7 ($2/$6 per 1M API tokens, 500K context window) reduces current-events fabrication specifically when paired with live X search, because it can retrieve active posts instead of guessing from training memory
  • DeepSeek V4 Pro ($1.32/$3.96 peak, half off-peak, 1M context, MIT open weights) makes multi-pass self-verification and cross-model checking economical at high volume

The through-line stays the same across every generation: a grounded, constrained prompt on any current flagship beats an ungrounded prompt on any model.

The Bottom Line

Hallucination is not a bug that a single model release will patch away; it is the default behavior of prediction engines asked to work without grounding. That is actually good news, because it means the fix is in your hands today: give the model the source, permit it to abstain, demand citations, verify before you trust, and route structurally risky tasks to tools built for them.

The pattern behind all nine fixes is the same one behind prompt engineering generally: the quality of what comes out is set by the structure of what goes in. Our State of AI Prompting study put a number on it: the average real-world prompt scores 21.8/100, missing precisely the context and constraints that keep models honest. Fix the prompt, and most of the hallucination problem goes with it. The SurePrompts builder handles that structure automatically so the one extra sentence that prevents a fabricated fact is never the sentence you forgot.

Try it yourself

Build expert-level prompts from plain English with SurePrompts — 330+ templates with real-time preview.

Open Prompt Builder

Ready to write better prompts?

SurePrompts turns plain English into expert-level AI prompts. 330+ templates, real-time preview, works with any model.

Try AI Prompt Generator