Estimating LLM Uncertainty with Logits

Huan Ma, Jingdong Chen, Guangyu Wang, Changqing ZhangarXiv 2025

Abstract: Over the past few years, Large Language Models (LLMs) have developed rapidly and are widely applied in various domains. However, LLMs face the issue of hallucinations, generating responses that may be unreliable when the models lack relevant knowledge. To be aware of potential hallucinations, uncertainty estimation methods have been introduced, and most of them have confirmed that reliability lies in critical tokens. However, probability-based methods perform poorly in identifying token reliability, limiting their practical utility. In this paper, we reveal that the probability-based method fails to estimate token reliability due to the loss of evidence strength information which is accumulated in the training stage. Therefore, we present Logits-induced token uncertainty (LogTokU), a framework for estimating decoupled token uncertainty in LLMs, enabling real-time uncertainty estimation without requiring multiple sampling processes. We employ evidence modeling to implement LogTokU and use the estimated uncertainty to guide downstream tasks. The experimental results demonstrate that LogTokU has significant effectiveness and promise.

Introduction: The Hallucination Challenge

Large Language Models (LLMs) are notorious for "hallucinating"—confidently stating facts that are incorrect. To mitigate this risk, reliable uncertainty estimation is essential. Currently, most methods fall into two camps: sampling-based methods, which are accurate but computationally expensive, and probability-based methods, which rely on the "softmax" probability of the next token. This research identifies a fundamental flaw in probability-based methods: the normalization step in the softmax function discards critical information regarding "evidence strength."

The Normalization Trap

The authors argue that softmax normalization destroys the model's ability to distinguish between different types of uncertainty. For instance, if a model identifies multiple valid answers (e.g., different historical presidents), the probability for each individual token decreases, making the model appear uncertain despite having high evidence for all options. Conversely, a model might assign a high probability to a token simply because it is the "least bad" option in an unfamiliar domain, even if the underlying evidence is nearly zero.

Figure 2: Illustration of how softmax normalization obscures evidence strength in common sense vs. unsolved physics problems.

As shown in the figure above, a common-sense question might result in high entropy (uncertainty) because there are many correct answers, whereas an unsolved physics problem might result in low entropy (certainty) simply because the model has a single, albeit poorly supported, prediction. This "normalization trap" prevents standard probability metrics from accurately reflecting model reliability.

Methodology: LogTokU and Decoupled Uncertainty

To solve this, the researchers introduced LogTokU (Logits-induced token Uncertainty). This framework treats the raw logits of the top-$K$ tokens as parameters for a Dirichlet distribution. This approach allows the model to decouple uncertainty into two distinct types:

  • Aleatoric Uncertainty (AU): Data-level uncertainty that occurs when there are multiple valid paths (e.g., choosing between a comma and a period, or two different correct names).
  • Epistemic Uncertainty (EU): Model-level uncertainty that occurs when the model has not seen enough similar data during training to be confident.

By utilizing raw logits, LogTokU measures the total evidence (the sum of the logits). High total evidence indicates the model "knows" the domain, while low total evidence indicates it is guessing. This "gray-box" approach operates in a single forward pass ($O(1)$ complexity), making it significantly faster than sampling-based methods.

The Four Quadrants of Certainty

The paper categorizes token generation into four distinct states based on AU and EU:

  1. I don't know: High AU, High EU (Low evidence, no clear winner).
  2. I suggest: Low AU, High EU (Low evidence, but one token is slightly ahead).
  3. I am sure: Low AU, Low EU (High evidence for one specific token).
  4. I know multiple answers: High AU, Low EU (High evidence for several valid tokens).

Experimental Results

LogTokU was evaluated across LLaMA-2 and LLaMA-3 models using the SemEval and TruthfulQA benchmarks. Key findings include:

  • Dynamic Decoding: On the SemEval emotion classification task, LogTokU improved the balance between diversity and accuracy, outperforming the best baseline by up to 11.4% on LLaMA-2-13B.
  • Reliability Estimation: On TruthfulQA, LogTokU achieved significantly higher AUROC scores than sampling-based methods like Semantic Entropy. For LLaMA-2-7B, it reached 71.78% AUROC, compared to approximately 48.91% for sampling methods.
  • Efficiency: The method provides real-time uncertainty quantification with negligible computational overhead, as it does not require generating multiple responses.

Conclusion and Limitations

LogTokU represents a significant step forward in real-time uncertainty estimation for LLMs. However, it faces limitations: it requires access to raw logits, making it incompatible with closed-source "black-box" APIs like GPT-4. Additionally, it performs less effectively on distilled models where logits have been rescaled. Future work will focus on more sophisticated sentence-level mapping of token uncertainties.

Summary updated

BibTeX
@misc{ma2025estimating,
  author = {Huan Ma and Jingdong Chen and Guangyu Wang and Changqing Zhang},
  title = {{Estimating LLM Uncertainty with Logits}},
  year = {2025},
  eprint = {2502.00290},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.00290},
}
Figure