Abstract
As large language models (LLMs) gain popularity in conducting prediction tasks in-context, understanding the sources of uncertainty in in-context learning becomes essential to ensuring reliability. The recent hypothesis of in-context learning performing predictive Bayesian inference opens the avenue for Bayesian uncertainty estimation, particularly for decomposing uncertainty into epistemic uncertainty due to lack of in-context data and aleatoric uncertainty inherent in the in-context prediction task. However, the decomposition idea remains under-explored due to the intractability of the latent parameter posterior from the underlying Bayesian model. In this work, we introduce a variational uncertainty decomposition framework for in-context learning without explicitly sampling from the latent parameter posterior, by optimising auxiliary queries as probes to obtain an upper bound to the aleatoric uncertainty of an LLM's in-context learning procedure, which also induces a lower bound to the epistemic uncertainty. Through experiments on synthetic and real-world tasks, we show quantitatively and qualitatively that the decomposed uncertainties obtained from our method exhibit desirable properties of epistemic and aleatoric uncertainty.
Introduction
Large Language Models (LLMs) are increasingly deployed for predictive tasks via In-Context Learning (ICL), where they learn a task on the fly from a few examples provided in a prompt. However, for high-stakes applications like medical QA or robotics, understanding why a model is uncertain is as important as the prediction itself.
In classical Bayesian statistics, uncertainty is split into two categories:
- Aleatoric Uncertainty: Inherent randomness or noise in the data (e.g., a blurry image). This cannot be reduced by more data.
- Epistemic Uncertainty: Uncertainty due to a lack of knowledge. This can be reduced by providing the model with more examples.
Current LLMs are notoriously overconfident and struggle to distinguish between these two. While recent theories suggest ICL behaves like an implicit form of Bayesian inference, we cannot easily "look inside" the model to see its internal state. This makes traditional uncertainty decomposition computationally impossible for black-box LLMs.
The VUD Framework
To bridge this gap, the researchers introduced Variational Uncertainty Decomposition (VUD). This framework sidesteps the need to sample from the model's internal parameters by using auxiliary queries ($Z$) as probes.
In this setup, the model "fantasizes" potential answers ($U$) for these probes. By measuring how much the model's prediction on a test point changes after conditioning on these fantasized pairs, the framework calculates an upper bound on aleatoric uncertainty. Subtracting this from the total uncertainty induces a lower bound on epistemic uncertainty.
Algorithmic Implementation
Implementing VUD requires ensuring that the LLM behaves in a mathematically grounded, "Bayesian" manner. LLMs are often sensitive to the order of examples in a prompt, violating the principle of exchangeability. To mitigate this, the authors employ permutation ensembling, shuffling the order of in-context examples multiple times and averaging the results.
Furthermore, the framework uses KL-divergence filtering to ensure that auxiliary queries stay within the realm of the task at hand, preventing the model's predictions from drifting into irrelevant distributions.
Key Insights and Results
The researchers validated VUD across diverse benchmarks, from synthetic "Two-Moons" datasets to real-world tasks like PubMedQA and MMLU. Several key insights emerged:
- Epistemic Uncertainty as a Learning Compass: EU consistently drops as more in-context examples are added, proving it is a valid measure of the model's learning progress.
- Aleatoric Uncertainty Pinpoints Ambiguity: In classification tasks, AU spikes sharply at decision boundaries where classes overlap, regardless of data volume.
- Better Decision Making: In multi-armed bandit tests, using epistemic variance to guide exploration resulted in significantly lower regret than using total variance, as the model avoids wasting time on inherently noisy options it already understands.
- Smarter Abstention: When allowed to abstain from answering, thresholding based on aleatoric uncertainty led to higher accuracy on the remaining questions compared to using total uncertainty.
Limitations and Future Work
While VUD offers a powerful new lens into LLM behavior, it comes with a higher computational cost due to the multiple API calls or forward passes required for permutations and auxiliary queries. Additionally, the current method is optimized for short-form outputs (regression and classification). Extending this to long-form natural language generation, where "semantic" uncertainty is harder to quantify, remains a primary goal for future research.
Summary updated