arXiv:2506.00245cs.LGcs.CL2025-06ACL被引 33

用相似度改进大模型不确定性估计,更准识别幻觉。

Beyond Semantic Entropy: Boosting LLM Uncertainty Quantification with Pairwise Semantic Similarity

  • 基于成对语义相似度计算不确定性,比传统方法更敏感。
  • 在Phi3和Llama3上验证,三种任务效果均优于语义熵。
  • 可黑盒或白盒使用,适合关注生成可靠性的研究者。

大语言模型的幻觉可通过输出不确定性评估来检测,传统方法常以熵值衡量。语义熵(SE)通过语义聚类提升熵估计效果,但现代模型生成长句时,其忽略簇内相似性(簇内分散程度)和簇间相似性(簇间距离),导致效能下降。为此,我们提出一种受最近邻熵估计启发的简单黑盒不确定性量化方法,亦可结合词元概率扩展至白盒场景。理论证明该方法推广了语义熵。大量实验证明,在Phi3和Llama3两个近期模型上,针对问答、摘要和机器翻译三类任务,本方法均优于语义熵。代码已开源:https://github.com/BigML-CS-UCLA/SNNE。

原文摘要 · Abstract (English)

Hallucination in large language models (LLMs) can be detected by assessing the uncertainty of model outputs, typically measured using entropy. Semantic entropy (SE) enhances traditional entropy estimation by quantifying uncertainty at the semantic cluster level. However, as modern LLMs generate longer one-sentence responses, SE becomes less effective because it overlooks two crucial factors: intra-cluster similarity (the spread within a cluster) and inter-cluster similarity (the distance between clusters). To address these limitations, we propose a simple black-box uncertainty quantification method inspired by nearest neighbor estimates of entropy. Our approach can also be easily extended to white-box settings by incorporating token probabilities. Additionally, we provide theoretical results showing that our method generalizes semantic entropy. Extensive empirical results demonstrate its effectiveness compared to semantic entropy across two recent LLMs (Phi3 and Llama3) and three common text generation tasks: question answering, text summarization, and machine translation. Our code is available at https://github.com/BigML-CS-UCLA/SNNE.

大模型不确定性幻觉检测语义相似度

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