SPUQ: Perturbation-Based Uncertainty Quantification for Large Language Models

Xiang Gao, Jiaxin Zhang, Lalla Mouatadid, Kamalika Das · DOI

Introduction

Large Language Models (LLMs) are prone to "hallucinations"—generating incorrect information with high confidence. In the field of Uncertainty Quantification (UQ), researchers distinguish between two primary types of uncertainty: Aleatoric Uncertainty, which stems from the inherent randomness in language, and Epistemic Uncertainty, which represents the model’s actual lack of knowledge or suboptimal modeling.

While existing UQ methods often address aleatoric uncertainty by sampling multiple outputs for a single prompt, they frequently fail when a model is "confidently wrong." In such cases, the model repeats the same error across all samples. SPUQ (Sampling with Perturbation for Uncertainty Quantification) addresses this gap by capturing epistemic uncertainty, ensuring that a model's confidence score accurately reflects its knowledge instability.

Methodology

SPUQ operates by "stress-testing" the model through two primary modules designed to reveal hidden knowledge gaps.

The SPUQ framework compared to traditional one-pass and sampling-based UQ methods.

The Perturbation Module

Rather than repeating the same query, SPUQ "shakes" the input using several techniques:

  • Paraphrasing: Rewriting the prompt in multiple ways while preserving core meaning.
  • Dummy Tokens: Adding minor noise such as extra spaces or ellipses.
  • System Messages: Altering the model's persona (e.g., from "helpful assistant" to "friendly assistant").
  • Temperature Scaling: Adjusting the randomness of generation.

The Aggregation Module

This module collects the varied outputs and calculates a final confidence score. To handle long-form text where exact matches are rare, SPUQ employs semantic similarity metrics like RougeL, BERTScore, and SentenceBERT. This allows the system to determine if the model’s answers remain consistent in meaning, even if the specific wording fluctuates.

Experimental Results

The researchers evaluated SPUQ across diverse tasks (classification, generation, and summarization) using models including GPT-4, ChatGPT, and PaLM2.

Expected Calibration Error (ECE) across various benchmarks, demonstrating SPUQ's superior performance compared to standard likelihood and sampling methods.

Key Findings

  • Massive Error Reduction: SPUQ reduced the Expected Calibration Error (ECE) by an average of 50% (ranging from 30% to 70%) across different datasets. This makes AI responses significantly more trustworthy by aligning confidence with actual accuracy.
  • The "Shaking" Effect: Epistemic uncertainty is best revealed by input instability. If a model changes its answer based on a minor paraphrase, it clearly does not "know" the fact.
  • Paraphrasing is Most Effective: Among all perturbation methods, paraphrasing was the most successful at exposing model overconfidence, as it forces the model to process underlying concepts rather than specific keywords.
  • Efficiency Plateau: While more samples ($k$) generally improve calibration, the benefits begin to plateau around $k=5$, suggesting that SPUQ can be effective without excessive computational overhead.

Limitations and Future Work

Despite its effectiveness, SPUQ increases latency and API costs because it requires multiple generations for a single query. Future research is needed to optimize these costs through parallelization and to explore how SPUQ performs on highly complex, multi-step reasoning tasks or long-form creative writing where semantic consistency is harder to define.

Summary updated

BibTeX
@inproceedings{gao2024spuq,
  author = {Xiang Gao and Jiaxin Zhang and Lalla Mouatadid and Kamalika Das},
  title = {{SPUQ: Perturbation-Based Uncertainty Quantification for Large Language Models}},
  booktitle = {EACL},
  year = {2024},
}
Figure