← All questions
LLMOps & ProductionHard· LLM Monitoring & Observability

How do you detect and measure hallucinations in product...

Two distinct failure modes both get lumped under “hallucination”: the model stating an incorrect fact with confidence regardless of context, and — specific to RAG systems — the model’s answer drifting beyond or contradicting what the retrieved context actually supports. Detecting both at scale usually relies on breaking a generated answer into individual claims and checking each one against the source context automatically, which is exactly what faithfulness-style scoring does, supplemented by sampling a slice of production traffic and having a stronger model judge whether each response is actually grounded.

The real value of running this continuously, rather than as a one-time eval, is catching regressions fast. A hallucination rate that’s been stable for weeks and then jumps sharply right after a prompt or model change is one of the clearest signals available for pinpointing exactly what broke and when — often narrowing the investigation to a single recent deploy rather than a broad search across the whole system.

Code playground (Python)