Hallucinations are a minor annoyance in a chat window and a serious problem inside a product. A support bot that invents a refund policy, a legal tool that cites a case that never happened or an SEO feature that links to pages that do not exist damages trust, creates rework and, in regulated work, liability. No current model is free of them, so businesses must design around them.

Hallucinations cannot be removed by a better prompt alone, but they can be reduced to a level a business can accept by grounding answers in approved data, restricting choices to known lists, letting the model say it does not know, splitting large tasks, verifying output in code and keeping people in review where errors are costly.

This article explains why models hallucinate, the forms they take in business software, the controls at each layer and how two delivered projects brought them under control. It does not cover image generation or model training.

Key takeaways

  • Models hallucinate partly because training and evaluation reward confident guesses over admitting uncertainty.
  • Even specialist tools hallucinate: a Stanford study found leading AI legal research tools hallucinated in 17% to 33% of queries.
  • The most effective controls sit outside the prompt: approved data, closed lists, validation in code and human review.
  • Give the model an explicit way to answer "not found", and treat that answer as a success.
  • Build a set of real failure cases and test every prompt or model change against it.
  • In a delivered SEO tool, restricting link suggestions to an approved URL list brought hallucinated URLs in production down to zero.

Why models hallucinate

A language model produces the most plausible continuation of its input. When it lacks the facts, a plausible guess often looks the same as a correct answer. OpenAI's research on why language models hallucinate, published in September 2025, argues that common training and evaluation methods reward guessing, because accuracy-only scoring gives no credit for saying "I don't know", and proposes giving confident errors a heavier penalty than expressions of uncertainty.

NIST's Generative AI Profile of its AI Risk Management Framework lists the same problem as "confabulation": generative systems confidently presenting false or erroneous content. It treats it as a risk to manage, alongside privacy and security.

Specialist products are not immune. Researchers at Stanford, in Hallucination-Free? Assessing the Reliability of Leading AI Legal Research Tools, found that Lexis+ AI and Westlaw AI-Assisted Research each hallucinated between 17% and 33% of the time on their benchmark, despite using retrieval over legal databases.

How hallucinations show up in business software

TypeExampleTypical cause
Invented referencesLinks to pages, case citations or product SKUs that do not existThe model generates identifiers it has never been shown
Wrong factsAn incorrect price, date, dosage or policy detailMissing or outdated data, a guess filling the gap
Unsupported conclusionsA summary states something the source document never saysLong inputs, mixed topics, pressure to produce an answer
Misread inputsFigures from the wrong page or the wrong person in a case filePoor document extraction, too much content in one request
Tool misuseAn agent calls a function with invented arguments or IDsLoose tool definitions, no validation of arguments
Instruction driftTitles grow longer, required sections disappearVague constraints, no checks on output
Sampled AI outputs classified by hallucination type, with counts for invented links, wrong facts and unsupported claims

Controls at each layer

LayerControlWhat it prevents
DataGround answers in retrieved, approved sourcesWrong and outdated facts
ChoicesGive the model a closed list of allowed values, such as URLs, SKUs or categoriesInvented references
InstructionsAllow and encourage "not found" answers, require sources for claimsGuesses presented as facts
Task designSplit large jobs into focused steps with their own instructionsUnsupported conclusions, misread inputs
VerificationCheck references, numbers and formats in code before useErrors reaching users or systems
PeopleHuman review where mistakes are costlyLegal, medical and financial harm
MonitoringSample production output, track error rates, keep a regression setQuality slipping after changes

Ground answers in your own data

Retrieval-augmented generation gives the model relevant passages from your documents, knowledge base or catalog with each request, and instructs it to answer only from them. Good retrieval matters as much as the model: if the right passage is not found, the model fills the gap. Our guides to RAG and fine-tuning and hybrid search cover how to build it.

Restrict choices to known lists

When the output must reference something real, such as a page, product or customer, pass the list of valid options and check the result against that same list in code. The model then selects, and selection is far more reliable than generation.

Make "I don't know" an acceptable answer

Tell the model what to do when the sources do not contain the answer, give it a field or phrase for that case and make sure the application handles it gracefully. A product that punishes empty answers will get invented ones.

Split large tasks

One request that asks a model to read 250 pages and answer twenty questions invites mixed-up details. Separate steps, each with its own focused context, examples and output template, keep each answer tied to the right part of the input. Our guide to context engineering explains how to structure them.

