CertPrep
Domain 4 · Lesson 4.2 · 5 min read

Diagnosing Failure Modes from Traces

Exam skillFailure-Mode Diagnosis

Analyzing a trace excerpt or reproduction to identify the failure mode, such as hallucination, refusal, under-acting, context loss, format drift, or inconsistent output; isolating whether it originates in the integration layer or in model output; and selecting a recovery that addresses the cause rather than the symptom.

Read a trace or reproduction, name the failure mode (hallucination, refusal, under-acting, context loss, format drift, inconsistent output), work out whether it starts in the integration layer or in the model's output, and fix the cause rather than the symptom.

What you need to know

The failure modes

ModeLooks likeUsual causesFix at the cause
HallucinationConfident facts or citations not in any sourceNo grounding, no permission to say "I don't know", skipped tool callGround in sources, require the lookup, allow "not found", cite and verify
RefusalDeclines a legitimate taskMissing context about the setting and purposeState the setting and audience in the system prompt
Under-actingStops early, edits 3 of 11 callers, answers without checkingNo completion criteria, no verificationClear done criteria and a verification step
Context lossContradicts early constraints in long sessionsCrowded context, trimmed historySummarize, restate constraints, keep state outside the context
Format driftDates or fields in varying formatsLoose format instructionsSchema or exact format with example, plus validation
Inconsistent outputDifferent answers to the same requestSampling, or inputs that are not actually identicalCheck inputs first; then clearer criteria, examples, structure

Which layer?

Before changing the prompt, check whether the model ever saw (or produced) what you think.

Evidence in the traceLayer
Model output was valid; corruption appears after it (truncating logger, parser bug)Integration
The system prompt or document was missing from the requestIntegration (configuration)
The image sent was blank because a converter failedIntegration (ingestion)
A tool returned "ok" when it failedIntegration (tool)
The error message never reached the model as a tool resultIntegration (harness)
The request was complete and correct, and the output was wrongModel output: prompt, examples, model choice

Recovery that addresses the cause

  • Truncated output with max_tokens: change the budget or ask for less; do not retry the same request.
  • A tool lies about success: return real errors and add a test for the failure path.
  • A model upgrade changed routing: compare old and new on the evaluation set to find the affected cases, then adjust.
  • Some variation with identical inputs is normal; reduce it with clearer criteria and structured output, and validate.

In the exam

Items show a trace excerpt or reproduction and ask for the failure mode, the layer, or the recovery. Classify first, check the evidence for integration defects, then fix the cause. Distractors change the prompt or model for an integration bug, retry deterministic failures, or add instructions the model cannot act on.

Check your understanding

Question 1

A bot states a shipping date that the order system does not have; no tool was called. Which mode?

Show answer

Answer: D. It produced a specific fact without the lookup that would have grounded it.

Question 2

6% of JSON fails to parse; traces show valid JSON from the model, and failures began with a truncating log wrapper. Where is the defect?

Show answer

Answer: A. The model output was valid before the wrapper changed it.

Question 3

Identical requests give the same label 97% of the time. What explains it?

Show answer

Answer: C. Some variation is normal with identical inputs; reduce and validate it.

Apply it: Diagnose Bluestem's extraction failures

Exercise · about 25 minCase: Bluestem Lending

Bluestem's extraction service has three problems: (A) 3% of responses fail to parse in the loan system; traces show the API returned valid JSON, and the loan system's adapter strips characters it treats as unsafe, including some quotes. (B) 1.5% parse but the total does not equal the line items. (C) Totals for TIFF bank statements are often 0; the converter outputs blank pages for multi-page TIFFs.

  1. Classify each failure and name its layer.
  2. Give the cause-level fix for each.
  3. Add regression cases so each failure stays fixed.
    Done when: no fix is a prompt tweak for an integration defect.
Check your work
Show model answer

1. A: integration (adapter corrupts valid output). B: model output (values wrong within a valid schema). C: integration (ingestion sends blank images).

2. A: fix the adapter to parse JSON before any sanitizing, and sanitize field values, not the raw payload. B: validate totals against line items in code; failing records go to review; add an instruction and example to copy line items exactly and compute nothing. C: fix TIFF conversion (all pages, to PDF), fail loudly when a page is blank, and check images before sending.

3. Cases with quotes in vendor names, statements with many line items and a known total, and multi-page TIFFs, each with expected output.

Key termsHallucinationObservabilityVerification

Sources