Efficient Hallucination Detection: Adaptive Bayesian Estimation of Semantic Entropy with Guided Semantic Exploration

Qiyao Sun, Xingming Li, Xixiang He, Ao Cheng, Xuanyu Ji, Hailun Lu, Runke Huang, Qingyong Hu

TL;DR

Detecting LLM hallucinations by checking for "semantic entropy" (consistency across multiple responses) is effective but computationally expensive. This paper introduces an adaptive Bayesian framework that dynamically stops sampling once it reaches a certainty threshold and uses "guided exploration" to find conflicting answers faster, cutting sampling costs by 50% while significantly improving detection accuracy.

What Problem Does This Paper Address?

Large Language Models (LLMs) often "hallucinate"—generating plausible-sounding but factually incorrect information. One of the most reliable ways to detect this is by measuring Semantic Entropy: you ask the model the same question multiple times and see if the answers mean the same thing. If the model provides five different answers that all point to different facts, it’s likely hallucinating.

However, current methods use a "fixed budget" approach (e.g., always sampling 10 responses). This is inefficient:

  1. Wasteful: Simple questions (e.g., "What is the capital of France?") don't need 10 samples to confirm the model is certain.
  2. Insufficient: Complex or ambiguous queries might need more than 10 samples to uncover hidden inconsistencies.

The authors aim to make hallucination detection both efficient (using fewer samples) and robust (finding inconsistencies that random sampling might miss).

Methods

The authors propose a two-pronged approach:

1. Adaptive Bayesian Estimation

Instead of treating the number of samples as a fixed constant, they treat the semantic distribution as a hierarchical Bayesian problem.

  • Dynamic Stopping: They model the uncertainty of the entropy estimate itself. By calculating the variance of their belief, the system can trigger an "early exit" once it is statistically confident in the result.
  • Weighted Perplexity Prior: They use a Poisson distribution to estimate how many distinct meanings a query might have, calibrated by the model's initial "hesitation" (perplexity) on the prompt.

2. Guided Semantic Exploration

Randomly sampling from an LLM is a slow way to find rare, conflicting interpretations.

  • Critical Token Perturbation: The algorithm identifies "semantically critical" tokens—words that, if changed, would fundamentally alter the meaning of the sentence.
  • Importance Sampling: It then forces the model to explore alternative paths starting from those critical tokens. To ensure the final entropy score isn't biased by this "forced" exploration, they apply Importance Sampling weights to mathematically correct the distribution.

Datasets

The researchers evaluated their method across three different LLM architectures (Llama-2-7B, Llama-3.1-8B, and Mistral-Small-24B) using four diverse Question Answering (QA) benchmarks:

  • CoQA: Conversational patterns.
  • TriviaQA: General knowledge/open-domain facts.
  • TruthfulQA: Specifically designed to trick models into mimicking human falsehoods.
  • SimpleQA: Short-form factual queries.

Key Insights and Ideas

  • The "Aha!" of Efficiency: The paper demonstrates that query complexity is non-uniform. On the CoQA dataset, many queries converge in just 1–2 samples, while SimpleQA often requires the full budget. Adaptive sampling exploits this variance to save massive amounts of compute.
  • Forcing the "Hallucination": By perturbing critical tokens, the authors effectively "stress test" the model's internal logic. If a model is "on the fence" about a fact, guided exploration finds the alternative (incorrect) fact much faster than random chance.
  • Uncertainty about Uncertainty: By using a Bayesian framework, the researchers aren't just measuring how inconsistent the model is; they are measuring how sure they are about that inconsistency measurement.

Key Results

  • Superior Performance: The proposed method achieved the highest AUROC (Area Under the Receiver Operating Characteristic curve) in 23 out of 24 experimental settings.
  • Massive Efficiency Gains: In "low-budget" scenarios (averaging only 2 samples per query), the method improved AUROC by an average of 12.6% over existing state-of-the-art methods.
  • Resource Savings: To reach the same level of detection accuracy as standard semantic entropy methods, this approach required roughly 50% fewer samples.
  • Scalability: The gains were consistent across different model sizes, suggesting the method captures a fundamental property of how LLMs represent uncertainty.

Limitations and Future Work

  • Clustering Overhead: While the authors claim the computational cost of semantic clustering (using DeBERTa) is negligible compared to LLM generation, in extremely high-throughput production environments, this extra step still adds a layer of complexity.
  • NLI Dependency: The method relies on Natural Language Inference (NLI) models to determine if two sentences mean the same thing. If the NLI model itself is biased or inaccurate, the hallucination detection will suffer.
  • Future Directions: The authors suggest extending this framework to multimodal settings (e.g., detecting hallucinations in image-to-text models) and applying these Bayesian techniques to broader uncertainty quantification tasks beyond just fact-checking.

Summary updated

BibTeX
@inproceedings{sun2026efficient,
  author = {Qiyao Sun and Xingming Li and Xixiang He and Ao Cheng and Xuanyu Ji and Hailun Lu and Runke Huang and Qingyong Hu},
  title = {{Efficient Hallucination Detection: Adaptive Bayesian Estimation of Semantic Entropy with Guided Semantic Exploration}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i39.40595},
}
Figure