HalluShift: Measuring Distribution Shifts towards Hallucination Detection in LLMs
Sharanya Dasgupta, Sujoy Nath, Arkaprabha Basu, Pourya Shamsolmoali, Swagatam Das
TL;DR
HalluShift addresses the hallucination problem in LLMs by detecting factual inconsistencies through internal-state dynamics and token-probability signals, rather than relying solely on external evaluators. It combines distribution-shift features captured via Wasserstein distances and cosine similarities across model layers with probabilistic token-level features in a two-layer metric-learning MLP to produce a hallucination score. The approach achieves state-of-the-art or near-state-of-the-art performance across multiple benchmarks and models, while maintaining a favorable computational footprint of $O(m^2)$. The findings suggest hallucinations leave robust fingerprints in the way information propagates through the LLM’s layers, and HalluShift provides a practical, open-box method for detection with cross-domain robustness and potential for integration into mitigation strategies.
Abstract
Large Language Models (LLMs) have recently garnered widespread attention due to their adeptness at generating innovative responses to the given prompts across a multitude of domains. However, LLMs often suffer from the inherent limitation of hallucinations and generate incorrect information while maintaining well-structured and coherent responses. In this work, we hypothesize that hallucinations stem from the internal dynamics of LLMs. Our observations indicate that, during passage generation, LLMs tend to deviate from factual accuracy in subtle parts of responses, eventually shifting toward misinformation. This phenomenon bears a resemblance to human cognition, where individuals may hallucinate while maintaining logical coherence, embedding uncertainty within minor segments of their speech. To investigate this further, we introduce an innovative approach, HalluShift, designed to analyze the distribution shifts in the internal state space and token probabilities of the LLM-generated responses. Our method attains superior performance compared to existing baselines across various benchmark datasets. Our codebase is available at https://github.com/sharanya-dasgupta001/hallushift.
