[论文解读] ReDeEP: Detecting Hallucination in Retrieval-Augmented Generation via Mechanistic Interpretability
本文提出 ReDeEP,一种用于检索增强生成(RAG)模型的新颖幻觉检测方法,通过机制可解释性解耦外部知识与参数化知识的使用。通过识别出幻觉产生于知识前馈网络过度强调内部知识而复制头未能保留检索内容时,ReDeEP 在多元回归模型中将外部上下文与参数化知识的独立得分作为协变量,从而在 LLaMA2、LLaMA3 和 Dolly 模型上显著提升了幻觉检测的准确性。
Retrieval-Augmented Generation (RAG) models are designed to incorporate external knowledge, reducing hallucinations caused by insufficient parametric (internal) knowledge. However, even with accurate and relevant retrieved content, RAG models can still produce hallucinations by generating outputs that conflict with the retrieved information. Detecting such hallucinations requires disentangling how Large Language Models (LLMs) utilize external and parametric knowledge. Current detection methods often focus on one of these mechanisms or without decoupling their intertwined effects, making accurate detection difficult. In this paper, we investigate the internal mechanisms behind hallucinations in RAG scenarios. We discover hallucinations occur when the Knowledge FFNs in LLMs overemphasize parametric knowledge in the residual stream, while Copying Heads fail to effectively retain or integrate external knowledge from retrieved content. Based on these findings, we propose ReDeEP, a novel method that detects hallucinations by decoupling LLM's utilization of external context and parametric knowledge. Our experiments show that ReDeEP significantly improves RAG hallucination detection accuracy. Additionally, we introduce AARF, which mitigates hallucinations by modulating the contributions of Knowledge FFNs and Copying Heads.
研究动机与目标
- 解决即使检索到的外部上下文准确且相关时,仍难以检测 RAG 模型中幻觉的问题。
- 探究导致 RAG 模型中幻觉的内部机制,特别是参数化知识与外部上下文之间的相互作用。
- 在幻觉检测中解耦参数化知识与外部上下文的混淆影响,提升检测准确率。
- 开发一种适用于工业部署的实用且高效的检测方法。
提出的方法
- 引入两项新指标:外部上下文得分(ECS),用于量化基于注意力机制对检索内容的利用程度;参数化知识得分(PKS),用于衡量前馈网络对内部知识的驱动使用程度。
- 利用机制可解释性分析大语言模型中的注意力头与前馈网络,识别出当知识前馈网络过度强调参数化知识而复制头未能保留外部上下文时,会导致幻觉产生。
- 提出 ReDeEP(回归解耦的外部上下文与参数化知识得分),一种多元回归模型,将 PKS 与 ECS 视为独立协变量以检测幻觉。
- 实现 ReDeEP 的两种变体:ReDeEP(Token)用于逐 token 分析,ReDeEP(Chunk)用于基于 LangChain 与 BGE 嵌入的文档分段分析。
- 提出 AARF(添加注意力,减少前馈网络),一种缓解方法,通过调节知识前馈网络与复制头的贡献来减少幻觉。
- 应用因果干预与相关性分析,验证 PKS 与 ECS 在幻觉生成中的作用。

实验结果
研究问题
- RQ1大语言模型中哪些内部机制会导致在检索上下文准确时仍产生幻觉?
- RQ2知识前馈网络与复制头在 RAG 中如何促成或未能防止幻觉?
- RQ3解耦参数化知识与外部上下文的影响是否能提升幻觉检测性能?
- RQ4ReDeEP 的多元方法相较于混淆或忽略其中一种知识源的方法有何优势?
- RQ5ReDeEP 与 AARF 在真实 RAG 应用中的效率与可扩展性如何?
主要发现
- ReDeEP 实现了最先进的幻觉检测性能,其在 LLaMA2-13B-Chat 上的 AUC 达到 0.8244,在 LLaMA3-8B 上达到 0.7285(使用分段级变体)。
- 消融实验证实,同时使用 PKS 与 ECS(完整 ReDeEP)显著优于仅使用单一得分,验证了解耦的必要性。
- ReDeEP(Chunk)比 ReDeEP(Token)更高效,展现出在工业部署中更优的时间效率。
- AARF 通过调节知识前馈网络与复制头的贡献,有效减少了幻觉,提升了生成回复的真实性。
- 该方法在多个大语言模型上表现稳健,包括 LLaMA2-7B、LLaMA2-13B、LLaMA3-8B 和 Dolly,检测准确率持续提升。
- ReDeEP 在幻觉检测模型中处于高效率水平,其推理时间显著低于依赖外部模型的方法。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。