TL;DR
This paper introduces a novel framework to decompose the uncertainty of Large Language Models (LLMs) during in-context learning into two distinct sources: aleatoric uncertainty (stemming from the provided examples) and epistemic uncertainty (stemming from the model's own internal knowledge and configuration). By separating these "why" factors, the authors provide a more robust way to detect model failures and out-of-distribution data compared to traditional, single-score uncertainty methods.
What Problem Does This Paper Address?
In-context learning (ICL)—where an LLM learns a task simply by seeing a few examples in a prompt—is a cornerstone of modern AI. However, LLMs are prone to hallucinations and overconfidence. While researchers have developed ways to measure how much a model is uncertain, they often ignore why it is uncertain.
In ICL, uncertainty can come from two places:
- The Prompt (Aleatoric): The few-shot examples might be noisy, ambiguous, or insufficient to define the task.
- The Model (Epistemic): The model itself might lack the parameters or the right decoding configuration to handle the specific query.
Existing methods treat these as a single "black box" of uncertainty. This paper argues that decomposing them is crucial for building trustworthy systems—allowing us to distinguish between a "bad prompt" problem and a "weak model" problem.
Methods
The authors frame ICL through a Bayesian lens, treating the "task" as a latent concept the model must infer from the prompt. They propose two ways to estimate these decomposed uncertainties:
- Entropy-based (White-box): For models where we can access token probabilities, they use Mutual Information. Epistemic uncertainty is calculated as the average entropy across different sets of demonstrations, while Aleatoric uncertainty is the "leftover" uncertainty once the model's internal noise is accounted for. They use Beam Search as a clever proxy for sampling from the model's posterior distribution.
- Variance-based (Black-box): For models like GPT-4 where probabilities aren't available, they propose using the variance of outputs across different hyperparameter settings (like temperature) and demonstration sets.
The framework is "plug-and-play," meaning it doesn't require retraining the LLM; it simply analyzes the outputs and probabilities generated during a standard inference run.
Datasets
The researchers evaluated their method across several Natural Language Understanding (NLU) benchmarks:
- Sentiment Analysis: EMOTION, Financial Phrasebank, and SST2.
- Linguistic Acceptability: CoLA (judging if a sentence is grammatically correct).
- Topic Classification: AG_News.
They tested these on a range of open-source models, specifically LLaMA-2 (7B, 13B, and 70B versions) and OPT-13B.
Key Insights and Ideas
- Epistemic Uncertainty (EU) is the best "Red Flag": The most striking finding is that EU is a much more reliable indicator of a wrong answer than Aleatoric Uncertainty (AU) or even total uncertainty. If the model's internal "knowledge" is shaky, it’s far more likely to misclassify.
- Spotting "Bad" Prompts: AU is highly sensitive to the quality of demonstrations. If you give a model examples from a completely different domain (e.g., giving grammar examples for a sentiment task), the AU spikes, providing a clear signal that the prompt is irrelevant.
- The Scaling Effect: As models get larger (moving from 7B to 70B parameters), both types of uncertainty generally decrease. Larger models aren't just more accurate; they are more "stable" in how they process ICL prompts.
- Token Equality is a Myth: The authors note that treating all tokens as equally important for uncertainty (as standard entropy does) is a mistake. Their method focuses on the "answer tokens," which filters out the "linguistic redundancy" of the rest of the generated sentence.
Key Results
The proposed decomposition consistently outperformed state-of-the-art baselines like Semantic Uncertainty and Likelihood-based methods in two key areas:
- Misclassification Detection: Using EU to predict when a model made a mistake yielded significantly higher AUROC (Area Under the Receiver Operating Characteristic) scores. For example, on the EMOTION dataset with LLaMA-7B, EU reached an AUROC of 0.696, while standard entropy only managed 0.538.
- Out-of-Domain (OOD) Detection: The method was exceptionally good at identifying when a test sample or a demonstration set didn't belong to the task at hand. In some OOD detection tests, EU achieved AUROC scores as high as 0.941, effectively acting as a high-fidelity filter for irrelevant data.
Limitations and Future Work
The primary limitation is that this framework is currently optimized for classification and NLU tasks where there are discrete, predefined labels (like "Positive/Negative" or "World/Sports").
Applying this to free-form generation (like writing an essay or code) is much harder because it's difficult to determine which specific tokens are "semantically important" for the overall meaning. The authors suggest that future work will focus on extending these decomposition techniques to more complex, open-ended generative tasks and different modalities of data.
Summary updated