Do Androids Know They're Only Dreaming of Electric Sheep?

Sky CH-Wang, Benjamin Van Durme, Jason Eisner, Chris Kedzie

Abstract

We design probes trained on the internal representations of a transformer language model to predict its hallucinatory behavior on three grounded generation tasks. To train the probes, we annotate for span-level hallucination on both sampled (organic) and manually edited (synthetic) reference outputs. Our probes are narrowly trained and we find that they are sensitive to their training domain: they generalize poorly from one task to another or from synthetic to organic hallucinations. However, on in-domain data, they can reliably detect hallucinations at many transformer layers, achieving 95% of their peak performance as early as layer 4. Here, probing proves accurate for evaluating hallucination, outperforming several contemporary baselines and even surpassing an expert human annotator in response-level detection F1. Similarly, on span-level labeling, probes are on par or better than the expert annotator on two out of three generation tasks. Overall, we find that probing is a feasible and efficient alternative to language model hallucination evaluation when model states are available.

Introduction

In grounded generation tasks—such as summarizing a news article or generating dialogue based on a knowledge base—Large Language Models (LLMs) frequently produce "hallucinations." These errors are categorized as either intrinsic (contradicting the source) or extrinsic (introducing information not present in the source). While the current industry standard for detection involves using secondary models as evaluators, this research explores a more direct approach: investigating whether the model’s own internal hidden states signal when it is generating ungrounded content.

Methodology

The researchers employed probing, a technique where small, supervised classifiers are trained on the frozen internal representations of a transformer (specifically Llama-2-13b). They developed three probe architectures:

  1. Linear Probe: Analyzes a single token's hidden state.
  2. Attention-Pooling Probe: Considers the current token and its preceding context.
  3. Ensemble Probe: A logistic regression model that aggregates signals from multiple layers and modules (feed-forward and self-attention).

The study utilized three primary datasets: CNN/DailyMail (CDM) for summarization, Conv-FEVER (CF) for knowledge-grounded dialogue, and E2E for data-to-text generation. The training data included both organic model outputs and synthetic "minimal pairs" where factual statements were manually edited to create hallucinations.

Analysis of Internal Representations

A significant finding of this study is the early emergence of hallucination signals. Probes achieved 95% of their peak performance by the 4th layer of the transformer, suggesting that the model "recognizes" its lack of grounding almost immediately during the encoding process.

Probing performance (F1) across transformer layers on the CNN/DailyMail task.

Furthermore, the probes were notably more effective at identifying extrinsic hallucinations compared to intrinsic ones. This suggests that the internal representation of "truthfulness" or "grounding" is more acutely felt when the model is forced to invent information rather than when it logically contradicts a source.

Experimental Results

The internal state probes demonstrated superior performance compared to several state-of-the-art external detection baselines, including FactCC and ChatGPT-based evaluators. Most impressively, on the CDM summarization task, the ensemble probe achieved a 0.75 F1 score, significantly outperforming the expert human annotator's 0.55 F1.

Response-level classification F1 scores comparing probing methods against baselines and expert humans.

In the Conv-FEVER and E2E tasks, the best-performing probes reached over 90% F1 for response-level detection. Additionally, for span-level labeling (identifying the exact tokens that constitute a hallucination), the probes performed on par with or better than human experts in two out of the three tasks.

Discussion and Limitations

Despite their high accuracy, the probes are currently limited by task sensitivity. A probe trained on summarization data does not generalize well to dialogue tasks, indicating that internal representations of grounding are tied to specific domains. Furthermore, this method requires access to the model's hidden states, which is not possible for "black-box" models like GPT-4.

However, the discovery of early-layer signals opens the door for real-time hallucination mitigation. Future systems could potentially monitor these internal "brain" signals at Layer 4 and trigger the model to backtrack or regenerate ungrounded sentences before they are ever presented to the user.

Summary updated

BibTeX
@inproceedings{chwang2024do,
  author = {Sky CH-Wang and Benjamin Van Durme and Jason Eisner and Chris Kedzie},
  title = {{Do Androids Know They're Only Dreaming of Electric Sheep?}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=bGwwJ2LuMN},
}
Figure