Bayesian Prompt Ensembles: Model Uncertainty Estimation for Black-Box Large Language Models

Francesco Tonolini, Nikolaos Aletras, Jordan Massiah, Gabriella Kazai


Abstract
An important requirement for the reliable deployment of pre-trained large language models (LLMs) is the well-calibrated quantification of the uncertainty in their outputs. While the likelihood of predicting the next token is a practical surrogate of the data uncertainty learned during training, model uncertainty is challenging to estimate, i.e., due to lack of knowledge acquired during training. Prior efforts to quantify uncertainty of neural networks require specific architectures or (re-)training strategies, which are impractical to apply to LLMs with several billion parameters, or for black-box models where the architecture and parameters are not available. In this paper, we propose Bayesian Prompts Ensembles (BayesPE), a novel approach to effectively obtain well-calibrated uncertainty for the output of pre-trained LLMs. BayesPE computes output probabilities through a weighted ensemble of different, but semantically equivalent, task instruction prompts. The relative weights of the different prompts in the ensemble are estimated through approximate Bayesian variational inference over a small labeled validation set. We demonstrate that BayesPE approximates a Bayesian input layer for the LLM, providing a lower bound on the expected model error. In our extensive experiments, we show that BayesPE achieves significantly superior uncertainty calibration compared to several baselines over a range of natural language classification tasks, both in zero- and few-shot settings.
Anthology ID:
2024.findings-acl.728
Volume:
Findings of the Association for Computational Linguistics ACL 2024
Month:
August
Year:
2024
Address:
Bangkok, Thailand and virtual meeting
Editors:
Lun-Wei Ku, Andre Martins, Vivek Srikumar
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
12229–12272
Language:
URL:
https://aclanthology.org/2024.findings-acl.728
DOI:
Bibkey:
Cite (ACL):
Francesco Tonolini, Nikolaos Aletras, Jordan Massiah, and Gabriella Kazai. 2024. Bayesian Prompt Ensembles: Model Uncertainty Estimation for Black-Box Large Language Models. In Findings of the Association for Computational Linguistics ACL 2024, pages 12229–12272, Bangkok, Thailand and virtual meeting. Association for Computational Linguistics.
Cite (Informal):
Bayesian Prompt Ensembles: Model Uncertainty Estimation for Black-Box Large Language Models (Tonolini et al., Findings 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.findings-acl.728.pdf