thunderbolt icon indicating copy to clipboard operation
thunderbolt copied to clipboard

Add observability for LLM failure modes (hallucinations, refusals, tool errors)

Open coderleeon opened this issue 7 months ago • 2 comments

Problem

There is currently limited visibility into failure modes of model responses.

Suggested Features

  • hallucination detection hooks
  • refusal rate tracking
  • malformed output detection
  • tool invocation failures (for agent workflows)

Why this matters

Understanding failure patterns is critical for deploying AI systems in production environments.

Proposed Direction

Introduce structured logging + tagging of responses with failure categories.

coderleeon avatar Apr 20 '26 18:04 coderleeon

Strong requirements list. We operate 221 agents in production at KinthAI and had to build exactly this observability layer. Some implementation patterns:

Structured failure taxonomy:

We classify every agent output into one of:

  • success — output is valid and grounded
  • hallucination — output contains ungrounded claims (your hallucination detection)
  • refusal — model declined to act (safety filter, unclear instruction)
  • malformed — output doesn't match expected schema (JSON parse failure, missing fields)
  • tool_error — tool call failed (timeout, auth error, rate limit)
  • loop — agent is repeating actions without progress (detected by action-sequence similarity)

Each category gets its own alert threshold and escalation path.

The critical metric nobody tracks: failure correlation

Individual failure rates per agent are useful, but the high-value insight is correlated failures. When 3 agents simultaneously start hallucinating more, it's usually not 3 independent problems — it's a shared dependency (a vector store went stale, an API changed its response format, a model update shifted behavior). We emit structured trace events at each agent boundary and run correlation analysis on failure spikes.

Refusal rate is underrated:

Most teams focus on hallucination detection. But rising refusal rates are a leading indicator of prompt drift or safety filter changes. When our refusal rate jumped from 2% to 15% overnight, it was because a model update tightened safety filters on financial topics — and 6 of our agents handle payment-related tasks. Without refusal tracking, we would have seen 'agents not doing their jobs' without understanding why.

Writeup on multi-agent observability patterns: 221 Agents: Multi-Agent Coordination Lessons

kinthaiofficial avatar Apr 28 '26 16:04 kinthaiofficial

Thanks for the suggestion. We're adding this to our long-term roadmap along with our existing evaluations feature , though probably not one of our higher priorities right now.

Relatedly I will say that we have an evals tool here: https://github.com/thunderbird/thunderbolt/blob/3d42be4a0069487a324dca6608e37b20b37d7fff/src/ai/eval/README.md#L4

This is probably something that should be part of evals generally.

cjroth avatar Apr 30 '26 19:04 cjroth