Verify before use

Check every identifier, number and required section in code before output reaches a user or another system, and retry or reject what fails. Our guide to LLM structured output covers validation and retries.

AI feature giving answers you cannot trust? We trace the causes of hallucinations and add grounding, validation and review to production AI systems.

Explore AI services

Two delivered projects

Zero invented URLs in an AI SEO assistant

A US MarTech startup sells an SEO assistant that runs inside its clients' content management systems. Its AI features suggested internal links to URLs that did not exist, used anchors that did not match their destinations and wrote titles that were too long and stuffed with keywords. Every suggestion needed manual checking. A .wrk backend developer and AI engineer:

  • Built a failure taxonomy from production samples.
  • Rewrote the link prompt so the model can only choose from an approved list of URLs, with context-aware anchors and relevance rules.
  • Rewrote the title prompt with intent-aware keywords, rules against keyword stuffing and hard character limits.
  • Added regression checks for every scenario that had failed before, and documented the prompt rules for future model changes.

The service layer in Go and PostgreSQL stayed unchanged. Hallucinated URLs in production dropped to zero, and titles became usable without manual rewriting. Read the AI SEO tool case study.

Five focused assistants for 250-page legal case files

Attorneys at Brandon J. Broderick, a US personal injury law firm, prepare legal opinions for insurance claims from bundles of about 250 pages of medical records, police reports and notes. A single prompt could not handle the volume or keep topics apart. A .wrk team split the work across five specialized assistants, each with its own questions, examples, decision templates and instructions for edge cases, and formatted the output to the firm's template with key conclusions in bold, so attorneys can verify and supplement each draft quickly. Attorney throughput improved about 1.5 times, at $3–4 in API fees per case file. Read the AI legal document processing case study.

AI-drafted legal opinion with key conclusions linked to the source pages they came from

Measuring hallucinations

  1. Sample production output every week, across use cases and input types.
  2. Classify the errors by type, using a taxonomy like the table above.
  3. Keep a regression set of real failures with the correct answers.
  4. Run it on every change to prompts, retrieval, models or data.
  5. Track rates over time, including the share of "not found" answers, which should rise when retrieval fails and fall when it improves.
  6. Collect user feedback with a simple way to flag wrong answers inside the product.

Common mistakes

  • Trusting a better prompt to fix it. Prompts help, but checks in code and approved data do most of the work.
  • Letting the model generate identifiers. URLs, IDs and citations must come from your systems.
  • Forcing an answer. Interfaces and schemas without a "not found" option push the model to guess.
  • Sending everything in one request. Long, mixed inputs blur details.
  • No regression set. A model upgrade quietly brings old errors back.
  • Removing human review too early. In legal, medical and financial work, people stay in the loop until error rates are measured and acceptable.
FAQ

Frequently asked questions

What is an AI hallucination?

An AI hallucination is output from a language model that is presented as fact but is false, unsupported by the given sources or invented, such as a nonexistent citation, URL, figure or policy.

How do you prevent AI hallucinations?

Ground answers in approved data, restrict references to known lists, allow the model to answer "not found", split large tasks into focused steps, verify output in code and keep human review where errors are costly.

Does RAG eliminate hallucinations?

No. Retrieval reduces hallucinations by giving the model relevant sources, but models can still misread or go beyond them, and poor retrieval leaves gaps the model may fill. Verification and testing are still needed.

Why do AI models make things up?

Models generate plausible text, and when they lack information a plausible guess looks like an answer. Research from OpenAI argues that training and evaluation methods that reward guessing make the problem worse.

How do you measure hallucination rates?

Sample real outputs, check them against sources or known answers, classify the errors by type and track the rates over time with a fixed regression set that runs whenever prompts, data or models change.

To sum up

Hallucinations come with today's language models, so business applications must be designed around them. Ground answers in approved data, let the model choose from real lists, make "not found" acceptable, split big tasks, verify every reference and number in code, keep people in review for high-stakes work and test every change against real failures.

.wrk builds and repairs AI features for companies in the US and Europe, including grounding, validation, evaluation sets and review workflows that keep output trustworthy.

Want an AI feature your team can rely on? Share examples of the errors you see, and we will propose controls and a test plan.

Explore AI services