Abstract Large Language Models (LLMs) frequently generate hallucinations—factually incorrect statements presented with high confidence. This paper introduces a novel self-detection framework that identifies hallucinations by analyzing the model's internal consistency and input atypicality. By measuring the divergence of responses across semantically equivalent question phrasings and the negative log-likelihood of the input, the proposed method effectively flags potential errors without requiring external knowledge bases or expensive fine-tuning. Evaluated across six benchmarks and multiple model families (including GPT-4 and Llama 2), this approach demonstrates superior performance over existing calibration and detection baselines.
Introduction
One of the most persistent challenges in the deployment of Large Language Models (LLMs) is their tendency to hallucinate. Because these models are optimized for next-token prediction, they often generate plausible-sounding but entirely fabricated "facts." Traditional approaches to this problem generally fall into two categories: Calibration, which involves training auxiliary models to score response confidence, and Self-Detection, where the model evaluates its own certainty.
As shown in Figure 1, traditional calibration often requires external features and separate modules, which can be computationally expensive and difficult to scale. Furthermore, LLMs are frequently "over-calibrated" toward confidence. This research, presented at NAACL 2024, proposes a lightweight self-detection suite that relies solely on the model's internal state and behavioral variance to identify when it is likely to be guessing.
Methodology
The proposed self-detection framework utilizes two primary signals to identify potential hallucinations: consistency across paraphrased inputs and the statistical atypicality of the question itself.
1. Consistency-based Detection (Divergence Check)
The core hypothesis is that if a model possesses stable knowledge of a fact, its response should remain consistent regardless of how the question is phrased. The system generates multiple semantically equivalent versions of a question (e.g., "Who wrote the lyrics to X?" vs. "The lyricist of X is..."). By applying a clustering algorithm to the resulting responses ($R_1, ..., R_n$), the method measures the divergence or entropy. High variance across these answers serves as a strong indicator that the model lacks the underlying knowledge and is generating a hallucination.
2. Verbalization-based Detection (Atypicality Check)
Beyond output variance, the model’s internal state during input processing provides critical clues. The researchers measure the Negative Log-Likelihood (NLL) of the input question. If a question is phrased in a way that is "atypical" or low-probability relative to the model's training distribution, the model is statistically more likely to struggle and produce a non-factual response. This component acts as a pre-emptive signal, identifying potential failure points before a full response is even generated.
By combining these features—Consistency, Entropy, and Atypicality—using a simple classifier like XGBoost, the system can accurately predict the likelihood that a generated response is a hallucination.
Experimental Setup and Datasets
The method was evaluated across three distinct task categories using six well-known benchmarks:
- Factoid QA: FaVIQ and ComQA (testing "world knowledge").
- Arithmetic Reasoning: GSM-8K and SVAMP (testing multi-step math).
- Commonsense Reasoning: ARC-Challenge and CommonsenseQA (testing logic and everyday knowledge).
The researchers tested the framework on both closed-source models (GPT-3.5-turbo, GPT-4) and open-source models (Vicuna-13B, Llama2-13B) to ensure model-agnostic reliability.
Key Insights and Results
The effectiveness of the self-detection method was measured using PR-AUC (Precision-Recall Area Under the Curve). Key findings include:
- Superior Performance: The proposed method consistently outperformed established baselines, including raw token probability (TokenProbs) and SelfCheckGPT.
- The "Popularity" Gap: Accuracy was found to correlate directly with "knowledge popularity" (search result counts). Models are significantly more likely to hallucinate on "long-tail" or niche topics, where the atypicality signal is particularly strong.
- Fragility of Knowledge: The research highlighted that LLM knowledge is often fragile; a model may answer correctly for one phrasing but fail on a semantic equivalent. This "verbalization sensitivity" is the primary signal exploited by the consistency check.
- Ablation Success: While consistency is the strongest individual predictor, the addition of the atypicality component provided a consistent performance boost, confirming that the model's internal "surprise" at an input is a valuable metric for reliability.
Limitations and Future Work
While effective, the method has limitations. If a model has deeply memorized a falsehood (providing the same wrong answer across all phrasings), the consistency check will result in a false negative. Additionally, generating 10–30 paraphrased responses per question increases inference latency and computational cost. Future research may explore more efficient ways to "stress test" inputs, perhaps by utilizing external agents to provide more diverse phrasings with fewer iterations.
Summary updated