On the Importance of Uncertainty in Decision-Making with Large Language Models

Nicolò Felicioni, Lucas Maystre, Sina Ghiassian, Kamil Ciosek · DOI

Introduction

Large Language Models (LLMs) are increasingly being deployed as autonomous decision-making agents in environments ranging from automated content moderation to personalized recommendations. However, a critical bottleneck in their performance is "overconfidence." When LLMs are fine-tuned to predict rewards, they typically follow a greedy policy—always selecting the action with the highest predicted reward. This paper demonstrates that such greedy behavior is often suboptimal. By integrating epistemic uncertainty—teaching models to "know what they do not know"—and employing Thompson Sampling, LLM-based agents can significantly outperform standard approaches in complex, text-based decision tasks.

The Problem: The Greedy Trap in Contextual Bandits

The authors frame LLM decision-making within the contextual bandit framework. In this setup, an agent observes a context (such as a user comment), chooses an action (e.g., "publish" or "block"), and receives a reward based on the quality of that choice.

A fundamental challenge in this framework is the exploration-exploitation trade-off. A greedy model relies solely on its current, potentially limited data. If a model early in its training predicts a low reward for a specific type of content, it may never choose to interact with that content type again, potentially missing out on a superior long-term strategy. While Bayesian methods have long solved this for smaller models, scaling these techniques to billion-parameter LLMs presents significant computational hurdles.

Methodology: Quantifying Uncertainty

To bridge the gap between Bayesian theory and LLM scale, the researchers adapted four primary uncertainty estimation techniques to work with Thompson Sampling (TS). Thompson Sampling works by maintaining a probability distribution over possible rewards and sampling from it to make decisions, which naturally encourages exploration in areas where the model is uncertain.

  1. Monte Carlo Dropout: Utilizing dropout layers during inference to generate a distribution of predictions.
  2. Laplace Approximation (LA): Approximating the posterior distribution of the weights as a Gaussian by using the curvature (Hessian) of the loss function.
  3. Last-Layer Laplace: A more efficient variant that only calculates uncertainty for the final linear layer, treating the preceding LLM layers as a fixed feature extractor.
  4. Epinets: A specialized "sidecar" neural network architecture designed to estimate epistemic uncertainty without the heavy computational cost of Hessian calculations.

Experimental Setup and Datasets

The agents were evaluated on four real-world text datasets adapted for content moderation tasks:

  • Measuring Hate Speech: 136,000 comments with toxicity labels.
  • IMDb: 50,000 movie reviews used for sentiment-based moderation.
  • Offensive Language Identification: 14,000 English tweets.
  • HatEval: 13,000 tweets regarding hate speech against immigrants and women.

In these tasks, the agent had to decide whether to publish content, receiving rewards based on the actual toxicity or sentiment of the text. The study also tested scalability by using models ranging from GPT-2 (124M parameters) to GPT-2 XL (1.5B parameters).

Key Insights

1. The Pathological Nature of Greedy Policies

The research found that greedy LLM agents frequently suffer from "under-exploration." For instance, if a model accidentally publishes toxic comments early in the process, it might become overly conservative and stop publishing entirely—even when content is safe—leading to high cumulative regret.

2. Epistemic vs. Aleatoric Uncertainty

The paper highlights the necessity of capturing epistemic uncertainty (uncertainty due to a lack of data) rather than just aleatoric uncertainty (inherent noise in language). While LLMs are naturally adept at handling linguistic nuances, they require explicit mechanisms to recognize when they lack sufficient experience with a specific topic to make a confident decision.

3. The Role of Pre-training

An ablation study revealed that the "world knowledge" inherent in pre-trained LLMs is a prerequisite for success. A small transformer trained from scratch failed to perform, suggesting that uncertainty estimation acts as the "wisdom" required to effectively deploy pre-existing knowledge in a decision-making loop.

4. Performance and Efficiency

  • Last-Layer Laplace consistently emerged as the top performer, providing the highest quality of exploration across all datasets.
  • Epinets provided a "sweet spot," offering performance nearly identical to Laplace methods but with significantly lower computational overhead, making them the most viable candidate for production-scale systems.

Conclusion

The results across all datasets were consistent: Thompson Sampling variants significantly outperformed the greedy baseline. By reducing cumulative regret and preventing models from getting "stuck" in suboptimal strategies, uncertainty-aware LLMs prove to be more robust and reliable agents. This work provides a clear roadmap for moving beyond simple text generation toward building LLM agents capable of navigating the messy, uncertain realities of human-centric decision-making.

Summary updated

BibTeX
@article{felicioni2024importance,
  author = {Nicolò Felicioni and Lucas Maystre and Sina Ghiassian and Kamil Ciosek},
  title = {{On the Importance of Uncertainty in Decision-Making with Large Language Models}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=YfPzUX6DdO},
}
Figure