What are Models Thinking about? Understanding Large Language Model Hallucinations "Psychology" through Model Inner State Analysis

Peiran Wang, Yang Liu, Yunfei Lu, Jue Hong, Ye WuarXiv 2025

Abstract

Large language model (LLM) systems suffer from an unstable ability to generate valid and factual content, resulting in hallucinations. Current detection methods rely heavily on external information sources, such as Retrieval-Augmented Generation (RAG), which introduces significant latency and computational costs. This paper introduces HALUPROBE, a framework that leverages the internal states of LLMs during inference to detect hallucinations. By systematically analyzing three stages of the forward process—understanding, query, and generation—we provide a deep understanding of the internal "psychology" behind hallucinated content. Our experiments demonstrate that these internal features can effectively identify hallucinations with high accuracy and offer insights into how external context like RAG stabilizes a model's internal reasoning.

Introduction

Large Language Models (LLMs) are notorious for "hallucinating"—generating content that is factually incorrect or unfaithful to the provided context while maintaining a confident tone. Traditionally, these errors are caught using external verification methods like RAG, where the model's output is cross-referenced against a trusted database. However, RAG-based detection is often slow, expensive, and limited by the quality of the external data.

Furthermore, these "black-box" methods fail to explain why a model hallucinates. This research shifts the focus inward, investigating whether we can identify a hallucination forming within the model's internal states before the final tokens are even generated. By analyzing the model's "thought process," we can develop faster, more interpretable detection mechanisms.

The HALUPROBE Framework

The researchers introduced HALUPROBE, a framework designed to extract and analyze features from the LLM inference process. The framework divides the forward pass into three distinct stages:

  1. Understanding (Attention): This stage extracts attention scores to determine how the model "looks back" at previous tokens and context.
  2. Query (Layer Representation): This stage analyzes hidden states and activation maps within the feed-forward networks to see which neurons are firing during processing.
  3. Generation (Logits): This stage examines the raw probability scores (logits) for the tokens being produced.

To ensure the detection signal is precise, HALUPROBE utilizes a Sliced Window approach. Rather than analyzing the entire response at once—which can dilute the signal—or focusing on a single token—which is often too noisy—the system analyzes small, overlapping chunks of tokens. This allows the framework to pinpoint exactly where the model's internal logic begins to deviate from the truth.

Key Insights into Model "Psychology"

The study revealed several critical findings regarding the internal behavior of LLMs during hallucination:

  • The "Dispersed Attention" Signature: When a model begins to hallucinate, its attention patterns become "dispersed," characterized by higher entropy. Instead of locking onto relevant context, the model's focus becomes scattered across irrelevant tokens.
  • RAG as a Stabilizer: Interestingly, the use of RAG does more than just provide facts; it physically stabilizes the model's internal activations. When RAG is active, the model’s internal reasoning becomes significantly less "noisy," and its attention becomes more focused.
  • Task-Dependent Logits: While raw token probabilities (logits) are effective at catching hallucinations in summarization tasks, they are less reliable for general fact-checking. In contrast, attention-based features, such as the "Lookback Ratio," proved to be much more robust across diverse tasks.

Experimental Results

HALUPROBE was evaluated using three datasets: HaluEval (factual hallucinations), CNN/Daily Mail (summarization faithfulness), and Natural Questions (real-world QA).

  • Accuracy: Using the Vicuna-7B model, HALUPROBE achieved an accuracy of 0.89 on the HaluEval dataset, significantly outperforming baseline internal-state methods.
  • Efficiency: The framework offers a trade-off between speed and depth. Activation-based features are highly efficient, requiring only 0.09s per token. Full attention analysis, while more robust, is slower at 3.27s per token.
  • Transferability: Features trained on summarization (CNNDM) showed a "zero-shot" transfer accuracy of 0.66 on Natural Questions, suggesting that certain internal "hallucination signatures" are universal across different applications.

Conclusion and Future Work

HALUPROBE demonstrates that the internal states of LLMs provide a rich, real-time signal for hallucination detection. While current challenges include the computational overhead of full attention analysis and the need for better generalization across creative writing genres, the framework paves the way for more transparent and efficient AI. Future work will focus on optimizing feature extraction for real-time production environments and developing universal features that require no task-specific retraining.

Summary updated

BibTeX
@misc{wang2025what,
  author = {Peiran Wang and Yang Liu and Yunfei Lu and Jue Hong and Ye Wu},
  title = {{What are Models Thinking about? Understanding Large Language Model Hallucinations "Psychology" through Model Inner State Analysis}},
  year = {2025},
  eprint = {2502.13490},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.13490},
}
Figure