无需采样的梯度方法,高效评估大模型生成不确定性
Gradients with Respect to Semantics Preserving Embeddings Tell the Uncertainty of Large Language Models

- 在语义空间计算梯度,捕捉输入扰动下的输出稳定性
- 提出语义保持得分SLS,识别最优语义嵌入表示
- 适合需快速评估生成可信度的对话与多答案场景
不确定性量化(UQ)对确保大语言模型(LLM)的可信性至关重要,因其易产生幻觉。现有最先进的自由文本生成UQ方法高度依赖采样,带来高计算开销和方差。本文提出首个基于梯度的自由文本生成UQ方法SemGrad,无需采样且计算高效。不同于针对分类任务的参数空间梯度方法,我们提出在语义空间中计算梯度。核心思想是:可靠的模型在语义等价的输入扰动下应保持输出分布稳定。我们将这种稳定性解释为语义空间中的梯度,并引入语义保持得分(SPS)来识别最能捕捉语义的嵌入表示,以此计算梯度。进一步提出HybridGrad,融合了SemGrad与参数梯度的优势。实验表明,两种方法均能提供高效且有效的不确定性估计,在存在多个合理回答的场景中表现优于现有最优方法。
原文摘要 · Abstract (English)
Uncertainty quantification (UQ) is an important technique for ensuring the trustworthiness of LLMs, given their tendency to hallucinate. Existing state-of-the-art UQ approaches for free-form generation rely heavily on sampling, which incurs high computational cost and variance. In this work, we propose the first gradient-based UQ method for free-form generation, SemGrad, which is sampling-free and computationally efficient. Unlike prior gradient-based methods developed for classification tasks that operates in parameter space, we propose to consider gradients in semantic space. Our method builds on the key intuition that a confident LLM should maintain stable output distributions under semantically equivalent input perturbations. We interpret the stability as the gradients in semantic space and introduce a Semantic Preservation Score (SPS) to identify embeddings that best capture semantics, with respect to which gradients are computed. We further propose HybridGrad, which combines the strengths of SemGrad and parameter gradients. Experiments demonstrate that both of our methods provide efficient and effective uncertainty estimates, achieving superior performance than state-of-the-art methods, particularly in settings with multiple valid responses.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。