TL;DR
This paper introduces APRICOT, a novel method for calibrating the confidence of Large Language Models (LLMs) using only their generated text outputs. APRICOT trains a separate "auxiliary" model to predict an LLM's confidence, enabling better trust and safety in LLM applications without needing access to the LLM's internal workings.
What Problem Does This Paper Address?
As LLMs become more integrated into user-facing applications, it's crucial to understand how confident they are in their predictions. This is especially important for safety and building user trust. However, accurately quantifying this confidence is challenging, particularly when dealing with "black-box" LLMs where we only have access to their generated text, not their internal states or probabilities. Existing methods often require white-box access or are unreliable, leading to potential harm or a loss of trust. The paper aims to bridge this gap by providing a method to calibrate LLM confidence using only their input and output text.
Methods
The core of APRICOT involves training an auxiliary model to predict confidence targets. This process has three main steps:
- Data Generation: The target LLM is prompted to generate answers to a set of questions. Different prompting strategies (e.g., standard, chain-of-thought, verbalized uncertainty) are explored to gather diverse training data.
- Calibration Target Setting: Instead of relying on internal LLM states, APRICOT uses a clustering-based approach. Questions are embedded into a latent space using a sentence embedding model, and then clustered. The "calibration target" for a cluster is the observed accuracy of the LLM on questions within that cluster. This method is designed to work even without metadata about question categories.
- Auxiliary Model Training: A separate model (e.g., DeBERTaV3) is trained to predict the calibration targets using the input question and the target LLM's generated answer as input. The training objective is typically a mean squared error loss, aiming to predict the cluster accuracy.
Datasets
The paper uses two standard question-answering datasets:
- TriviaQA: A common closed-book question-answering dataset.
- CoQA: A conversational question-answering dataset, treated as an open-book task where the model is provided with a passage.
For both datasets, training, validation, and test splits were created.
Key Insights and Ideas
- Confidence from Text Alone: The most significant insight is that a surprisingly good estimate of an LLM's confidence can be derived solely from its input and generated output text, without needing access to internal model states or probabilities.
- Clustering for Targets: Using sentence embeddings to cluster questions and deriving confidence targets from cluster-wise accuracy is an effective way to create meaningful calibration signals, especially when explicit metadata is unavailable.
- Auxiliary Model Versatility: The auxiliary model approach is flexible and can be applied to both white-box and black-box LLMs, making it broadly applicable.
- Chain-of-Thought Benefits: Incorporating chain-of-thought (CoT) prompting in the target LLM's generation can sometimes improve the performance of the auxiliary calibrator, suggesting that more detailed reasoning can expose useful signals.
Key Results
- Competitive Performance: APRICOT, particularly the clustering-based variant, achieves competitive calibration error and AUROC scores across both TriviaQA and CoQA datasets, outperforming several baselines.
- AUROC Superiority: APRICOT consistently outperforms baselines in misprediction AUROC, indicating its strong ability to detect incorrect LLM answers.
- Black-Box Applicability: The method demonstrates strong performance even with GPT-3.5, a black-box model, highlighting its practical utility.
- Verbalized Uncertainty Limitations: While verbalized uncertainty can sometimes achieve low calibration error, it often suffers from a lack of diversity in confidence expressions and can be unreliable for smaller models.
- Question Difficulty Inference: The auxiliary model can infer question difficulty from the question text alone, suggesting it learns about inherent task complexity.
Limitations and Future Work
- Clustering Dependency: The clustering approach relies on the expressiveness of the sentence embedding model and a sufficient number of data points. If these are not met, a simpler binary classification approach (predicting correct/incorrect) is a viable alternative.
- Distributional Shift: Like any neural model, the auxiliary calibrator may be susceptible to distributional shift. Future work could explore methods to mitigate this.
- Broader Applications: The authors suggest future research could extend APRICOT to other language generation tasks beyond question answering (e.g., summarization, translation) and explore the auxiliary model's own uncertainty. They also mention the potential of using conformal prediction for LLM confidence intervals.
Summary updated