On the Universal Truthfulness Hyperplane Inside LLMs

Junteng Liu, Shiqi Chen, Yu Cheng, Junxian He

Here is a blog-style summary of the paper, tailored for researchers and engineers interested in LLM interpretability and the mechanics of factual correctness.

TL;DR

Probing an LLM's internal states on a single dataset to detect hallucinations usually fails to generalize to new tasks, overfitting to spurious correlations instead. By scaling training data diversity across more than 40 distinct datasets, this paper demonstrates that a universal truthfulness hyperplane actually exists within LLMs, and it can be found using as few as 10 data samples per dataset.

What Problem Does This Paper Address?

Large Language Models (LLMs) are notorious for "hallucinating"—generating text that sounds plausible but is factually incorrect. To combat this, researchers have turned to probing: training simple linear classifiers (hyperplanes) on the model's internal hidden states to see if the LLM "knows" when it is lying or mistaken.

While these probes perform exceptionally well on the specific datasets they are trained on, they notoriously fail to generalize to out-of-distribution (OOD) data. For instance, a probe trained exclusively on the popular TruthfulQA dataset suffers an average performance drop of 25 absolute percentage points when tested on other datasets. This failure raises a critical question: Are internal representations of truthfulness merely artifacts of overfitting to a specific dataset's style, or is there a fundamental, task-agnostic representation of truthfulness buried deep inside LLMs?

Methods

Instead of training a probe on a single task, the authors scale up training data diversity. They propose a framework to find a universal truthfulness hyperplane by extracting internal representations across a wide variety of tasks.

Figure 1: Top: we extract representations from the last token of the input sequence, then specific locations of the hidden states inside the LLM are selected and concatenated as input to train the probe. Bottom: Previous works mainly train the linear probe on one dataset which tends to overfit spurious features. Our work utilizes diverse datasets to examine whether a universal truthfulness hyperplane exists that can generalize to out-of-domain data.

Key components of their method include:

  • Representation Selection: The authors extract hidden states from the last token of the input sequence. Through ablation studies, they discover that attention head outputs provide far more robust features for truthfulness than standard layer residual stream activations.
  • Location Selection Strategy: Rather than using all hidden states (which introduces massive redundancy), they run a preliminary sweep across all 1024 attention heads (32 layers $\times$ 32 heads for a 7B model) to identify the top num (typically 1 or 2) heads that best correlate with truthfulness on validation data.
  • Sparsity Constraints: To keep the probe computationally efficient and prevent overfitting, they apply a linear ranking method to compress the dimensionality of the selected attention head outputs to a sparse subset ($k$ = 64 or 128 dimensions).
  • Classification: They evaluate two standard linear supervised probing methods: Logistic Regression (LR) and Mass Mean (MM).

Datasets

To rigorously test cross-task generalization, the authors curated a massive suite of 49 datasets spanning 17 distinct task categories.

Figure 2: Our curated datasets and tasks. Left (Blue) part represents the training tasks, while the right (Orange) represents the test tasks.

The datasets are split into:

  • Training Tasks: Includes Paraphrase Identification (MRPC, QQP), Statement Fact Checking (CounterFact, Creak), Sentiment Analysis (IMDB, Yelp), Close Book Multi-Choice QA (ARC, CSQA), and Coreference Resolution (Winogrande), among others.
  • Test Tasks: Kept strictly separate to evaluate true cross-task generalization. These include Sentence Completion (CoPA, HellaSwag, Story Cloze), Short Answer Close Book QA (Natural Questions, TriviaQA, SciQ), and Summarization (CNN/DailyMail, XSum).

Key Insights and Ideas

  • Diversity Trumps Volume: The most surprising finding is that the number of different tasks used to train the probe is critical for generalization, whereas the number of samples per task is not.
  • Extreme Data Efficiency: Probes trained with a mere 10 samples per dataset achieved performance virtually identical to those trained with 800 samples per dataset. Because the underlying feature is linear, the probe requires very little data to find the right orientation, provided the data covers diverse contexts.
  • Scale Enhances Separability: As models grow more advanced (moving from LLaMA2-7b to Mistral-7b or LLaMA2-13b), cross-task probing accuracy improves. This suggests that larger, more capable models develop a more distinct, linearly separable internal representation of truthfulness.
  • Alignment Alignment: A probe trained on a base model's hidden states generalizes remarkably well to a fine-tuned version of that same model, even improving classification accuracy. This implies that instruction tuning makes the model's internal truthfulness representations cleaner and more pronounced.

Key Results

While dedicated probes trained only on TruthfulQA hover near random chance (~54% accuracy) when faced with out-of-distribution tasks, the diversely trained probes tell a completely different story:

  • Cross-Task Generalization: In the strict cross-task setting, the Mass Mean probe (Probe-MM) achieved ~70% accuracy on LLaMA2-7b-chat, significantly outperforming strong baselines like Self-Evaluation (prompting the model "Is this answer correct?") and token probability baselines.
  • Advanced Models: Performance scales up with better models. On the Mistral-7b base model, Probe-MM achieved an impressive 77.11% average cross-task accuracy, outperforming the baseline by 12.81 absolute points.

Limitations and Future Work

  • Bounded by Model Knowledge: A probe cannot extract truth that isn't there. If an LLM genuinely believes a false fact due to pre-training data limits, its internal states will reflect "truthfulness," meaning the probe will classify the hallucination as correct.
  • Supervised Probing Only: This study focuses entirely on supervised methods (LR and MM). Future work could explore whether unsupervised methods like Contrast-Consistent Search (CCS) can similarly discover this universal hyperplane without labels.
  • From Detection to Intervention: The authors demonstrate that they can find the hyperplane, but they leave active intervention—such as shifting hidden states during inference to actively prevent hallucinations—to future research.

Summary updated

BibTeX
@inproceedings{liu2024universal,
  author = {Junteng Liu and Shiqi Chen and Yu Cheng and Junxian He},
  title = {{On the Universal Truthfulness Hyperplane Inside LLMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.1012},
}
Figure