LUQ: Long-text Uncertainty Quantification for LLMs

Caiqi Zhang, Fangyu Liu, Marco Basaldella, Nigel Collier

This blog-style summary provides a technical overview of the paper "LUQ: Long-text Uncertainty Quantification for LLMs," which introduces a new framework for detecting hallucinations in long-form AI-generated content.

TL;DR

LUQ (Long-text Uncertainty Quantification) is a novel black-box framework that measures the factuality of long LLM responses by checking sentence-level consistency across multiple generated samples. It significantly outperforms existing short-text methods, enabling more reliable model ensembling and "selective answering" strategies where models decline to answer when uncertain.

What Problem Does This Paper Address?

Large Language Models (LLMs) are notorious for "hallucinating"—generating content that sounds plausible but is factually incorrect. Uncertainty Quantification (UQ) is the standard tool for detecting these errors: if a model is "unsure," it’s likely hallucinating.

However, the authors identify two major gaps in current UQ research:

  1. Short-text Bias: Most existing UQ methods were designed for brief responses (often <10 words). In long-form generation (biographies, medical reports), global similarity metrics fail because two long texts can look 90% similar but contradict each other on a single, crucial fact.
  2. The Black-Box Barrier: Many state-of-the-art models (like GPT-4 or Gemini) are closed-source. We cannot access their internal "logits" (probability distributions), making traditional "white-box" UQ methods impossible to use.

Methods

The authors propose LUQ, a sampling-based approach that treats the LLM as a black box. The core workflow is illustrated below:

Figure 1: The illustration of the LUQ and LUQ-ENSEMBLE framework. Given a question, various LLMs exhibit differing levels of uncertainty. We generate n sample responses from each LLM and then assess the uncertainty based on the diversity of these samples (the LUQ metric). Green highlights indicate consistency across responses (low uncertainty) and red highlights discrepancies (high uncertainty). The LUQ-ENSEMBLE method selects the response from the LLM with the lowest uncertainty score as the final answer.
  1. Sampling: For a given query, the model generates one primary response and $n$ additional stochastic samples.
  2. Sentence-Level Consistency: Instead of comparing whole documents, LUQ splits the response into sentences. It uses a Natural Language Inference (NLI) classifier to determine if each sentence is "entailed" (supported) or "contradicted" by the other samples.
  3. Uncertainty Calculation: The final uncertainty score is derived from the average entailment probability across all sentences and samples.

The authors also introduced two variations:

  • LUQ-ATOMIC: Uses an LLM (like ChatGPT) to break sentences into "atomic facts" for even finer-grained checking.
  • LUQ-PAIR: A more computationally intensive version that checks every sentence pair between responses to bypass the input length limits of NLI models.

Datasets

The study evaluated six popular LLMs (including GPT-4, Gemini 1.0 Pro, and Yi-34B) across two main datasets:

  • FACTSCORE-BIO: 500 biographies of individuals from Wikidata. Factuality was measured using the FACTSCORE tool, which breaks biographies into atomic facts and verifies them against Wikipedia.
  • FACTSCORE-DIS: A newly introduced dataset by the authors focusing on 180 disease entities, categorized by their frequency in the training data (from "very rare" to "very frequent").

Key Insights and Ideas

  • Granularity Matters: The "aha moment" of the paper is that for long text, you must look at the trees, not the forest. Global similarity metrics (like ROUGE or BERTScore) are too blunt; sentence-level NLI is required to catch specific factual slips.
  • The Popularity Effect: Models are significantly more factual and certain about "frequent" entities. As entities become "rare," uncertainty scores climb and factuality drops sharply.
  • Ensembling Peers: The authors proposed LUQ-ENSEMBLE, which picks the answer with the lowest LUQ score from a pool of different models. They found this works best when ensembling models of similar strength. Ensembling a weak model with GPT-4 provides little benefit, as the system almost always (rightly) just picks the GPT-4 output.
  • Selective Answering: By setting an uncertainty threshold, models can be "taught" to stay silent. Rejecting the 15% most uncertain answers improved overall factuality scores by over 5%.

Key Results

  • Superior Correlation: LUQ showed a much stronger negative correlation with factuality than baselines. For Gemini Pro, it achieved a Pearson correlation of -0.85, meaning the uncertainty score is a very reliable proxy for actual errors.
  • Factuality vs. Uncertainty: The scatter plots in Figure 2 demonstrate a clear trend: as factuality increases, uncertainty (measured by LUQ) consistently decreases across all tested models.
Scatter plots showing the strong negative correlation between LUQ uncertainty scores and actual factuality scores across different LLMs.
  • Frequency Impact: Figure 3 highlights how model performance degrades on "rare" knowledge, a gap that LUQ successfully identifies.
Figure 3: Factuality and uncertainty scores across dif- ferent frequencies on FACTSCORE-BIO.

Limitations and Future Work

  • Computational Cost: Generating multiple samples and running NLI checks for every sentence is expensive and slow compared to single-pass generation.
  • Narrow Focus: The study focuses almost entirely on factuality. It does not account for other quality dimensions like prose style, coherence, or creativity.
  • Ambiguity: The authors acknowledge that LUQ might struggle with inherently ambiguous questions where multiple "correct" but different answers exist.
  • Fairness in LUQ-ATOMIC: Since LUQ-ATOMIC uses ChatGPT to preprocess text, there is a risk of "LLM-evaluator bias" when checking the outputs of other models.

Summary updated

BibTeX
@inproceedings{zhang2024luq,
  author = {Caiqi Zhang and Fangyu Liu and Marco Basaldella and Nigel Collier},
  title = {{LUQ: Long-text Uncertainty Quantification for LLMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.299},
}
Figure