Query-Level Uncertainty in Large Language Models

Lihu Chen, Gerard de Melo, Fabian M. Suchanek, Gaël Varoquaux

Introduction

Researchers have developed "Internal Confidence," a training-free method that allows Large Language Models (LLMs) to estimate if they can answer a query before they start generating text. By analyzing internal layer states during a single forward pass, this approach provides uncertainty signals up to 600x faster than traditional methods, enabling much more efficient "adaptive inference" like Retrieval-Augmented Generation (RAG) or model cascading.

The Challenge of Knowledge Boundaries

Large Language Models (LLMs) are notorious for "hallucinating"—confidently stating falsehoods when they reach the edge of their knowledge. To build trustworthy AI, models need to be self-aware of these "knowledge boundaries."

Currently, most uncertainty estimation happens at the answer-level. This means the model has to generate a full response (often multiple times) before we can calculate how "sure" it is. This is computationally expensive and slow. If a model is going to fail, we want to know before it spends tokens and time generating a long, incorrect answer.

Answer-Level vs Query-Level Uncertainty

The authors tackle Query-Level Uncertainty: determining if a model is capable of addressing a prompt before a single token of the actual answer is produced. This allows the system to "gatekeep" queries—deciding instantly whether to answer directly, retrieve external data (RAG), or pass the hard question to a larger, more expensive model.

Methods: Internal Confidence

The authors introduce a novel, training-free technique called Internal Confidence (IC). It relies on two clever components:

  1. Self-Evaluation via P(YES): The model is prompted to assess itself: "Respond only with 'Yes' or 'No' to indicate whether you are capable of answering the following question..." Instead of looking at the text output, the researchers look at the probability the model assigns to the token "YES" in its internal unembedding layer.
  2. Attenuated Encoding: Rather than just looking at the very last layer, IC aggregates these "YES" probabilities across all layers and all tokens in the query. They use a weighted average centered around a "decision center" (typically the final layer and final token). This allows the method to capture latent "confidence signals" that might be brewing in the middle layers of the network.

Crucially, this requires only a single forward pass and no additional training or "probes," making it highly portable across different model architectures.

Datasets and Evaluation

The method was evaluated across a diverse range of tasks:

  • Factual QA: TriviaQA, SciQ, and SimpleQA (short-form facts).
  • Mathematical Reasoning: GSM8K (multi-step word problems).
  • Complex Reasoning: MuSiQue (multihop questions) and TruthfulQA (testing for common misconceptions).

The researchers used these to compare their method against standard baselines like Perplexity, Maximum Log-Probability, and Semantic Entropy.

Key Insights and Ideas

  • The "Decision Center" Shifts: For factual questions, the model’s "certainty" is most accurate in the final layers. However, for mathematical reasoning (GSM8K), the optimal "decision center" actually appears in the lower or middle layers. This suggests that the model "knows" if it can solve a math problem much earlier in its internal processing than it knows a fact.
  • Generation is the Bottleneck: The biggest "aha moment" is the efficiency gain. Because IC doesn't wait for the model to "talk," it avoids the most time-consuming part of LLM inference.
  • Adaptive Gating: The paper demonstrates that IC can act as a high-speed switch. In a "Model Cascade" setup, a small model (like Phi-3) uses IC to check its confidence. If it's low, it immediately defers to a larger model (like Qwen-14B), saving significant compute on easy questions while maintaining high accuracy on hard ones.

Key Results

  • Superior Accuracy: Internal Confidence consistently outperformed baselines in distinguishing between answerable and non-answerable queries, achieving higher AUROC (Area Under the Receiver Operating Characteristic) scores across almost all models and datasets.
  • Massive Speedups: Compared to "answer-level" uncertainty methods (which require generating text), IC achieved speedups between 30x and 600x. For example, while some methods took 180 seconds to assess a sample, IC took just 0.3 seconds.
AUROC vs Running Time
  • Cost-Efficiency: In RAG settings, using IC to decide when to invoke retrieval allowed the system to maintain high accuracy while significantly reducing the number of expensive external knowledge calls.

Limitations and Future Work

  • White-Box Requirement: The method requires access to the model's internal hidden states and logits. This means it cannot be used with "black-box" APIs (like the standard ChatGPT or Claude interfaces) unless the providers expose more internal data.
  • Hyperparameter Tuning: While the authors found a "default" setting that works well, the optimal "decision center" varies by task. Future work could involve automatically learning where a model's "confidence" lives for different types of reasoning.
  • Performance Gap: While IC is much faster, it still slightly lags behind the most sophisticated (but incredibly slow) post-generation uncertainty methods in terms of pure predictive accuracy. Closing this gap while maintaining the speed advantage is the next frontier.

Summary updated

BibTeX
@inproceedings{chen2026query,
  author = {Lihu Chen and Gerard de Melo and Fabian M. Suchanek and Gaël Varoquaux},
  title = {{Query-Level Uncertainty in Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=11QZITAMUO},
}
Figure