Shapley Uncertainty in Natural Language Generation

Meilin Zhu, Gaojie Jin, Xiaowei Huang, Lijun ZhangarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) often generate responses that are semantically similar but lexically distinct, complicating traditional uncertainty estimation. This paper introduces Shapley Uncertainty, a game-theoretic approach that quantifies model confidence by analyzing continuous correlations between generated responses. By moving beyond binary semantic clustering, this method provides a more nuanced measure of uncertainty that significantly outperforms existing benchmarks in predicting model correctness.

The Problem: The "Nuance of Being Wrong"

Traditional predictive entropy measures the raw probability of tokens, which fails in Natural Language Generation (NLG) because multiple token sequences can convey the same meaning. While Semantic Entropy (Kuhn et al., 2023) improved upon this by clustering semantically equivalent answers, it relies on a hard binary threshold. This "all-or-nothing" approach ignores the degree of similarity between different incorrect answers. For instance, if the correct answer is a specific composer, a model suggesting a different composer should be viewed as less uncertain than one suggesting a painter. Current methods treat both as equally "wrong," losing critical correlational data.

Methodology

The proposed framework treats uncertainty estimation as the analysis of a correlated meaning space through three primary steps:

  1. Correlation Matrix Construction: Instead of hard-clustering, the method generates a matrix representing bidirectional semantic relationships (entailment probabilities) between sampled answers.
  2. The Kernel Trick: To ensure mathematical validity, a variant of a Gaussian kernel is applied, mapping sentences into a high-dimensional space where complex meaning patterns are measurable.
  3. Shapley Value Decomposition: Borrowing from cooperative game theory, the total uncertainty of the answer set is decomposed into "elementary uncertainties" for each individual sentence. This ensures a stable, nuanced total uncertainty score ($\phi$).
The methodological pipeline for computing Shapley Uncertainty, progressing from semantic entropy to game-theoretic decomposition.

The authors established three fundamental properties for valid uncertainty metrics—Minimal Uncertainty, Maximal Uncertainty, and Consistency—proving that Shapley Uncertainty is the only metric in its class to satisfy all three.

Experimental Evaluation

The method was validated across diverse tasks and architectures:

  • Tasks: Question Answering (CoQA, TriviaQA, SQuAD, BioASQ, NQ-Open, SVAMP) and Machine Translation (WMT 2014).
  • Models: LLaMA-2 (7B/13B), LLaMA-3 (8B), Falcon-7B, Mistral-7B, Qwen-2.5, and DeepSeek-R1-Distill.

Key Results

The primary performance metric was the Area Under the Receiver Operating Characteristic curve (AUROC), measuring how effectively the uncertainty score predicts answer accuracy.

Comparative AUROC performance showing Shapley Uncertainty's superiority across different LLM architectures on TriviaQA (left) and across various datasets for LLaMA2-7B (right).
  • Superior Accuracy: Shapley Uncertainty consistently outperformed Semantic Entropy (SE). On SQuAD with LLaMA-2-13B, it achieved an AUROC of 0.764 (vs. SE's 0.757).
  • Low-Resource Efficiency: Gains were more pronounced in smaller models. On NQ-Open with Falcon-7B, the method showed a +7.9% improvement over naive entropy.
  • Domain Robustness: Significant improvements were noted in specialized domains like BioASQ, where it outperformed SE by +3.4% using the Mistral-7B model.

Conclusion and Limitations

Shapley Uncertainty demonstrates that the relationship between incorrect answers is as informative as the probability of the correct one. By eliminating hard thresholds, it avoids information loss inherent in previous state-of-the-art methods.

However, challenges remain regarding computational costs for models exceeding 30B parameters and scaling the kernel function for long-form, continuous generation. Future research will focus on developing scalable correlation measures for the largest foundation models.

Summary updated

Abstract

In question-answering tasks, determining when to trust the outputs is crucial to the alignment of large language models (LLMs). Kuhn et al. (2023) introduces semantic entropy as a measure of uncertainty, by incorporating linguistic invariances from the same meaning. It primarily relies on setting threshold to measure the level of semantic equivalence relation. We propose a more nuanced framework that extends beyond such thresholding by developing a Shapley-based uncertainty metric that captures the continuous nature of semantic relationships. We establish three fundamental properties that characterize valid uncertainty metrics and prove that our Shapley uncertainty satisfies these criteria. Through extensive experiments, we demonstrate that our Shapley uncertainty more accurately predicts LLM performance in question-answering and other datasets, compared to similar baseline measures.
BibTeX
@misc{zhu2025shapley,
  author = {Meilin Zhu and Gaojie Jin and Xiaowei Huang and Lijun Zhang},
  title = {{Shapley Uncertainty in Natural Language Generation}},
  year = {2025},
  eprint = {2507.21406},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.21406},
}
Figure