Uncertainty Quantification of Large Language Models using Approximate Bayesian Computation

Mridul Sharma, Adeetya Patel, Zaneta D' Souza, Samira Abbasgholizadeh Rahimi, Siva Reddy, Sreenath Arekunnath MadathilarXiv 2025 · DOI · arXiv

Abstract

Large Language Models (LLMs) are increasingly deployed in high-stakes domains like clinical medicine, yet they often suffer from miscalibrated overconfidence. This paper presents a novel framework that treats LLMs as "stochastic simulators" to better quantify uncertainty. By employing Approximate Bayesian Computation (ABC), specifically Sequential Monte Carlo ABC (SMC-ABC), the researchers demonstrate significant improvements in diagnostic accuracy and calibration across clinical text classification tasks. The method reduces overconfident errors by up to 74.4% and maintains performance even under heavy model quantization, offering a robust, weight-agnostic solution for uncertainty quantification in "black-box" LLM applications.

Introduction

The tendency of Large Language Models to be "confidently wrong" poses a significant risk in safety-critical fields. Current uncertainty quantification (UQ) techniques, such as analyzing raw logit scores or eliciting confidence through direct prompting, are often unreliable. Logits are frequently miscalibrated due to post-training procedures like Reinforcement Learning from Human Feedback (RLHF), while elicited confidence is notoriously inconsistent. This research addresses these gaps by introducing a principled Bayesian approach that does not require access to a model's internal parameters, making it highly suitable for proprietary API-based models.

Methodology: LLMs as Stochastic Simulators

The core innovation of this work is reframing the classification task. Instead of directly predicting a label $y$ given text $x$ (i.e., $P(y|x)$), the framework treats the LLM as a simulator to model the likelihood $P(x|y)$. This is achieved through Approximate Bayesian Computation (ABC), a likelihood-free inference method.

The process follows an iterative "inverse inference" cycle:

  1. Hypothesize: A candidate diagnosis is sampled from a prior distribution.
  2. Simulate: The LLM is prompted to generate a patient description corresponding to that diagnosis.
  3. Compare: The simulated text is compared to the actual patient symptoms using cosine distance in a high-dimensional embedding space (e.g., using text-embedding-3-large).
  4. Accept/Reject: Candidates that produce simulations sufficiently close to the observed data are accepted into the posterior distribution.

To enhance efficiency, the authors utilize Sequential Monte Carlo ABC (SMC-ABC). This method uses a population of "particles" that undergo multiple rounds of refinement, gradually narrowing the acceptance threshold ($\epsilon$) to converge on the most probable diagnoses.

Experimental Results

The framework was evaluated on two clinical benchmarks: the Oral Lesion (OL) dataset, a new synthetic dataset of 300 complex cases, and the GretelAI Symptom-to-Diagnosis (SD) dataset. The ABC-based methods (Rejection Sampling and SMC) consistently outperformed standard baselines across various models, including Mistral-7B, Llama-3.1-8B, and medically-tuned models like Med42.

Performance comparison across models and datasets showing improvements in accuracy and calibration metrics.

Key performance highlights include:

  • Accuracy: Classification accuracy improved by up to 46.9% compared to standard prompting methods.
  • Calibration: Predictive accuracy and confidence alignment, measured by Brier scores, saw reductions in error of up to 74.4%.
  • Reliability: The Expected Calibration Error (ECE) was significantly lower, indicating that the model's reported confidence levels are more representative of its actual performance.

Key Insights and Robustness

Quantization Resilience

A notable finding is the method's resilience to model quantization. While 4-bit quantization typically degrades internal logit-based probability scores, it has minimal impact on the semantic content of generated text. Consequently, the ABC framework maintains high performance even when the underlying LLM is heavily compressed.

Out-of-Distribution (OOD) Awareness

The Bayesian nature of the approach provides inherent awareness of Out-of-Distribution samples. When presented with symptoms that do not match any known diagnostic category, the ABC process fails to find "close" simulations. This results in high entropy in the posterior distribution, signaling high uncertainty to the user.

Entropy values for Out-of-Distribution (OOD) samples, demonstrating higher uncertainty signals for the ABC-based methods.

Conclusion and Future Work

While the ABC framework offers superior reliability and calibration, it introduces higher computational latency due to the need for multiple simulations per query. Future research directions include optimizing this process through vector database retrieval—pre-generating descriptions to replace real-time LLM calls—and refining simulation prompts to capture more nuanced clinical differentiators. Despite the current latency trade-offs, this Bayesian approach represents a significant step toward safer, more reliable LLM integration in clinical decision support systems.

Summary updated

BibTeX
@misc{sharma2025uncertainty,
  author = {Mridul Sharma and Adeetya Patel and Zaneta D' Souza and Samira Abbasgholizadeh Rahimi and Siva Reddy and Sreenath Arekunnath Madathil},
  title = {{Uncertainty Quantification of Large Language Models using Approximate Bayesian Computation}},
  year = {2025},
  eprint = {2509.19375},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.19375},
}
Figure