TL;DR
Do large language models know when they are making things up? By training simple probes on the internal hidden states of a transformer during decoding, this paper demonstrates that hallucination signals are deeply embedded within the model's internal representations, appearing as early as layer 4. These internal probes not only outperform traditional external evaluation baselines but even surpass expert human annotators at identifying grounded hallucinations.
What Problem Does This Paper Address?
Detecting hallucinations in grounded generation tasks—such as abstractive summarization or Retrieval-Augmented Generation (RAG)—is crucial for deploying reliable AI systems. Traditionally, this is treated as an external text-processing problem: a secondary model (like an NLI classifier or a GPT-4 evaluator) checks the generated text against the source context.
However, this black-box approach is computationally expensive and ignores a fascinating question: Does the generation model already know it's hallucinating? This paper shifts the focus inward, exploring whether a decoder-only transformer's internal feed-forward and self-attention states contain latent diagnostic features that flag ungrounded text in real-time.
Methods
The authors employ internal state probing, extracting hidden states from a llama-2-13b model during forced decoding. They design three types of probes with increasing complexity:
- Linear Probe: A simple logistic regression classifier trained on a single hidden state vector at a specific token step.
- Attention-Pooling Probe: A probe that uses an attention mechanism over all generated tokens up to the current step, capturing context across time.
- Ensemble Probe: A logistic regression model that aggregates predictions from $2L$ separately trained probes across all layers and sublayers (attention vs. feed-forward blocks).
The probes are trained on two objectives: token-level detection (identifying the exact span of a hallucination) and response-level detection (classifying whether an entire generation contains any ungrounded claims).
Datasets
The method was evaluated across three distinct grounded generation tasks using a newly compiled dataset of over 15,000 human-annotated utterances:
- Abstractive Summarization: CNN/DailyMail (CDM), utilizing both organic model outputs and synthetic ungrounded edits from the BUMP benchmark.
- Knowledge-Grounded Dialogue: Conv-FEVER (CF).
- Data-to-Text: E2E restaurant descriptions.
Crucially, the dataset distinguishes between organic hallucinations (naturally sampled from the LLM) and synthetic hallucinations (manually engineered perturbations to reference text).
Key Insights and Ideas
- The "Synthetic Gap" and Ecological Validity: Probes trained on synthetic data generalize poorly to organic data (and vice versa). This reveals that artificially generated errors do not mirror the actual internal states of a model making a natural mistake, questioning the utility of purely synthetic benchmarks for hallucination evaluation.
- Extrinsic vs. Intrinsic Saliency: Extrinsic hallucinations (introducing outside facts not present in the prompt) are significantly easier for internal probes to detect than intrinsic ones (misrepresenting or contradicting the prompt). This implies the model maintains a clear internal distinction when it pulls from its own parametric memory versus the provided context.
- Incredibly Early Detection: The internal signal for hallucination stabilizes remarkably early. Probes achieve 95% of their peak detection performance by just the 4th layer of the network.
- FFN Saliency: Feed-forward network (FFN) sublayers exhibit a slightly stronger and more statistically significant hallucination signal than self-attention layers, aligning with theories that FFNs act as key-value memories.
Key Results
The internal probes achieved state-of-the-art performance on response-level classification (F1-R), consistently beating strong external baselines like FActScore, ChatGPT, and sequence log-probabilities.
As shown in the response-level classification results below, the ensembled attention-pooling probe (Pooling_E) even surpassed an Expert Human Judge across all three tasks, notably outperforming the human expert by 20 absolute F1 points on the complex CDM summarization task:
For span-level detection (F1-Sp), the probes performed on par with or better than the expert human annotator in two out of the three tasks, proving that internal states can accurately localize errors down to specific words.
Limitations and Future Work
- Lack of Task Transfer: The probes are highly domain-sensitive. A probe trained on summarization hidden states performs poorly when evaluated on dialogue tasks, indicating that the hallucination signal is tightly coupled with task-specific features.
- The White-Box Requirement: Probing requires direct access to the model's hidden states. This makes the technique impossible to use with closed-source, API-only models like GPT-4.
- Future Mitigation: Because these signals appear early and at a token level, future work could leverage these probes for real-time mitigation—such as triggering the decoder to backtrack and regenerate text the moment a high hallucination probability is detected.
Summary updated