Generating with Confidence: Uncertainty Quantification for Black-box Large Language Models

Zhen Lin, Shubhendu Trivedi, Jimeng Sun
5/30/2023
cs.CLcs.LGstat.ML

Official code: zlin7/UQ-NLG (106 stars, MIT, last commit 2024-06-30).

Abstract

Large language models (LLMs) specializing in natural language generation (NLG) have recently started exhibiting promising capabilities across a variety of domains. However, gauging the trustworthiness of responses generated by LLMs remains an open challenge, with limited research on uncertainty quantification (UQ) for NLG. Furthermore, existing literature typically assumes white-box access to language models, which is becoming unrealistic either due to the closed-source nature of the latest LLMs or computational constraints. In this work, we investigate UQ in NLG for *black-box* LLMs. We first differentiate *uncertainty* vs *confidence*: the former refers to the ``dispersion'' of the potential predictions for a fixed input, and the latter refers to the confidence on a particular prediction/generation. We then propose and compare several confidence/uncertainty measures, applying them to *selective NLG* where unreliable results could either be ignored or yielded for further assessment. Experiments were carried out with several popular LLMs on question-answering datasets (for evaluation purposes). Results reveal that a simple measure for the semantic dispersion can be a reliable predictor of the quality of LLM responses, providing valuable insights for practitioners on uncertainty management when adopting LLMs. The code to replicate our experiments is available at https://github.com/zlin7/UQ-NLG.

View on arXivView PDF

Code Implementations(1)

zlin7/UQ-NLGOfficial100%
MIT
10612Python, Jupyter NotebookMay 30, 20232 years agoMIT
natural-language-generationuncertainty-quantification

Cite this paper

@article{lin2023generating,
  title  = {Generating with Confidence: Uncertainty Quantification for Black-box Large Language Models},
  author = {Zhen Lin and Shubhendu Trivedi and Jimeng Sun},
  year   = {2023},
  eprint = {2305.19187},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.19187v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.19187.svg)](https://codeofpaper.com/paper/2305.19187)

Discussion