When an LLM produces a confident but incorrect answer, the fastest fix is not always a better prompt. This troubleshooting guide helps you classify the failure, trace it to unclear instructions, missing context, retrieval problems, stale data, sampling settings, or weak validation, and then verify the fix with a repeatable checklist.
Overview
LLM hallucinations are responses that present unsupported, inaccurate, or invented information as though it were reliable. They can appear as fabricated citations, incorrect calculations, nonexistent API parameters, invented records, or plausible answers to questions the system cannot answer from its available information.
An LLM generates likely text from patterns in its input and learned data; it does not automatically know whether every statement is true. Reliability therefore depends on the entire workflow: the user request, system instructions, supplied context, retrieval layer, model settings, output format, and review process.
Use this decision tree when an error appears:
- Is the task and expected answer unambiguous? If not, clarify the prompt, definitions, constraints, and refusal behavior.
- Does the model have the required information? If not, provide authoritative context or connect a suitable retrieval source.
- Did retrieval return the right information? If not, inspect ingestion, chunking, indexing, filters, ranking, and context placement.
- Is the information current and applicable? If not, refresh the source or label its date and scope.
- Can the answer be verified mechanically? If not, add citations, structured output, tests, or human review.
- Does the response vary across equivalent runs? If so, review sampling controls and evaluate consistency rather than relying on one example.
A useful diagnosis separates the symptom from the cause. “The answer is wrong” is a symptom. “The relevant document was not retrieved” or “the prompt asked for an exact value without supplying a source” is a testable cause.
Checklist by scenario
Scenario 1: The instruction is vague or internally inconsistent
Unclear requests encourage the model to fill gaps with assumptions. Check whether the prompt defines the task, audience, terminology, time period, allowed sources, and desired response. Look for conflicting instructions such as “be concise” alongside “explain every exception,” or “use only the supplied documents” alongside “add useful background from general knowledge.”
- State the task in one direct sentence.
- Define ambiguous terms, units, dates, and business rules.
- Separate instructions from reference material with clear labels.
- Tell the model what to do when evidence is missing: ask a question, say that the answer is unknown, or return a specified status.
- Request evidence for claims that require verification.
For reusable system prompt examples and prompt optimization patterns, document the intended behavior rather than relying on implied expectations.
Scenario 2: The answer requires information the model was not given
If the request depends on a private database, a recent event, an internal policy, or a specific version of a product, the model may not have enough context. Lowering creativity settings cannot supply missing facts.
First identify the minimum evidence needed to answer. Then provide it directly or route the request through a retrieval or API step. If no trustworthy source is available, design the workflow to abstain. A useful response can be: “I do not have enough information to verify this. Please provide the relevant record or source.”
Scenario 3: Retrieval returns the wrong context
In a retrieval-augmented generation workflow, an incorrect answer may begin before generation. The search query may be too broad, the document may have been split poorly, metadata filters may exclude the right record, or the retrieved passages may be similar in wording but unrelated in meaning.
- Log the user query and the retrieved document identifiers.
- Inspect the top results, not just the final answer.
- Check whether headings, tables, lists, and code examples survived ingestion.
- Test filters for tenant, permission, language, date, and document version.
- Compare retrieval results for paraphrased versions of the same question.
- Tell the model to answer only from relevant retrieved passages and to identify missing evidence.
Use the RAG Workflow Guide to review ingestion, chunking, retrieval, and answer generation as separate stages. If the context is being truncated, the LLM Context Window Management guide can help you inspect token budgets and ordering.
Scenario 4: The source is stale, incomplete, or outside its scope
A retrieved document can be relevant and still produce a wrong answer. Check its publication date, effective date, version, geographic scope, audience, and exceptions. A policy from one department may not apply to another. A technical example for one API version may not work with a later version.
Include source metadata in the workflow where it matters. Ask the model to report the applicable version or date, and reject documents that fail a freshness requirement. Do not silently merge conflicting sources; surface the conflict for resolution or route it to human review.
Scenario 5: The model makes unsupported claims or citations
Ask for claims to be tied to supplied evidence rather than asking for citations after the answer has already been generated. Require a citation identifier, quoted support, or an “unsupported” label for each material claim. Then validate that cited identifiers exist and that the cited passage actually supports the statement.
Citations are evidence of traceability, not proof by themselves. A generated link, document name, or quotation still needs checking.
Scenario 6: The output changes between runs
Variation can expose an unstable prompt, ambiguous inputs, or a task that is difficult for the selected model. Run the same test case several times and compare factual claims, classifications, tool calls, and formatting. Where the provider exposes sampling controls, use conservative settings for deterministic business tasks, but treat settings as one part of reliability rather than a substitute for evidence and validation.
Scenario 7: The answer is plausible but fails downstream
Natural-language output can look correct while containing invalid JSON, an incorrect field name, an unsafe action, or a calculation error. Add a schema or typed contract, validate the result in code, and retry or route failures according to a defined policy. The structured outputs guide covers validation and recovery patterns.
What to double-check
| Area | Questions to ask | Useful evidence |
|---|---|---|
| Prompt | Are the task, constraints, definitions, and refusal rules explicit? | Versioned prompt and test cases |
| Context | Did the model receive the facts needed for this exact request? | Rendered request and token or truncation logs |
| Retrieval | Were the correct, permitted, and current passages selected? | Query, ranked results, filters, document versions |
| Generation | Is the model being asked to infer beyond the evidence? | Response, settings, tool-call trace |
| Validation | Can claims, calculations, citations, and formats be checked? | Automated checks and reviewer decisions |
| Operations | Did a deployment, source update, or workflow change introduce the error? | Change log and incident timeline |
Capture the complete input and output for a reproducible test, while removing secrets and personal data according to your organization’s handling rules. Record the model or endpoint version when the system exposes it, the retrieval results, tool responses, validation outcomes, and whether a human approved the result.
After changing one component, rerun a small regression set that includes the failed example, near-misses, ambiguous requests, missing-source cases, and adversarially phrased inputs. The LLM Prompt Evaluation workflow provides a framework for comparing accuracy, consistency, and safety across prompt or model changes.
Common mistakes
- Using a longer prompt as the only fix. Extra instructions can add noise or push important evidence out of the usable context.
- Assuming low randomness means factual accuracy. A stable answer can still be consistently wrong if its source or premise is wrong.
- Adding “do not hallucinate” without an abstention path. Define what the system should return when it cannot verify an answer.
- Trusting retrieval because it returned something. Relevance, freshness, permissions, and completeness still require inspection.
- Validating only the format. Valid JSON does not mean correct facts, safe actions, or supported claims.
- Testing only happy paths. Include empty results, conflicting documents, stale records, malformed tool responses, and requests outside scope.
- Fixing production incidents without preserving a regression test. The same failure can return when the prompt, model, index, or source changes.
For workflows that can trigger external actions, add approval gates and failure recovery rather than allowing an unverified answer to directly update records or send communications. See the AI Workflow Automation Template for a way to map triggers, approvals, human review, and recovery paths.
When to revisit
Revisit this checklist whenever a hallucination appears, but also schedule reviews around workflow changes. Run a focused review before seasonal planning cycles if your source data, terminology, or business rules change on a regular calendar. Repeat it after changing the model, provider settings, system prompt, retrieval index, document-ingestion process, tool schema, or output validator.
Also reassess after a source migration, permission change, product-version update, or incident involving an unsupported claim. Content teams should repeat fact and citation checks before publishing; the AI Content QA checklist can support that review.
Use this final action sequence for the next failure:
- Save the exact request, response, context, retrieval results, and tool trace.
- Classify the symptom: ambiguity, missing context, retrieval, freshness, unsupported claim, variability, or validation.
- Change the smallest relevant component first.
- Test the failed case and a representative regression set.
- Confirm that the fix improves evidence and behavior, not merely wording.
- Document the cause, change, test result, and owner for the next workflow review.
The goal is not to make an LLM infallible. It is to make incorrect behavior detectable, explainable, and less likely to reach a user or trigger an action without appropriate verification.