Table of Contents
Fetching ...

A statistically consistent measure of semantic uncertainty using Language Models

Yi Liu

TL;DR

This work introduces semantic spectral entropy (SSE), a statistically consistent measure of semantic uncertainty for outputs of language models. SSE first encodes semantic similarity among texts into a random graph via a language-model-based equivalence relation, then uses spectral clustering to form semantic clusters and compute entropy over cluster memberships. The authors provide theoretical guarantees, including strong consistency and finite-sample rates, for both fixed-cluster and generative-model scenarios, and analyze how the cluster count $K$ should grow with sample size. Simulations with unordered proposition sets demonstrate phase-transition behavior and model-length effects on SSE, supporting the method’s robustness and broad applicability for unsupervised uncertainty quantification in NLP systems.

Abstract

To address the challenge of quantifying uncertainty in the outputs generated by language models, we propose a novel measure of semantic uncertainty, semantic spectral entropy, that is statistically consistent under mild assumptions. This measure is implemented through a straightforward algorithm that relies solely on standard, pretrained language models, without requiring access to the internal generation process. Our approach imposes minimal constraints on the choice of language models, making it broadly applicable across different architectures and settings. Through comprehensive simulation studies, we demonstrate that the proposed method yields an accurate and robust estimate of semantic uncertainty, even in the presence of the inherent randomness characteristic of generative language model outputs.

A statistically consistent measure of semantic uncertainty using Language Models

TL;DR

This work introduces semantic spectral entropy (SSE), a statistically consistent measure of semantic uncertainty for outputs of language models. SSE first encodes semantic similarity among texts into a random graph via a language-model-based equivalence relation, then uses spectral clustering to form semantic clusters and compute entropy over cluster memberships. The authors provide theoretical guarantees, including strong consistency and finite-sample rates, for both fixed-cluster and generative-model scenarios, and analyze how the cluster count should grow with sample size. Simulations with unordered proposition sets demonstrate phase-transition behavior and model-length effects on SSE, supporting the method’s robustness and broad applicability for unsupervised uncertainty quantification in NLP systems.

Abstract

To address the challenge of quantifying uncertainty in the outputs generated by language models, we propose a novel measure of semantic uncertainty, semantic spectral entropy, that is statistically consistent under mild assumptions. This measure is implemented through a straightforward algorithm that relies solely on standard, pretrained language models, without requiring access to the internal generation process. Our approach imposes minimal constraints on the choice of language models, making it broadly applicable across different architectures and settings. Through comprehensive simulation studies, we demonstrate that the proposed method yields an accurate and robust estimate of semantic uncertainty, even in the presence of the inherent randomness characteristic of generative language model outputs.

Paper Structure

This paper contains 24 sections, 14 theorems, 47 equations, 1 figure, 1 table, 1 algorithm.

Key Result

Proposition 2.1

The relation $t_i \sim t_j$ if "$t_i$ is true if and only if $t_j$ is true" is an equivalence relation.

Figures (1)

  • Figure 1: A scatter plot of $p-q$ against $|\bar{\mathcal{E}}- \hat{\mathcal{E}}|$ for outcome in experiment 1. The different colors represents different language models used as $e$: A21 in blue, Phi in Orange, GPT in Green, Cohere in Red, Llama is Purple and Ministral in Brown. We notice that there is clear phrase change point where for $p-q <0.4$, we have that $|\bar{\mathcal{E}}- \hat{\mathcal{E}}|$ is very high most of the time, for $p-q >0.4$, $|\bar{\mathcal{E}}- \hat{\mathcal{E}}|$ is small with occasional jumps that the theory predicts.

Theorems & Definitions (29)

  • Proposition 2.1
  • Lemma 3.1
  • Theorem 3.2
  • Theorem 3.3
  • Remark
  • Corollary 3.3.1
  • Remark
  • Theorem 3.4
  • proof
  • Remark
  • ...and 19 more