Uncertainty as Feature Gaps: Epistemic Uncertainty Quantification of LLMs in Contextual Question-Answering

Yavuz Faruk Bakman, Zhiqi Huang, Chenyang Zhu, Anoop Kumar, Alfy Samuel, Daben Liu · DOI

Introduction

Large Language Models (LLMs) are central to Retrieval-Augmented Generation (RAG) systems, yet their reliability remains a concern. In contextual question-answering (QA), models often hallucinate or prioritize internal parametric memory over the provided context. Traditional Uncertainty Quantification (UQ) methods, largely designed for closed-book tasks, struggle to distinguish between inherent linguistic noise (aleatoric uncertainty) and the model's own knowledge deficits (epistemic uncertainty). This research introduces a theoretically grounded framework that treats epistemic uncertainty as a measurable "feature gap" within the model's internal representation space.

The Feature-Gaps Framework

The proposed method shifts the focus from output probability scores to the geometric properties of internal hidden states. The core idea is that uncertainty can be quantified by the distance between the actual model's state and an "ideal" model's state.

Overview of the Feature-Gaps framework, illustrating the transition from a UQ metric to a geometric representation of feature gaps.

The framework operates in three primary steps:

  1. Approximation: Since the "true" distribution $P^*$ is unknown, it is approximated using an "optimal prompt" designed to maximize accuracy. This creates a proxy for an ideal model $\theta^*$.
  2. Upper Bounding: The authors mathematically demonstrate that the epistemic uncertainty (measured via KL Divergence) is upper-bounded by the Euclidean distance between the last-layer hidden states of the actual model ($h$) and the ideal model ($h^*$).
  3. Feature Decomposition: Leveraging the Linear Representation Hypothesis, this distance is decomposed into interpretable semantic directions.

Geometric Interpretation of Uncertainty

By viewing uncertainty as a physical distance in "thought space," the researchers identify specific axes that contribute to errors. These include Context-Reliance (reliance on provided text vs. internal memory), Context Comprehension (understanding of the text), and Honesty (truthfulness vs. sycophancy).

The Linear Representation Hypothesis allows for decomposing the hidden state distance into specific semantic feature vectors.

These features are extracted using a "top-down interpretability" approach. By applying contrastive prompts (e.g., "be honest" vs. "be a liar") to a small set of examples, the model identifies the specific vectors in the activation space corresponding to these high-level concepts. Uncertainty is then calculated as the sum of the gaps along these semantic axes.

Experimental Results

The "Feature-Gaps" method was evaluated across three model families (LLaMA-3.1-8B, Mistral-v0.3-7B, and Qwen2.5-7B) using diverse benchmarks: Qasper (scientific papers), HotpotQA (multi-hop Wikipedia), and NarrativeQA (long-form stories).

Key findings include:

  • Superior Performance: The method achieved up to a 13-point improvement in the Prediction-Rejection Ratio (PRR) compared to existing unsupervised and supervised baselines.
  • Extreme Data Efficiency: High accuracy was maintained with as few as 64 labeled samples, making it highly practical for real-world engineering where labeled data is expensive.
  • Out-of-Distribution (OOD) Robustness: Unlike many supervised UQ methods that overfit to specific datasets, the feature-based approach generalizes well across domains (e.g., from scientific papers to Wikipedia).

Conclusion and Future Work

This research demonstrates that uncertainty in LLMs is not merely a statistical artifact but a geometric property of their internal representations. By isolating epistemic uncertainty through feature gaps, developers can build more reliable RAG systems with minimal computational overhead. Future work will explore automating the discovery of task-specific features and addressing performance degradation in extremely long context windows.

Summary updated

Abstract

Uncertainty Quantification (UQ) research has primarily focused on closed-book factual question answering (QA), while contextual QA remains unexplored, despite its importance in real-world applications. In this work, we focus on UQ for the contextual QA task and propose a theoretically grounded approach to quantify \emph{epistemic uncertainty}. We begin by introducing a task-agnostic, token-level uncertainty measure defined as the cross-entropy between the predictive distribution of the given model and the unknown true distribution. By decomposing this measure, we isolate the epistemic component and approximate the true distribution by a perfectly prompted, idealized model. We then derive an upper bound for epistemic uncertainty and show that it can be interpreted as semantic feature gaps in the given model’s hidden representations relative to the ideal model. We further apply this generic framework to the contextual QA task and hypothesize that three features approximate this gap: \emph{context-reliance} (using the provided context rather than parametric knowledge), \emph{context comprehension} (extracting relevant information from context), and \emph{honesty} (avoiding intentional lies). Using a top-down interpretability approach, we extract these features by using only a small number of labeled samples and ensemble them to form a robust uncertainty score. Experiments on multiple QA benchmarks in both in-distribution and out-of-distribution settings show that our method substantially outperforms state-of-the-art unsupervised (sampling-free and sampling-based) and supervised UQ methods, achieving up to a 13-point PRR improvement while incurring a negligible inference overhead.
BibTeX
@inproceedings{bakman2026uncertainty,
  author = {Yavuz Faruk Bakman and Zhiqi Huang and Chenyang Zhu and Anoop Kumar and Alfy Samuel and Daben Liu},
  title = {{Uncertainty as Feature Gaps: Epistemic Uncertainty Quantification of LLMs in Contextual Question-Answering}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=OWvvdl27CE},
}
Figure