Skip to main content
QUICK REVIEW

[Paper Review] ReDeEP: Detecting Hallucination in Retrieval-Augmented Generation via Mechanistic Interpretability

Zhongxiang Sun, Xiaoxue Zang|arXiv (Cornell University)|Oct 15, 2024
Schizophrenia research and treatmentMedicine4 citations
TL;DR

This paper proposes ReDeEP, a novel hallucination detection method for Retrieval-Augmented Generation (RAG) models that decouples the utilization of external knowledge and parametric knowledge using mechanistic interpretability. By identifying that hallucinations arise when Knowledge Feed-Forward Networks overemphasize internal knowledge while Copying Heads fail to retain retrieved content, ReDeEP uses separate scores for external context and parametric knowledge as covariates in a multivariate regression model, achieving significant accuracy gains in hallucination detection across LLaMA2, LLaMA3, and Dolly models.

ABSTRACT

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.

Motivation & Objective

  • To address the challenge of detecting hallucinations in RAG models even when retrieved external context is accurate and relevant.
  • To investigate the internal mechanisms causing hallucinations in RAG, particularly the interplay between parametric knowledge and external context.
  • To decouple the confounding effects of parametric knowledge and external context in hallucination detection, improving detection accuracy.
  • To develop a practical, efficient detection method suitable for industrial deployment.

Proposed method

  • Introduce two novel metrics: the External Context Score (ECS) to quantify attention-based utilization of retrieved content, and the Parametric Knowledge Score (PKS) to measure FFN-driven use of internal knowledge.
  • Use mechanistic interpretability to analyze attention heads and feed-forward networks in LLMs, identifying that hallucinations occur when Knowledge FFNs overemphasize parametric knowledge and Copying Heads fail to retain external context.
  • Propose ReDeEP (Regressing Decoupled External context and Parametric knowledge score), a multivariate regression model treating PKS and ECS as independent covariates to detect hallucinations.
  • Implement ReDeEP in two variants: ReDeEP (Token) for token-level analysis and ReDeEP (Chunk) for document-segmented analysis using LangChain and BGE embeddings.
  • Develop AARF (Add Attention Reduce FFN), a mitigation method that modulates the contributions of Knowledge FFNs and Copying Heads to reduce hallucinations.
  • Apply causal intervention and correlation analysis to validate the roles of PKS and ECS in hallucination generation.
Figure 1: Two examples of RAG where the retrieved document is correct but conflicts with parametric knowledge. The left example shows a correct response based on external knowledge, while the right example demonstrates hallucination despite accurate external context.
Figure 1: Two examples of RAG where the retrieved document is correct but conflicts with parametric knowledge. The left example shows a correct response based on external knowledge, while the right example demonstrates hallucination despite accurate external context.

Experimental results

Research questions

  • RQ1What internal mechanisms in LLMs lead to hallucinations in RAG even when retrieved context is accurate?
  • RQ2How do Knowledge Feed-Forward Networks and Copying Heads contribute to or fail to prevent hallucinations in RAG?
  • RQ3Can decoupling the influence of parametric knowledge and external context improve hallucination detection performance?
  • RQ4How does ReDeEP’s multivariate approach outperform methods that confound or ignore one of the two knowledge sources?
  • RQ5What is the efficiency and scalability of ReDeEP and AARF in real-world RAG applications?

Key findings

  • ReDeEP achieves state-of-the-art hallucination detection performance, with an AUC of 0.8244 on LLaMA2-13B-Chat and 0.7285 on LLaMA3-8B using the chunk-level variant.
  • The ablation study confirms that using both PKS and ECS together (Full ReDeEP) significantly outperforms using only one score, validating the necessity of decoupling.
  • ReDeEP (Chunk) is more efficient than ReDeEP (Token), demonstrating superior time efficiency for industrial deployment.
  • AARF reduces hallucinations by modulating the contributions of Knowledge FFNs and Copying Heads, improving truthfulness in generated responses.
  • The method is robust across multiple LLMs, including LLaMA2-7B, LLaMA2-13B, LLaMA3-8B, and Dolly, showing consistent gains in detection accuracy.
  • ReDeEP is positioned at a high-efficiency level among hallucination detection models, with significantly lower inference time than methods relying on external models.
Figure 2: Causal perspectives on hallucination detection methods. (i) : parametric knowledge is confounded by external context, (ii) : external context is confounded by parametric knowledge, and (iii) : mixes both without decoupling their contributions. (Ours) : decouple these confounders using mech
Figure 2: Causal perspectives on hallucination detection methods. (i) : parametric knowledge is confounded by external context, (ii) : external context is confounded by parametric knowledge, and (iii) : mixes both without decoupling their contributions. (Ours) : decouple these confounders using mech

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.