arXiv:2506.10060cs.LGcs.AI2025-06被引 7

用贝叶斯方法量化大模型提示词的不确定性,提升高风险场景可靠性。

Textual Bayes: Quantifying Prompt Uncertainty in LLM-Based Systems

  • 将提示词视为统计模型中的文本参数,进行贝叶斯推断。
  • 在多个基准上同时提升预测准确率与不确定性校准效果。
  • 适用于闭源模型,无需修改底层架构,可直接接入现有流程。

尽管大型语言模型(LLMs)在解决复杂现实任务方面能力日益增强,但其不确定性量化仍是一个关键开放问题,限制了其在高风险领域的应用。这一挑战因许多先进模型的闭源和黑箱特性而加剧。此外,基于LLM的系统对提示词极为敏感,常需大量人工调优(即提示工程)。本文通过贝叶斯视角重新审视基于LLM的系统,将提示词视为统计模型中的文本参数,利用少量训练数据对这些提示进行贝叶斯推断。该新范式使我们能够对模型的文本参数及其下游预测实现严谨的不确定性量化,并融入以自由文本形式表达的先验信念。为解决贝叶斯推断这一难题(即使在经典数据模态中也困难),我们提出一种新型马尔可夫链蒙特卡洛(MCMC)算法——基于大模型提议的梅特罗波利斯-哈斯廷斯方法(MHLP),融合提示优化技术与标准MCMC方法。MHLP可作为即插即用的改造方案,适用于依赖闭源模型的现有流水线。实验证明,该方法在多个LLM基准和不确定性量化任务中均提升了预测准确率与不确定性校准性能。更广泛而言,本工作展示了将丰富贝叶斯方法引入大模型时代的可行性,为构建更可靠、校准更好的基于大模型的系统铺平道路。

原文摘要 · Abstract (English)

Although large language models (LLMs) are becoming increasingly capable of solving challenging real-world tasks, accurately quantifying their uncertainty remains a critical open problem--one that limits their applicability in high-stakes domains. This challenge is further compounded by the closed-source, black-box nature of many state-of-the-art LLMs. Moreover, LLM-based systems can be highly sensitive to the prompts that bind them together, which often require significant manual tuning (i.e., prompt engineering). In this work, we address these challenges by viewing LLM-based systems through a Bayesian lens. We interpret prompts as textual parameters in a statistical model, allowing us to use a small training dataset to perform Bayesian inference over these prompts. This novel perspective enables principled uncertainty quantification over both the model's textual parameters and its downstream predictions, while also incorporating prior beliefs about these parameters expressed in free-form text. To perform Bayesian inference--a difficult problem even for well-studied data modalities--we introduce Metropolis-Hastings through LLM Proposals (MHLP), a novel Markov chain Monte Carlo (MCMC) algorithm that combines prompt optimization techniques with standard MCMC methods. MHLP is a turnkey modification to existing LLM pipelines, including those that rely exclusively on closed-source models. Empirically, we demonstrate that our method yields improvements in both predictive accuracy and uncertainty quantification (UQ) on a range of LLM benchmarks and UQ tasks. More broadly, our work demonstrates a viable path for incorporating methods from the rich Bayesian literature into the era of LLMs, paving the way for more reliable and calibrated LLM-based systems.

不确定性量化贝叶斯方法大模型推理提示工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。