After posting about TraceMind's hallucination detection, someone left
a comment that stopped me.
Suny Choudhary wrote: "the harder issue is what happens after
detection. Whether the system can handle that uncertainty correctly —
retry, validate, or block actions."
He's right. And it exposed a gap I hadn't thought through.
Right now TraceMind detects hallucinations. You get this back:
{
"has_hallucinations": True,
"overall_risk": "high",
"claims": [{
"claim": "We offer 60-day refunds",
"type": "factual_contradiction",
"evidence": "context says 30-day refunds only"
}]
}
And then... nothing. You have to decide what to do with it.
The problem is "what to do" is completely application-specific.
A customer support bot should probably retry with a more
conservative prompt. The user is waiting for an answer.
A legal document analyzer should block and escalate to a human.
A wrong answer has real consequences.
A coding assistant might just flag it with low confidence. The
developer will review the code anyway.
You can't hardcode the right behavior at the detection layer because
it depends on context the detection layer doesn't have.
My current thinking for v3: opinionated defaults with override hooks.
Three built-in policies:
-
block— don't return the response -
retry— re-run the LLM call with a safer prompt -
flag— return the response with a warning attached
Override any of them:
@tm.on_hallucination(risk="high")
def my_policy(claim, context):
if context.domain == "legal":
return Policy.BLOCK
return Policy.FLAG
Teams get safe defaults on day one. Teams with specific workflows
customize exactly what they need.
This isn't shipped yet. It's a design I'm thinking through based on
real feedback.
If you're building with LLMs and have dealt with this problem — what
did you actually do when your AI hallucinated in production?
GitHub: github.com/Aayush-engineer/tracemind
Top comments (0)