Skip to content

4.4 Diagnosing Prompt Failure, Hallucination, and Model Mismatch

Diagnosis is a fixed method that you follow, not a search for a ready answer. You find why a Claude system fails before you change anything. In a prompt failure, the instructions are the problem. A hallucination is confident fabrication. The model invents entities, citations, figures or clauses, and they are fluent enough that a non-expert would accept them. In a model mismatch, the task exceeds the model tier.

This lesson uses one made-up example throughout: a pub whose Claude assistant answers customers from retrieved passages of its menu, allergen sheet and booking rules. After the pub loads a winter menu, the assistant starts to describe a dish with nuts as nut-free. The model and the latency are unchanged.

  1. Trace and reproduce. A trace records the inputs to the request (prompt version, retrieved context, tool results) and the output. Domain 3 built this tracing system, and Domain 4 uses it. One bad output proves nothing in a non-deterministic system. So confirm a pattern across cases, not a single run. The pub collects the trace of every wrong allergen answer since the menu load.
  2. Isolate the stage. Let the evidence point to a pipeline stage before you name a failure class. The pub’s errors began with the menu load, and the model and latency did not change. This evidence points to retrieval and indexing before anyone says the word “hallucination”.
  3. Classify against the signatures (the typical symptoms of each class) below: prompt failure, hallucination (grounding or generation), model mismatch. Each has a recognisable signature.
  4. Run the cheapest decisive test for the hypothesis: the check that confirms or excludes the hypothesis.
  5. Fix at the failing layer , never at the layer that is merely easiest to change. The reflex fixes, “upgrade the model” and “rewrite the prompt harder”, are conclusions without a diagnosis. They skip steps 2 to 4, so they can change a layer that never failed. This objective’s wrong options are built from these reflex fixes.
  6. Create regression cases (objective 4.2) from the failing inputs, so the diagnosis remains after the incident ends.

The signature: format drift, violated output contracts (outputs that break the specified format), rules ignored or applied inconsistently, and behaviour varying with phrasing on identical inputs. Failures cluster where the instructions do not fully specify the behaviour. The pub’s booking replies switch between list and paragraph as the wording changes.

The decisive test: a clarified, structured prompt (explicit rules, delimited data, an exact-format example) fixes the failing cases while everything else stays constant. Anthropic’s consistency guidance lists these methods.

  • Specify the output format precisely.
  • Constrain with examples.
  • Use structured outputs where schema conformance must be guaranteed.

Fix the prompt at the cheapest layer of Domain 2’s ladder: clarity, then examples, then reasoning. A model upgrade is the wrong fix. A larger model also follows ambiguous instructions, at a higher cost.

In a grounding failure, the context was wrong, stale or missing, and the model answered faithfully from it. The cue: wrong answers correlate with corpus events (a refresh, a migration, the pub’s menu load) or with degraded retrieval-quality signals. The fix is upstream in the Domain 3 pipeline: re-index, re-embed, repair retrieval. No instruction fixes the context.

In a generation failure, the trace shows the right passages, and the answer contradicts or exceeds them. On an older dish, the trace lists walnuts, yet the assistant says that the dish is nut-free. The fix is a set of grounding techniques. Anthropic’s reduce-hallucinations guidance lists these methods.

  • Explicitly allow the answer “I don’t know”. This option drastically reduces false information.
  • Extract word-for-word quotes first for long documents.
  • Require citations, and retract any claim without a supporting quote.
  • Restrict answers to the provided text.
  • Use chain-of-thought or best-of-N verification.

Then measure faithfulness, so the rate is a number, not an anecdote.

Grounding failures and generation failures are fixed in different places. One hallucination fix for every wrong answer guarantees that half the fixes go to the wrong layer. This one-fix approach is the classic wrong answer.

The signature: uniformly mediocre quality on the hard cases across prompt variants. Failures persist with a clean prompt and verified-correct context. Quality changes with task difficulty, not with phrasing. The pub’s assistant might fail only on set menus for large mixed-diet parties, whatever the prompt is.

The decisive test: run the failing set on a stronger tier. If the stronger tier meets the quality bar, the gap is capability. The upgrade then becomes a diagnosed decision with an eval that the upgrade must pass. Domain 2’s right-sizing and Anthropic’s upgrade guidance give the steps.

  • Benchmark with your actual prompts and data.
  • Compare accuracy and edge-case handling.
  • Weigh cost.

If it does not, the problem was never the model. Resume the search upstream.

Mismatch happens in both directions. Consider a premium tier that is far above a simple task, like the pub’s opening-hours questions. This case has the same diagnosis and the opposite fix. Objective 4.5 covers downsizing.

Cue in the question Likely class Cheapest decisive test Failing layer
Varies with phrasing on the same inputs; format drift Prompt failure Clarified, structured prompt, all else constant Prompt
Wrongness correlates with a corpus refresh or re-import Hallucination (grounding) Inspect retrieved passages in the trace for the failing cases Retrieval/indexing pipeline
Right passages retrieved, answer contradicts or exceeds them Hallucination (generation) Grounding discipline on the failing set; measure faithfulness Prompt-level grounding
Fails the hard cases under every prompt variant, context verified Model mismatch Run the failing set on a stronger tier Model tier

Inconsistency means divergent outputs for the same input class. Inconsistency is usually a symptom of one of the failure classes, not a class of its own.

  • Prompt failure: instructions that do not fully specify a boundary.
  • Grounding: retrieval returning different context per run.
  • Mismatch: genuine variance at the edge of capability.

The method is unchanged: trace, cluster the divergent cases, and find what differs between runs. Self-contradiction within one response is a reliability warning sign. It is worth its own regression cases.

Here, bias appears as a detection task: disaggregate (split) eval results across user groups and content types. A system that is accurate on average but systematically wrong for one population is failing. The report should say so. Detection is Domain 4’s job. The governance response belongs to Domain 5.

This objective punishes fluent guessing hardest. The exam guide’s Domain 4 sample sits here: a RAG system returns confident but incorrect answers after a document refresh, latency and model version unchanged. The right answer is the retrieval/indexing step, as at the pub. The sample is a small example of the diagnostic order: evidence before conclusions, stage before failure class, cheapest decisive test before any fix.

A policy assistant starts inventing clause numbers two days after the policy corpus was re-imported. Traces on the failing cases show the retrieved passages no longer contain the cited sections; latency, model, and prompt are unchanged. What should the team do?

  • A. Upgrade to the top model tier, and trust its stronger reasoning on policy
  • B. Verify the re-import triggered re-embedding and re-indexing, and fix the pipeline
  • C. Rewrite the prompt to say the assistant must never invent clause numbers
  • D. Lower the temperature to zero so the answers stop varying
Answer & explanation

Correct: B

  • A — The habitual upgrade, made without a diagnosis: the trace implicates retrieval, and a stronger model will fabricate just as fluently from passages that no longer contain the clauses.
  • B — The correlation with the corpus re-import plus traces showing missing passages classify this as hallucination via grounding failure. The cheapest decisive test and the fix both belong at the pipeline stage that the evidence points to, and then the failing cases become regression cases.
  • C — Patches downstream of the fault: this is a grounding failure, not a generation failure. The model cannot cite sections the retrieval step no longer supplies.
  • D — A sampling setting does not restore missing context, and temperature zero is not fully deterministic anyway. Current state (checked 30 September 2026): a non-default temperature returns a 400 error on Claude Opus 4.7 and every later model, so on current models it cannot be changed at all.