arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.07071cs.CLcs.AIcs.LG

回溯透镜:仅利用注意力图检测与缓解大语言模型中的上下文幻觉

Lookback Lens: Detecting and Mitigating Contextual Hallucinations in Large Language Models Using Only Attention Maps

Massachusetts Institute of Technology(麻省理工学院);University of Washington(华盛顿大学)

Yung-Sung Chuang, Linlu Qiu, Cheng-Yu Hsieh, Ranjay Krishna, Yoon Kim, James Glass

AI总结:

本文提出Lookback Lens,通过注意力回溯比例特征检测上下文幻觉,并证明其可跨任务跨模型迁移,且分类器引导解码可减少9.6%幻觉。

摘要:

当被要求根据给定段落总结文章或回答问题时,大语言模型(LLMs)可能会幻觉出细节,并给出相对于输入上下文而言不准确且缺乏依据的回答。本文描述了一种用于检测此类上下文幻觉的简单方法。我们假设上下文幻觉与LLM在多大程度上关注所提供上下文中的信息而非其自身生成内容有关。基于这一直觉,我们提出了一种简单的幻觉检测模型,其输入特征由上下文与新增生成token上的注意力权重之比(针对每个注意力头)给出。我们发现,基于这些回溯比例特征的线性分类器与利用LLM全部隐藏状态的更复杂检测器或基于文本的蕴含模型同样有效。基于回溯比例的检测器——Lookback Lens——被发现能够跨任务甚至跨模型迁移,使得在7B模型上训练的检测器可以在无需重新训练的情况下应用于更大的13B模型。我们进一步将该检测器应用于缓解上下文幻觉,并发现一种简单的分类器引导解码方法能够减少幻觉数量,例如在XSum摘要任务中减少了9.6%。

英文摘要:

When asked to summarize articles or answer questions given a passage, large language models (LLMs) can hallucinate details and respond with unsubstantiated answers that are inaccurate with respect to the input context. This paper describes a simple approach for detecting such contextual hallucinations. We hypothesize that contextual hallucinations are related to the extent to which an LLM attends to information in the provided context versus its own generations. Based on this intuition, we propose a simple hallucination detection model whose input features are given by the ratio of attention weights on the context versus newly generated tokens (for each attention head). We find that a linear classifier based on these lookback ratio features is as effective as a richer detector that utilizes the entire hidden states of an LLM or a text-based entailment model. The lookback ratio-based detector -- Lookback Lens -- is found to transfer across tasks and even models, allowing a detector that is trained on a 7B model to be applied (without retraining) to a larger 13B model. We further apply this detector to mitigate contextual hallucinations, and find that a simple classifier-guided decoding approach is able to reduce the amount of hallucination, for example by 9.6% in the XSum summarization task.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