Skip to main content
QUICK REVIEW

[论文解读] Look Within, Why LLMs Hallucinate: A Causal Perspective

He Li, Haoang Chi|arXiv (Cornell University)|Jul 14, 2024
European and International Contract LawSocial Sciences被引用 3
一句话总结

本文通过因果推断框架研究了大型语言模型(LLMs)中自注意力层在幻觉生成中的作用。通过选择性禁用特定注意力层而保持模型架构不变,作者发现禁用某些前部或尾部层可降低幻觉率——表明这些层是事实性错误生成的主要来源,而中间层则保留了事实知识。

ABSTRACT

The emergence of large language models (LLMs) is a milestone in generative artificial intelligence, achieving significant success in text comprehension and generation tasks. Despite the tremendous success of LLMs in many downstream tasks, they suffer from severe hallucination problems, posing significant challenges to the practical applications of LLMs. Most of the works about LLMs' hallucinations focus on data quality. Self-attention is a core module in transformer-based LLMs, while its potential relationship with LLMs' hallucination has been hardly investigated. To fill this gap, we study this problem from a causal perspective. We propose a method to intervene in LLMs' self-attention layers and maintain their structures and sizes intact. Specifically, we disable different self-attention layers in several popular open-source LLMs and then compare their degrees of hallucination with the original ones. We evaluate the intervened LLMs on hallucination assessment benchmarks and conclude that disabling some specific self-attention layers in the front or tail of the LLMs can alleviate hallucination issues. The study paves a new way for understanding and mitigating LLMs' hallucinations.

研究动机与目标

  • 探究自注意力机制在大型语言模型幻觉中的因果作用,超越基于数据的解释。
  • 确定是否可通过选择性干预自注意力层来减轻幻觉,而无需改变模型大小或架构。
  • 识别哪些特定层最可能导致幻觉内容的生成,以及哪些层负责保留事实知识。
  • 通过结构因果建模与前门调整方法,建立理解大型语言模型中幻觉的因果框架。

提出的方法

  • 作者构建了一个结构因果模型(SCM),以表示大型语言模型中幻觉输出的生成过程。
  • 他们应用因果推断中的前门准则,将自注意力层识别为输入与幻觉输出之间的中介变量。
  • 通过禁用开源大型语言模型(如LLaMA-2、Gemma和Mistral)中的特定自注意力层,同时保持模型架构和大小不变,实施干预。
  • 在幻觉检测基准测试(包括TruthfulQA和HaluEval)上评估修改后的模型,使用GPT-3.5-turbo作为裁判模型来评估事实正确性。
  • 性能通过基准数据集上的准确率(ACC)进行衡量,比较原始模型(z₀)与干预后模型(zᵢ)的表现,其中特定层被禁用。
  • 分析聚焦于各层的特定影响,通过比较不同层位置(前部、中部、尾部)的ACC变化,推断其因果角色。

实验结果

研究问题

  • RQ1大型语言模型中的不同自注意力层对幻觉率的影响是否相同?
  • RQ2禁用特定自注意力层是否可在不损害模型性能的前提下降低幻觉率?
  • RQ3前部、中部或尾部层中,哪一类最可能导致幻觉内容的生成?
  • RQ4当中间层被禁用时性能显著下降,这是否表明它们主要存储事实知识?

主要发现

  • 在LLaMA 2-7B-Chat中禁用第3个自注意力层,使TruthfulQA基准上的准确率提高了约2个百分点。
  • 在Gemma-2B-instruct中禁用第13个层,使HaluEval基准上的性能提升了4个百分点。
  • 前部和尾部层最容易传播幻觉,因为禁用它们在多个模型中均一致地降低了幻觉率。
  • 中间层(如LLaMA 2-7B-Chat中的第12和16层)对事实知识至关重要;禁用它们会显著降低在幻觉基准测试中的表现。
  • 在LLaMA 2-7B-Chat和Gemma-2B-instruct中,禁用第8层均能产生正确答案,表明特定层的干预可纠正幻觉输出。
  • 本研究证实,不同注意力层发挥着不同作用:前部/尾部层放大幻觉,而中间层则维持事实一致性。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。