Handling errors and hallucinations in UI
Mental model: the UI is a safety boundary: it should expose uncertainty, preserve the user’s agency, and make correction cheaper than overreliance.
Mechanism: confidence/evidence state → user affordance → feedback signal
state = {"evidence": False, "action": "ask_clarifying_question"}
assert not state["evidence"]
print(state["action"])
Run with python3; expected output is ask_clarifying_question. Do not hide errors behind confident prose; offer sources, edit/undo, report, and escalation paths.
Production lens and exercises
Track correction rate, report rate, unsupported-claim rate, time to recovery, and the outcome after escalation. Test the UI with absent evidence, contradictory sources, a tool failure, and an unsafe request; a fallback must preserve the user's next safe action.
- Design a source card that exposes provenance and lets a user report a mismatch.
- Add a regression fixture where the correct product behavior is an explicit “I don't know.”
Sources
- People + AI Guidebook — human-centered AI interaction patterns.
- NIST AI RMF — transparency and accountability context.
LLMs can produce plausible unsupported claims. Product design cannot eliminate that alone, but it can make errors visible, recoverable, and less damaging.
UI defenses
| Risk | UI pattern |
|---|---|
| Unsupported claim | Citation, evidence panel, source highlight |
| Wrong answer | Report/correct control and visible revision path |
| Overconfident draft | Label as draft until reviewed |
| Ambiguous request | Ask clarification before answering |
| High-stakes advice | Refuse, escalate, or require expert review |
| Tool/action error | Show action status separately from generated prose |
Design the interface so users can check the answer without starting from scratch.
Separate answer from evidence
When grounding matters, show the answer and the evidence path. If evidence is missing, the product should say so, not invent confidence.
Recovery controls
Useful recovery controls include regenerate with instruction, edit, mark wrong, request sources, ask follow-up, undo action, and escalate to human.
Pitfall
"AI may be wrong" disclaimers do not make errors safe. They shift responsibility to the user without improving inspectability.
Connects to: why LLMs hallucinate · grounding and citations · fallbacks