Detecting Hallucinations in Large Language Model Generation: A Token Probability Approach

Pablo Rivas, Ernesto Quevedo, Jorge Yero, Rachel Koerner, Pablo Rivas 0001, Tomás CernýarXiv 2024 · DOI

As Large Language Models (LLMs) become increasingly integrated into high-stakes domains like legal research and medical advice, the issue of "hallucinations"—factually incorrect but fluent-sounding generations—has shifted from a research curiosity to a critical safety requirement. Researchers at Baylor University and the University of Arizona have developed a lightweight, supervised learning approach to detect these errors by analyzing token probability distributions.

The Problem: Resource-Intensive Detection

Current hallucination detection methods typically fall into two categories: resource-heavy approaches that require access to internal model layers, or linguistic-heavy methods like "Chain of Thought" prompting that increase latency and cost. Furthermore, many systems rely on the generating model to evaluate its own output, which often leads to self-confirmation bias. This research seeks a model-agnostic, computationally efficient way to flag errors using minimal features.

The Proposed Pipeline

The authors propose a supervised learning pipeline that treats hallucination detection as a binary classification problem. The core innovation is the use of an LLM-Evaluator ($LLM_E$). In this setup, text generated by an original model ($LLM_G$) is "force-decoded" through the Evaluator. This process reveals how much probability the Evaluator would have assigned to those specific tokens if it were generating the text itself.

The proposed hallucination detection pipeline, showing the flow from generation to feature extraction and classification.

Instead of complex embeddings, the system extracts only four numerical features from the Evaluator's probability distributions:

  1. Minimum Token Probability (mtp): The lowest confidence score in the sequence.
  2. Average Token Probability (avgtp): The mean confidence across the sequence.
  3. Maximum Probability Deviation (Mpd): The gap between the Evaluator’s top choice and the generated token.
  4. Minimum Probability Spread (mps): The difference between the most and least likely tokens at a specific step.

These features are then processed by simple classifiers, such as Logistic Regression (LR) or a Simple Neural Network (SNN).

Performance and Key Results

The approach was tested across diverse benchmarks, including HaluEval (35,000 samples) and HELM. The results demonstrate that hallucinations leave a distinct statistical footprint—a "poker tell" in the token probabilities.

Performance metrics across Summarization, Question Answering, and Knowledge-Grounded Dialogue (KGD) tasks for various evaluator models.

Key findings from the experimental results include:

  • High Accuracy: On HaluEval tasks, the SNN classifier achieved over 98% accuracy and F1-scores using models like GPT-J and OPT as evaluators for summarization.
  • Efficiency: Training these classifiers takes only minutes on a single GPU because they rely on just four numerical features.
  • Cross-Model Validation: Using a different model as an evaluator (e.g., GPT-J checking ChatGPT) often yields better results than self-evaluation, effectively avoiding self-confirmation bias.
  • Model Size Paradox: Surprisingly, smaller models like BART often outperformed much larger models when acting as evaluators for specific tasks like Question Answering, suggesting that architecture and training data may be more important than raw parameter count for detection.

Limitations and Future Work

While highly effective for grounded tasks like summarization, the method struggles with "closed-book" factual errors (e.g., the True-False dataset) where no reference context is provided. Additionally, context window limits in some evaluator models can lead to truncation issues.

Future research will focus on moving beyond binary "Yes/No" outputs to predict the severity of hallucinations, identifying specific erroneous words, and using ensembles of multiple evaluators to increase robustness.

Reference: Quevedo, E., Salazar, J. Y., Koerner, R., Rivas, P., & Cerny, T. (2024). Detecting Hallucinations in Large Language Model Generation: A Token Probability Approach. arXiv:2405.19648v1.

Summary updated

BibTeX
@misc{rivas2024detecting,
  author = {Pablo Rivas and Ernesto Quevedo and Jorge Yero and Rachel Koerner and Pablo Rivas and Tomás Cerný},
  title = {{Detecting Hallucinations in Large Language Model Generation: A Token Probability Approach}},
  year = {2024},
  eprint = {2405.19648},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.19648},
}
Figure