Abstract
Uncertainty estimation is essential for practical applications such as decision-making, risk assessment, and human-AI collaboration. However, uncertainty estimation in open-ended question-answering (QA) tasks presents unique challenges. The output space for open-ended QA is vast and discrete, and the autoregressive nature of LLMs, combined with the rapid increase in model parameters, makes inference sampling significantly costly. An ideal uncertainty estimation for LLMs should meet two criteria: 1) incur no additional inference cost and 2) capture the semantic dependencies of token-level uncertainty within sequences. We propose a promising solution that converts redundancy into randomness in the extensive parameters of LLMs to quantify knowledge uncertainty. We can obtain token-level Monte Carlo samples without multiple inferences by introducing randomness during a single forward pass. We theoretically analyze the FLUE sampling method and employ a post-processing method to learn the state transitions from token uncertainty to sequence uncertainty. In open-ended question-answering tasks, we demonstrate that FLUE can achieve competitive performance in estimating the uncertainty of generated sentences without adding extra inference overhead.
Introduction
As Large Language Models (LLMs) are increasingly deployed in high-stakes environments like medical advice or legal analysis, knowing when a model is guessing is as critical as the answer itself. However, uncertainty estimation in open-ended generation is notoriously difficult. Existing methods typically fall into two categories: token-level methods that often ignore semantic relationships, and sampling-based methods (like Semantic Entropy) that require generating multiple independent completions. The latter is computationally prohibitive, often multiplying inference costs by 10x or more.
FLUE (Fast LLMs Uncertainty Estimation) addresses this by enabling high-quality uncertainty estimation in a single forward pass. By leveraging the internal redundancy of LLM layers to simulate a "virtual ensemble," FLUE achieves competitive performance with state-of-the-art sampling methods while reducing inference time by over 5x.
Methodology: MC-FLUE and State Transitions
The core of FLUE lies in two primary innovations: MC-FLUE and a state transition post-processing model.
MC-FLUE: Redundancy as Randomness
Modern LLMs are deep, but many intermediate layers are highly redundant, producing very similar hidden states. FLUE exploits this by treating these similar layers as a "virtual ensemble."
- Layer Selection: The algorithm identifies a range of consecutive layers where hidden states exhibit high cosine similarity.
- Dirichlet Sampling: Instead of a standard deterministic forward pass, FLUE applies layer-wise randomness. It samples weights from a Dirichlet distribution to combine hidden states from different layers. This effectively performs Monte Carlo sampling of the model's internal knowledge states within a single forward pass.
State Transition Post-Processing
To move from token-level uncertainty to sequence-level uncertainty, a lightweight state transition model is employed. This model learns to capture temporal dependencies and non-linear relationships between token uncertainties, effectively "smoothing" the uncertainty across a generated sentence to provide a more holistic measure of confidence.
The Virtual Ensemble: Leveraging Layer Redundancy
The most elegant aspect of FLUE is the realization that multiple inferences aren't necessary to obtain a distribution of answers. Because LLM layers are so similar in their representations, "jittering" between layers during a single pass provides a representative sample of the model's internal confidence.
As shown in the similarity heatmaps, modern Transformer-based LLMs exhibit significant redundancy, particularly in the middle and upper layers. This property is fundamental across various architectures, including LLaMA and Mistral.
Evaluation and Results
FLUE was evaluated across eight different LLMs (LLaMA 2/3, Mistral, Vicuna) using five diverse open-ended QA benchmarks, including TriviaQA, NQ-open, SQuAD 2.0, SVAMP, and BioASQ.
Key Performance Metrics
- Efficiency: On the SQuAD v2.0 dataset using LLaMA-2-7B, FLUE required only 15 minutes to estimate uncertainty, compared to 1 hour 16 minutes for Semantic Entropy—a speedup of over 5x.
- Accuracy (AUROC): FLUE achieved superior AUROC scores (measuring how well uncertainty predicts actual errors) on TriviaQA, NQ-Open, and SQuAD v2.0. For instance, on TriviaQA with LLaMA-2-7B, FLUE reached an AUROC of 0.885, significantly outperforming Semantic Entropy (0.769).
- Robustness: The method proved robust across model sizes (7B to 70B), suggesting that internal layer redundancy is a stable property of modern LLMs.
Discussion and Future Work
While FLUE offers a significant leap in efficiency, it currently requires a "white-box" setting with access to internal hidden states, making it incompatible with closed-source APIs like GPT-4. Additionally, the method relies on hyperparameters for layer selection and Dirichlet concentration, which may require tuning for specialized domains. Future research will explore more complex post-processing models to better capture the nuances of semantic uncertainty.
Summary updated