What you need to know
The failure modes
| Mode | Looks like | Usual causes | Fix at the cause |
|---|---|---|---|
| Hallucination | Confident facts or citations not in any source | No grounding, no permission to say "I don't know", skipped tool call | Ground in sources, require the lookup, allow "not found", cite and verify |
| Refusal | Declines a legitimate task | Missing context about the setting and purpose | State the setting and audience in the system prompt |
| Under-acting | Stops early, edits 3 of 11 callers, answers without checking | No completion criteria, no verification | Clear done criteria and a verification step |
| Context loss | Contradicts early constraints in long sessions | Crowded context, trimmed history | Summarize, restate constraints, keep state outside the context |
| Format drift | Dates or fields in varying formats | Loose format instructions | Schema or exact format with example, plus validation |
| Inconsistent output | Different answers to the same request | Sampling, or inputs that are not actually identical | Check 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 trace | Layer |
|---|---|
| Model output was valid; corruption appears after it (truncating logger, parser bug) | Integration |
| The system prompt or document was missing from the request | Integration (configuration) |
| The image sent was blank because a converter failed | Integration (ingestion) |
| A tool returned "ok" when it failed | Integration (tool) |
| The error message never reached the model as a tool result | Integration (harness) |
| The request was complete and correct, and the output was wrong | Model 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
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.
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.
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
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.
- Classify each failure and name its layer.
- Give the cause-level fix for each.
- Add regression cases so each failure stays fixed.
Done when: no fix is a prompt tweak for an integration defect.
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.