Home
Blog
How to Reduce AI Hallucinations with Better Prompts

How to Reduce AI Hallucinations with Better Prompts

Learn how to reduce AI hallucinations with better prompts, grounding, and evals. Get before-and-after prompt examples you can apply in production today.

Mayank Gahlot
October 13, 2026
•
11 mins
TL;DR
  • Hallucination is a behaviour that is rewarded; it is important to reward abstaining from hallucination over guessing, on every occasion.
  • But with few-shot examples and stepwise reasoning, system prompts reduce errors drastically, but not completely.
  • The Retrieval-Augmented Generation (RAG) method relies on real sources for answers, but also stale documents produce new errors.
  • You need to measure the rate of hallucination, per 100 responses, or you cannot provide any evidence that any fix had an impact.

After discussing customer queries, a fintech company approached us with a problem. Its LLM assistant had added a repayment clause that wasn't in the agreement. It got into the hands of a customer before the team, and three weeks of perfect demos turned into compliance exposure. When the assistant said it, it was a pretty definite thing, and it was a lot more expensive to explain the error.

While there are ways of mitigating the risk of AI hallucinations, complete prevention isn't possible. From 150+ client engagements spanning 30+ industries, we've observed what prompts them and what fixes make the cut into production. This article covers system prompts, grounding, and model evaluation, with before-and-after prompt examples for each technique. It focuses on practical solutions, implementation, and costs rather than theory alone.

Already seeing wrong answers in your production LLM?

A 30-minute call with a BuildNexTech engineer reviews your prompts and retrieval setup, and shows where hallucinations are getting in.

Why Do AI Models Hallucinate?

Hallucination comes from how AI models are built and trained, not from random glitches. Four causes explain most of it:

  • Prediction, not knowledge: Large language models (LLMs) do not actually 'know' facts. They are statistical models trained to predict the most likely next token from patterns in massive text data, so generative models behave as prediction machines.
  • Lack of grounding: Models often answer from internal statistical weights instead of checking a live, trusted source or database.
  • Over-compliance: AI models are trained or fine-tuned to be helpful, so they tend to give an answer rather than admit uncertainty or say 'I don't know'.
  • Flawed training data: Gaps, bias, outdated facts or noisy text push the model to bridge the missing pieces with plausible-sounding fabrications.\

Multimodal models inherit the same flaws and can describe objects that are not in the picture. The deeper cause is incentive. OpenAI's 2025 research argues that training and evals reward guessing over admitting uncertainty. A model that answers everything outscores one that abstains, so it learns to bluff. Hallucination is not a bug waiting for a patch. It is a rewarded behaviour.

Prompts That Can Trigger AI Hallucinations

Trigger prompts share one trait: They ask the model to infer something you never gave it. Three typical examples follow.

Vague and Open-Ended Prompts

The human asked:
What is our refund window for annual plans?
The AI answered:
Annual plans can be refunded within 45 days of purchase.

A question with no source still looks answerable. The model guessed a typical-sounding figure.

Leading Prompts with False Premises

The human asked:
	How do I turn on the autoRetry flag in our payments API?
The AI answered:
  Set autoRetry=true in the request header, and failed charges will retry three times.

The model completes questions; it does not check them. It borrowed similar APIs name settings.

Prompts That Demand Specific Answers Without Evidence

The human asked:
Which peer-reviewed paper proves that few-shot prompting cuts hallucinations? Give the title, authors and DOI.
The AI answered:
Chen and Alvarez (2023), 'Few-Shot Prompting and Factual Accuracy in Language Models', DOI 10.1000/fs2023.45.

Citations follow a predictable pattern, so the model generated one that fits. That is how fabricated citations are born.

Questions About Things That Do Not Exist

The human asked:
Summarise the main features of the Zenvora Pipeline Suite for our vendor comparison.
The AI answered:
Zenvora Pipeline Suite offers real-time data sync, built-in SOC 2 reporting and a drag-and-drop workflow builder.

With no match found, it built a believable product from brochure language. Nothing hints that it is fictional.

Requests That Mention Documents You Never Attached

The human asked:
Summarise the attached contract and list the termination clauses. 
The AI answered:
The contract allows termination with 30 days' notice and a 5% early exit fee.

No file arrived, yet the model answered as if it had read one. It invented clauses that sound typical.

Requests Against Data the Model Has Never Seen

The human asked:
Write a SQL command that lists overdue invoices from our billing database.
The AI answered:
SELECT invoice_id, late_flag FROM billing_main WHERE late_flag = 1;

It has never seen your schema, so it invented a table and column. That SQL command fails the moment it runs.

