Large language models (LLMs) demonstrate great performance in text generation. However, LLMs are still suffering from hallucinations. In this work, we propose an inference-time method, Self-Highlighted Hesitation (SH2), to help LLMs decode more truthfully. SH2 is based on a simple fact rooted in information theory that for an LLM, the tokens predicted with lower probabilities are prone to be more informative than others. Our analysis shows that the tokens assigned with lower probabilities by an LLM are more likely to be closely related to factual information, such as nouns, proper nouns, and adjectives. Therefore, we propose to ''highlight'' the factual information by selecting the tokens with the lowest probabilities and concatenating them to the original context, thus forcing the model to repeatedly read and hesitate on these tokens before generation. During decoding, we also adopt contrastive decoding to emphasize the difference in the output probabilities brought by the hesitation. Experimental results demonstrate that our SH2, requiring no additional data or models, can effectively help LLMs elicit factual knowledge and distinguish hallucinated contexts. Significant and consistent improvements are achieved by SH2 for LLaMA-7b, LLaMA2-7b and Mistral-7b on multiple hallucination tasks.
翻译:大型语言模型(LLMs)在文本生成中表现出色,但仍受幻觉问题困扰。本文提出一种推理时方法——自我高亮犹豫(Self-Highlighted Hesitation, SH2),帮助LLMs实现更诚实的解码。SH2基于信息论中的简单事实:对LLM而言,预测概率较低的标记往往比其他标记更具信息量。分析表明,LLM赋予低概率的标记与事实信息(如名词、专有名词和形容词)的关联性更高。因此,我们通过选择概率最低的标记并将其拼接至原始上下文来“高亮”事实信息,从而迫使模型在生成前反复阅读并“犹豫”于这些标记。解码过程中,我们同时采用对比解码(contrastive decoding)以强化犹豫带来的输出概率差异。实验结果表明,无需额外数据或模型,SH2能有效帮助LLMs提取事实知识并区分幻觉上下文。在多个幻觉任务中,SH2对LLaMA-7b、LLaMA2-7b和Mistral-7b均实现了显著且一致的性能提升。