Semantic Volume: Quantifying and Detecting Both External and Internal Uncertainty in LLMs

Xiaomin Li, Zhou Yu, Ziji Zhang, Yingying Zhuang, Swair Shah, Narayanan Sadagopan, Anurag Beniwal

TL;DR

The authors introduce Semantic Volume, a training-free, unsupervised method to detect both ambiguous user queries (external uncertainty) and hallucinated model responses (internal uncertainty) in LLMs. By measuring the geometric volume of perturbed text embeddings via a Gram matrix determinant, this approach consistently outperforms existing baselines without requiring access to internal model weights or token probabilities.

What Problem Does This Paper Address?

When Large Language Models (LLMs) fail, they often do so because of uncertainty. This uncertainty generally stems from two distinct sources:

  1. Internal Uncertainty: The model lacks the necessary knowledge, or its training data contains conflicting information, leading to a hallucinated response.
  2. External Uncertainty: The user's prompt is inherently ambiguous (e.g., asking "Who played Spiderman?" without specifying which movie), meaning there are multiple valid interpretations.

While substantial research focuses on detecting internal uncertainty, external uncertainty is often overlooked or handled via brittle, expensive LLM prompting strategies. Furthermore, existing black-box uncertainty metrics (like Semantic Entropy) require discrete, manual clustering steps that ignore semantic variations within clusters. This paper addresses the need for a unified, continuous, and computationally efficient framework to quantify both types of uncertainty without needing internal access to the LLM's token probabilities.

Methods

The core idea behind Semantic Volume is elegant: if an LLM is certain about a concept, small perturbations to that concept should remain semantically close. If it is uncertain, those perturbations will scatter across the semantic space.

Pipeline for external and internal uncertainty detection using semantic volume.

The framework operates in three main steps:

  1. Perturbation Generation:
  2. For external uncertainty, the user query is paraphrased $n$ times using an LLM to explore different contextual interpretations.
  3. For internal uncertainty, the model is sampled $n$ times at a high temperature to generate candidate responses.
  4. Embedding and Dimension Reduction: The perturbed texts are converted into normalized vectors using a standard sentence transformer. Principal Component Analysis (PCA) is applied to project these vectors into a lower-dimensional space ($d$), which helps better separate the perturbation vectors.
  5. Semantic Volume Calculation: The vectors are arranged as columns in a matrix $V$. The uncertainty is quantified by computing the log-determinant of the Gram matrix: $$\text{SemanticVolume}(V) = \log \det(\tilde{V}^\top \tilde{V} + \epsilon I_n)$$ Geometrically, the determinant of $V^\top V$ calculates the squared volume of the parallelepiped spanned by these vectors. A larger volume indicates higher semantic dispersion and thus higher uncertainty.

The authors also provide a rigorous theoretical proof showing that under Gaussian assumptions, this log-determinant serves as a continuous approximation of differential entropy.

Datasets

The method was evaluated across four benchmark datasets split by uncertainty type:

  • External Uncertainty (Query Ambiguity):
  • CLAMBER: A balanced dataset of 3,000 queries annotated with binary ambiguity labels.
  • AmbigQA: A dataset containing open-domain questions labeled as ambiguous or unambiguous.
  • Internal Uncertainty (Response Hallucination):
  • TriviaQA and SQuAD: Reading comprehension datasets. The authors constructed balanced 5,000-sample subsets for each, defining a "hallucination" as any response scoring below 0.3 on a ROUGE-L comparison against the ground-truth answer.

Key Insights and Ideas

  • Unification of Uncertainty: Instead of treating query ambiguity and response hallucination as separate engineering challenges, the paper elegantly unifies them under the mathematical umbrella of semantic dispersion.
  • A Continuous Generalization of Semantic Entropy: Previous state-of-the-art methods like Semantic Entropy rely on discretely clustering sentences into equivalence classes. Semantic Volume bypasses this manual, hard-clustering step entirely, accounting for subtle semantic variations within clusters and offering a more mathematically principled, continuous alternative.
  • The Power of PCA: Interestingly, the ablation studies show that applying PCA to lower the embedding dimensions actually improves uncertainty detection. Lower-dimensional projections help filter out noise and better isolate the true semantic dispersion of the perturbations.

Key Results

Semantic Volume consistently outperformed prompting-based, probability-based, and sampling-based baselines across multiple evaluation models (including Llama 3, Qwen, and Mistral).

  • Query Ambiguity (External): On the CLAMBER dataset, Semantic Volume achieved an accuracy of 58.0% and an F1 score of 69.1, significantly beating Semantic Entropy (50.2% Acc / 62.8 F1) and even outperforming ChatGPT with Chain-of-Thought prompting (57.3% Acc / 56.9 F1).
  • Hallucination Detection (Internal): When evaluating a Llama 3.2-1B-Instruct model on TriviaQA, Semantic Volume achieved an AUROC of 79.7, compared to 73.9 for Semantic Entropy and 65.5 for standard Log Probabilities.

Crucially, because it is sampling-based, it avoids the massive latency penalties that probability-based methods suffer from when scaling up to larger models.

Limitations and Future Work

The authors explicitly note that Semantic Volume is designed for cases where uncertainty correlates with incorrectness. It cannot detect confidently wrong answers—instances where an LLM hallucinates with high certainty due to flawed training data or systemic bias. In these scenarios, the sampled responses will cluster tightly, yielding a low Semantic Volume despite being incorrect. The authors suggest that addressing confidently wrong answers will require complementary strategies like external fact-checking or retrieval-augmented generation (RAG) pipelines.

Summary updated

BibTeX
@inproceedings{li2026semantic,
  author = {Xiaomin Li and Zhou Yu and Ziji Zhang and Yingying Zhuang and Swair Shah and Narayanan Sadagopan and Anurag Beniwal},
  title = {{Semantic Volume: Quantifying and Detecting Both External and Internal Uncertainty in LLMs}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i37.40443},
}
Figure