Large Language Model Confidence Estimation via Black-Box Access

Tejaswini Pedapati, Amit Dhurandhar, Soumya Ghosh, Soham Dan, Prasanna Sattigeri

TL;DR

This paper introduces a simple, black-box framework to estimate the confidence of Large Language Model (LLM) responses without needing access to internal states or token probabilities. By applying a suite of prompt perturbations and training an interpretable logistic regression model on the resulting semantic and lexical features, the method consistently outperforms state-of-the-art baselines. Remarkably, the trained confidence models generalize zero-shot across different LLMs on the same dataset.

What Problem Does This Paper Address?

As LLMs are increasingly deployed in high-stakes applications, knowing when to trust a model's output is critical. Accurate confidence estimation helps mitigate hallucinations, enables reliable benchmarking, and improves retrieval-augmented generation (RAG) systems.

However, most existing uncertainty estimation techniques require "white-box" access—meaning they need internal model representations or token-level log probabilities. This is a major hurdle when dealing with commercial, closed-source models like GPT-4, which are only accessible via black-box APIs. While some black-box methods exist, they typically rely on simply sampling multiple responses from the same prompt, which provides a limited view of the model's true stability and confidence.

Methods

The authors propose an extensible framework that probes an LLM's consistency by dynamically manipulating the input prompt.

Figure 1: Above we see our (extensible) framework to estimate confidence of LLM responses. We propose six prompt perturbations which then can be converted to features based on semantic diversity in the responses and lexical similarity. The input (tokenized) prompt can optionally be also passed as a feature. The output labels for each (input) prompt are created by checking if the LLM output is correct or not. A (interpretable) logistic regression model is then trained on these features and outputs so that for any new input prompt and LLM response we can estimate the confidence of it being correct based on our model. Moreover, we can also ascertain the features important in estimating these confidences.

The pipeline consists of four main steps:

  1. Perturbation Generator: The input prompt undergoes six distinct perturbations designed to test the model's robustness in complementary ways:
  2. Stochastic Decoding (SD): Sampling multiple completions using different decoding strategies (greedy, beam search, nucleus sampling) on the original prompt.
  3. Paraphrasing (PP): Rewriting the prompt using back-translation (English $\rightarrow$ French $\rightarrow$ English).
  4. Sentence Permutation (SP): Randomly reordering sentences that contain named entities.
  5. Entity Frequency Amplification (EFA): Repeating sentences containing named entities to test for redundancy bias.
  6. Stopword Removal (SR): Stripping common words (e.g., "the", "are") that don't alter the core meaning.
  7. Split Response Consistency (SRC): Splitting the LLM's own response and using a separate Natural Language Inference (NLI) model (DeBERTa) to check for internal contradictions.

An example of how these perturbations alter a prompt from the SQuAD dataset can be seen below: Examples of different prompt perturbations for a prompt from the SQuAD dataset.

Examples of different prompt perturbations for a prompt from the SQuAD dataset.
  1. Feature Extractor: The responses from these perturbed prompts are evaluated using two metrics:
  2. Semantic Set: Grouping responses that mean the same thing (via NLI entailment) and counting the number of unique semantic groups. More groups imply lower confidence.
  3. Lexical Similarity: Computing the average ROUGE score across pairs of generated responses. Higher similarity implies higher confidence.
  4. Label Creation: To train the confidence estimator, ground-truth labels are generated by checking if the LLM's response matches the dataset's actual answer (defined as a ROUGE score $> 0.3$).
  5. Surrogate Model: A simple, highly interpretable Logistic Regression model is trained on the extracted features to predict the probability that a response is correct. This probability serves as the final confidence score.

Datasets

The framework was evaluated across two distinct task types using six different LLMs:

  • Question Answering (Q&A): Evaluated on CoQA, SQuAD (both context-based), TriviaQA, and Natural Questions (NQ) (both open-domain/knowledge-based). The models tested were Flan-ul2, Llama-2-13b-chat, Mistral-7B-Instruct-v0.2, and GPT-4.
  • Summarization: Evaluated on CNN/Daily Mail and XSUM using Pegasus-large and BART-large.

Key Insights and Ideas

  • The "Universal" Task Feature Phenomenon: The most exciting discovery is that for a given dataset, different LLMs share the same important features for confidence estimation. For example, sentence permutation (SP) lexical similarity was the top predictive feature for all models on SQuAD, while paraphrasing (PP) and stochastic decoding (SD) were universally important for TriviaQA.
  • Zero-Shot Cross-Model Transferability: Because the predictive features are task-dependent rather than model-dependent, a confidence model trained on one LLM (e.g., Llama) can be applied zero-shot to evaluate an entirely different LLM (e.g., GPT-4) on the same dataset, often matching or even exceeding the performance of a custom-tailored model.
  • Sensitivity as a Proxy for Ignorance: If an LLM changes its answer significantly when you remove a stopword or reorder a sentence, it likely doesn't "know" the answer securely. The framework successfully operationalizes this brittleness into a quantifiable metric.

Key Results

The proposed method consistently outperformed state-of-the-art black-box baselines across standard metrics, including Area Under the Receiver Operating Characteristic (AUROC), Area Under Accuracy-Rejection Curve (AUARC), and Expected Calibration Error (ECE).

Table 2: AUROCs on four Q&A and two summarization datasets (CNN, XSUM) using a total of six LLMs (Llama, Flan-ul2, Mistral, GPT-4, Pegasus, BART). Higher values are better. Best results bolded.
  • AUROC Improvements: As shown in Table 2, the method achieved substantial gains over the best baselines—surpassing them by up to 11 percentage points for Llama on TriviaQA and 14 percentage points for Mistral on SQuAD.
  • Data Efficiency: The framework remains highly performant even when the logistic regression model is trained on as few as 250 samples, making it cheap and practical to deploy.
  • Fewer Queries, Same Performance: Reducing the number of sampled decodings from 5 to 3 resulted in negligible performance drops, proving the method's computational efficiency.

Limitations and Future Work

  • Dependence on Initial Correctness: Because it is a supervised approach, the confidence model requires that the base LLM generates at least some correct answers during the training phase to learn the boundary between success and failure.
  • Evaluation Metric Vulnerabilities: The framework relies on automated lexical metrics like ROUGE to establish the ground-truth correctness labels during training, which can occasionally misjudge semantic alignment (though the authors noted similar qualitative success when validating with GPT-4 as a judge).
  • Future Directions: The authors suggest expanding the framework to include causally related follow-up questions to probe the model's reasoning path, and exploring ways to make these confidence estimators generalize across entirely different datasets and domains.

Summary updated

BibTeX
@misc{pedapati2024large,
  author = {Tejaswini Pedapati and Amit Dhurandhar and Soumya Ghosh and Soham Dan and Prasanna Sattigeri},
  title = {{Large Language Model Confidence Estimation via Black-Box Access}},
  year = {2024},
  eprint = {2406.04370},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.04370},
}
Figure