SelfConsistency
Detects hallucinations by checking whether stochastic samples of the same prompt agree with each other. If a model truly knows something, its outputs converge. If it hallucinated, the samples contradict. Based on SelfCheckGPT (Manakul et al., EMNLP 2023) with production improvements: adaptive sample count, free-sample reuse, and a local NLI backend. When to use: Any generation task where you have no reference document to check against — knowledge QA, open-ended explanation, conversational responses. Pair withFaithfulness when a reference is available.
Key limitation: Consistency is not factuality. A model that consistently hallucinates the same popular misconception will score as consistent. This evaluator catches inconsistent hallucinations — fabrications that vary across samples.
Backends
Adaptive N
Withadaptive=True (default), the evaluator starts at n samples. If the score is borderline (0.3–0.7), it escalates up to max_n samples automatically. Most clear cases resolve at n=5. Ambiguous cases get up to n=20.
Free-sample integration
Passsamples= to reuse outputs you’ve already generated — no extra API calls:
Parameters
Example
backend="llm", each evaluation makes up to 30 judge calls (6 sentences × 5 samples).