Role-Play Prompts That Grant Permission to Invent

The human asked:
Act as a financial analyst from 2030 and tell me our exact revenue next quarter.
The AI answered:
Next quarter's revenue will reach $4.7 million, driven by a 12% rise in enterprise renewals.

Role-play switches off the fact-checker. The model blended real finance vocabulary with a made-up forecast.

Questions About Events After the Knowledge Cutoff

The human asked:
Summarise the data-retention rules that took effect last month.
The AI answered:
The new rules require providers to delete customer records after 90 days and report breaches within 24 hours.

The model cannot see past its training cutoff and rarely says so. It projected older rules forward.

Multi-Step Questions Without Room to Reason

The human asked:
A team clears 14 tickets a day. How many working days to clear 1,260 tickets? Reply with the number only.
The AI answered:
80 days.

The correct answer is 90 days. Forced to answer instantly, the model guessed.

Counting and Spelling Tasks

The human asked:
How many times does the letter r appear in the word strawberry?
The AI answered:
The letter r appears 2 times in strawberry.

The correct answer is 3. Models read chunks of text, not letters, so counting characters is a blind spot.

How to Detect and Prevent Hallucinations in AI Outputs

Hallucinations rarely announce themselves, so detection is a habit. Five signals catch most of them:

  • Hyper-specific details with no source: Exact dates, names, URLs or citations you cannot find.
  • Suspiciously smooth text: Balanced lists, round numbers or no concrete examples.
  • Broken time boundaries: References to events after the model's knowledge cutoff.
  • Claims you can split apart: Break a long answer into single facts and check each one.
  • Shaky consistency: Run the prompt several times and compare the answers.

Manual checks collapse at 5,000 queries a day, so production teams build layers: Prompts, system safeguards and evaluation. Our production-ready agent workflows show how they fit together.

Prevention at the prompt level

At the prompt level, prevention comes down to what you ask for. Tell the model to answer only from supplied sources, quote the exact passages before it writes, and say 'I don't know' when information is missing. The sections below show each pattern with before and after prompts. 

Prevention at the system level

  • AI guardrails flag or strip unsupported claims before a user sees them. NVIDIA NeMo Guardrails and Guardrails AI are two examples.
  • A verification system checks each claim against a source, which is knowledge verification in practice.
  • Restrict enterprise models to a verified knowledge base, not memory alone.
  • Route high-stakes outputs, such as healthcare, finance or legal work, to human-in-the-loop AI review.

LLM evaluation and model evaluation

  • Score groundedness (also called faithfulness) against a golden dataset of real questions.
  • Run Factual Question-Answering tests to measure factual accuracy.
  • Sample outputs with an LLM as a judge, then sends anything it flags to a human.
  • Add bias detection to the same suite.
  • Track hallucination rate per 100 responses with tools such as Galileo, Patronus AI or DeepEval.
  • Log every response with a trace ID, as a security service such as Cloudflare does with a Cloudflare Ray ID.

Prompt Engineering Techniques to Reduce AI Hallucinations

The AI prompt engineering best practices that hold up in production are the six below: Scoped system prompts, permission to abstain, few-shot examples, stepwise reasoning, source anchoring and self-verification.

These Prompt Patterns transfer across Claude Opus, models on the Gemini platform and custom GPTs. Behaviour differs by model, as our Claude API enterprise integration guide shows. Most take hours, not weeks.

Define Clear Instructions and Constraints in a System Prompt

A system prompt works when it states role, scope, format and banned behaviour. Allow 'unknown' in required fields, so a strict format never forces an invented value.

Before: You are a helpful assistant for Acme Lending.
 
After:
Role: Support assistant for Acme Lending.
Scope: Answer only from the provided context.
Format: Three sentences maximum, then the source ID.
Never: State figures, dates or clauses absent from the context.
If context is missing: Reply "Not found in the provided documents."

As the rule list grows, instruction-following degrades, and a longer system prompt is not a safer one. Keep it short and test every rule against failing queries. Setup time: A few hours to write and test against 20 questions.

Instruct AI Models to Acknowledge Uncertainty

Before: Summarise the termination terms in this contract.
 
After: Summarise the termination terms in this contract. If the
document does not say, reply "The document doesn't provide enough
detail." A gap is better than a guess I will act on.

Why it works: You have redefined what 'helpful' means. Given OpenAI's finding that guessing gets rewarded, permission to abstain removes the incentive to bluff and protects factual outputs.

Over-refusal is the counterintuitive pitfall: A cautious model may decline answers it knows. Score appropriate refusals as their own metric.

Use Few-Shot Examples to Improve Response Accuracy

