迈向基于稀疏自编码器的忠实检索增强生成
Toward Faithful Retrieval-Augmented Generation with Sparse Autoencoders
AI总结:
本研究提出RAGLens,通过稀疏自编码器解构LLM内部激活,有效检测RAG生成中的不忠实输出,并提供可解释的决策理由。
摘要:
检索增强生成(RAG)通过将输出扎根于检索到的证据来提高大语言模型(LLMs)的事实性,但忠实性失败,即生成内容与提供的来源矛盾或超出其范围,仍然是一个关键挑战。现有的RAG幻觉检测方法往往依赖于大规模检测器训练,这需要大量标注数据,或者依赖于查询外部LLM裁判,这导致了高推理成本。尽管一些方法尝试利用LLM的内部表示进行幻觉检测,但其准确性仍然有限。受近期机制可解释性进展的启发,我们采用稀疏自编码器(SAEs)来解构内部激活,成功识别出在RAG幻觉中被特别触发的特征。基于信息基础的特征选择和加性特征建模系统管道,我们引入RAGLens,一种轻量级的幻觉检测器,能够利用LLM内部表示准确地标记不忠实的RAG输出。RAGLens不仅在检测性能上优于现有方法,还提供了可解释的决策理由,使有效的事后缓解不忠实的RAG成为可能。最后,我们证明了我们的设计选择,并揭示了LLM中与幻觉相关的信号分布的新见解。代码可在https://github.com/Teddy-XiongGZ/RAGLens上获取。
英文摘要:
Retrieval-Augmented Generation (RAG) improves the factuality of large language models (LLMs) by grounding outputs in retrieved evidence, but faithfulness failures, where generations contradict or extend beyond the provided sources, remain a critical challenge. Existing hallucination detection methods for RAG often rely either on large-scale detector training, which requires substantial annotated data, or on querying external LLM judges, which leads to high inference costs. Although some approaches attempt to leverage internal representations of LLMs for hallucination detection, their accuracy remains limited. Motivated by recent advances in mechanistic interpretability, we employ sparse autoencoders (SAEs) to disentangle internal activations, successfully identifying features that are specifically triggered during RAG hallucinations. Building on a systematic pipeline of information-based feature selection and additive feature modeling, we introduce RAGLens, a lightweight hallucination detector that accurately flags unfaithful RAG outputs using LLM internal representations. RAGLens not only achieves superior detection performance compared to existing methods, but also provides interpretable rationales for its decisions, enabling effective post-hoc mitigation of unfaithful RAG. Finally, we justify our design choices and reveal new insights into the distribution of hallucination-related signals within LLMs. The code is available at https://github.com/Teddy-XiongGZ/RAGLens.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。