Large Language Models (LLMs) are notoriously prone to "hallucinations"—generating factually incorrect information with high stylistic confidence. While a model might sound certain in its prose, its underlying mathematical state often tells a different story. Research into logit-based uncertainty estimation seeks to extract this hidden "doubt" by analyzing the raw probability distributions at the model's output layer. By looking at the scores assigned to tokens before they are turned into text, researchers can determine when a model is genuinely "sure" and when it is merely guessing.
The Signal in the Logits
When an LLM generates text, it produces a set of raw scores, or logits, for every possible token in its vocabulary. These logits are typically passed through a softmax function to create a probability distribution. The shape of this distribution is the primary indicator of model certainty.
As Noah Lee et al. demonstrate, calculating the relative log probabilities of candidate tokens allows for a direct quantification of the model's internal likelihood for specific labels. A "sharp" distribution, where one token has a significantly higher probability than all others, suggests high confidence. Conversely, a "flat" distribution suggests the model is undecided.
One of the most robust indicators of factual accuracy is the probability margin—the gap between the most likely token and the second-most likely token. Xiaoye Qu et al. find that a wider gap correlates strongly with factual truth, while a narrow gap often signals that the model is hallucinating or guessing. This internal signal is so stable that Siqi Fan uses it to adaptively terminate inference; if the top token's probability and the margin are high enough at an intermediate layer, the model can skip the remaining layers without losing accuracy.
Aggregating Confidence Across Sequences
While token-level probabilities are useful, most tasks require a single confidence score for an entire sentence or reasoning path. Simple averaging of token probabilities can be misleading because a few high-confidence syntactic tokens (like "the" or "is") can mask a single, catastrophic logical error.
To solve this, Elias Stengel-Eskin et al. propose using the minimum probability of any token in a sequence as the confidence metric. This "weakest link" approach ensures that if the model is uncertain about even one critical logical operator in a code snippet or SQL query, the entire output is flagged as low-confidence.
Other researchers focus on the overall likelihood of the sequence. Lukas Aichberger et al. argue that the Greedy Negative Log-Likelihood (G-NLL)—the sum of log-probabilities for a single greedily decoded sequence—is a theoretically principled and computationally efficient measure of uncertainty. This method avoids the need for expensive multi-sequence sampling, providing a "single-pass" metric for reliability.
The Honesty Gap: Probabilities vs. Verbalization
A recurring theme in recent literature is the "honesty gap": LLMs are better at "feeling" their knowledge boundaries through internal probabilities than they are at "stating" them in natural language.
Shiyu Ni et al. find that probabilistic confidence is a far more reliable indicator of truth than verbalized confidence (where a model is prompted to say "I am 80% sure"). Similarly, Linwei Tao et al. observe that high-accuracy models are often the most poorly calibrated when using linguistic "hedging," whereas their internal perplexity remains a more grounded signal of doubt. This suggests that for safety-critical applications, we should trust the model's logits over its self-reported certainty.
Preserving Signal Intensity with Semantic Energy
Standard uncertainty methods often rely on softmax-normalized probabilities. However, the normalization process can destroy valuable information about the "intensity" of the model's internal state.
Changqing Zhang et al. introduce Semantic Energy, which uses raw logit values from the penultimate layer instead of normalized probabilities. The authors argue that the absolute magnitude of raw logits serves as a proxy for the model's exposure to specific facts during training. By analyzing this "energy," systems can distinguish between cases where a model is forced to choose between several low-confidence options (high entropy but low energy) and cases where it is truly certain based on its training data. This is particularly effective for detecting "confidently wrong" hallucinations where a model might consistently produce the same incorrect answer but with low internal signal intensity.
Practical Applications of Uncertainty
Quantifying uncertainty is not just an academic exercise; it enables more efficient and autonomous AI agents.
- Adaptive Retrieval: In Retrieval-Augmented Generation (RAG), models can use logit-based scores to decide when to consult external data. Viktor Moskvoretskii et al. show that simple entropy-based triggers often outperform complex adaptive pipelines, allowing models to fetch data only when they are "stumped."
- Tool Usage: The UALA framework, proposed by Jiuzhou Han et al., uses token-level log-probabilities to decide when an agent should call an API or search engine, reducing costs and token consumption by over 50%.
- Reasoning Verification: In complex multi-step tasks, internal probabilities can act as a "reward signal." Heng Dong et al. demonstrate that extracting "Q-values" directly from token probabilities allows smaller models to outperform larger ones by better evaluating the potential success of different reasoning paths.
By looking past the fluent surface of LLM outputs and into the underlying logit distributions, researchers are building a more transparent and calibrated foundation for machine intelligence. As Mark Steyvers et al. suggest, bridging the gap between internal model certainty and human perception is the key to creating AI that users can actually trust.
Key Foundational Work
"None of the Above": Measure Uncertainty in Dialog Response Retrieval (2020) — contributed 2 concept elements to this direction.