A few shot prompting shows the model the answer shape you want. Include two or three examples, and make one a correct 'not enough information' response.

Q: What is the late fee on Plan A?  Context: [Plan A: 2% per month]
A: 2% per month. Source: Plan A.
 
Q: What is the late fee on Plan C?  Context: [Plan A: 2% per month]
A: Not enough information. Plan C is not in the context.

Examples fix format and tone but leak facts, so a wrong fact in an example gets repeated.

Break Complex Questions into Verifiable Steps

What is the chain of thought prompting? It asks the model to reason step by step before answering. In practice, chain of thought prompting splits a multi-part question into stages:

●       Extract the relevant facts.

●       State your assumptions.

●       Conclude from those alone.

●       Step back: Ask for the general principle first.

Each step becomes checkable, which makes model reasoning easier to audit. The limits are real: Extra tokens raise cost, and sound-looking reasoning can still rest on a false fact.

Anchor Answers with 'According To' Prompts

Name the document an answer must come from. Naming the source ties each claim to text you can check, but only when the document is supplied.

Before: Explain our data retention policy.

After: According to the Data Retention Policy below, explain our
retention rules. Do not use outside assumptions.

Add a Chain-of-Verification Step

Chain-of-Verification asks the model to draft an answer, write questions that test it, answer them independently and then revise. Published research reports fewer hallucinations, at the cost of extra model calls.

1. Draft an answer to the question.
2. List three questions that would verify its claims.
3. Answer each question separately, using only the context.
4. Revise the draft to match the verified answe

Reduce AI Hallucinations by Grounding Responses in Reliable Data

What does grounding in AI entail? Grounding AI involves linking every response to reliable source information provided when the AI is generated. The standard approach is called Retrieval-Augmented Generation (RAG): Retrieve relevant passages first and then generate the answer from the retrieved passages. In what way does retrieval-augmented generation work? The four steps of a RAG pipeline in a RAG system are: 

  • Chunk your knowledge base into passages.
  • Embed and index them in a vector store such as Pinecone, Weaviate, or Vertex AI on Google Cloud.
  • Retrieve the closest passages for each query.
  • Generate with that context.

LangChain and LlamaIndex orchestrate the flow. Our vector databases for enterprise GenAI guide compares the options.

Layer What it fixes Effort Main limit
Prompting Guessing, format, scope Hours Cannot add missing facts
RAG Missing or outdated facts Weeks Only as good as the sources
Guardrails Unsupported claims at output Days to weeks Rules miss novel failures
Evaluation Proof that fixes worked Days, then ongoing Needs a trusted golden dataset

A healthcare client asked why retrieval 'made things worse' at first. The index held three versions of one policy, so the model cited whichever it retrieved first. Deleting two stale files fixed more than any prompt rewrite. Cost is the usual objection, and a fair one:

  • Prompt changes cost hours.
  • RAG costs weeks.
  • One wrong answer in a lending or claims workflow can cost more than both combined.

Even grounded systems need monitoring in production, because source documents change after launch. Retrieval quality drifts quietly.

Conclusion

Prompts reduce errors, grounding supplies the facts, and evaluation proves any of it worked. Teams that treat AI hallucinations as a one-off prompt rewrite tend to ship the same bug twice, because nothing tells them when a fix stopped holding, and nobody notices until a customer does.

The better question for your next sprint is not how to stop the model guessing. It is how quickly you would notice if it started again, and who on your team would own the answer. Most teams cannot say yet.

Will your current setup hold up at scale?

Teams in 30+ industries rate BuildNexTech 4.3 on Trustindex; a 30-minute call ranks your gaps and fixes, with no commitment.

People Also Ask

What is prompt engineering?

Prompt engineering is the practice of designing and testing the instructions, examples, and constraints that steer a model towards accurate output. Teams version prompts like code and evaluate them.

Does lowering the temperature reduce AI hallucinations?

Partly. Lower temperature makes output more deterministic and cuts random errors, but a model can still repeat the same confident falsehood every time, so it never replaces grounding.

Context engineering vs prompt engineering: What is the difference?

Prompt engineering shapes the instruction, while context engineering controls everything the model sees at runtime, such as retrieved documents, memory, and tool outputs. Production systems need both.

Should we fine-tune a model or use RAG to improve accuracy?

Use RAG first for facts that change. Fine-tuning teaches style and domain behaviour, not reliable recall, so a fine-tuned model still guesses when the answer is missing.

How often should we re-run LLM evaluation?

Run it on every prompt, model, or source-data change, plus a scheduled weekly sample in production. Document drift and provider updates can quietly raise your hallucination rate.

Don't forget to share this post!