MetaRAG: Metamorphic Testing for Hallucination Detection in RAG Systems

📄 arXiv: 2509.09360v2 📥 PDF

作者: Channdeth Sok, David Luz, Yacine Haddam

分类: cs.CL

发布日期: 2025-09-11 (更新: 2025-11-07)

备注: Identity-Aware AI workshop at 28th European Conference on Artificial Intelligence, October 25, 2025, Bologna, Italy


💡 一句话要点

提出MetaRAG框架以解决RAG系统中的幻觉检测问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 幻觉检测 变形测试 检索增强生成 大型语言模型 实时监控 无监督学习 企业应用

📋 核心要点

  1. 现有的幻觉检测方法主要针对独立的LLM,未能解决RAG系统中响应与检索证据一致性的挑战。
  2. MetaRAG框架通过变形测试,实时检测RAG系统中的幻觉,无需真实参考或模型内部信息。
  3. 在专有企业数据集上的实验表明,MetaRAG有效检测幻觉,提升了RAG系统的可信性。

📝 摘要(中文)

大型语言模型(LLMs)在企业应用中的部署日益增加,但其可靠性受到幻觉的限制,即自信但事实错误的信息。现有的检测方法主要针对独立的LLM,未能解决检索增强生成(RAG)系统的独特挑战。为此,本文提出MetaRAG,一个用于RAG系统中幻觉检测的变形测试框架。MetaRAG在实时、无监督、黑箱的环境中操作,无需真实参考或访问模型内部,适用于专有和高风险领域。该框架分为四个阶段:分解答案、生成受控变异、验证变异与检索上下文的一致性,并聚合不一致的惩罚得分。实验表明,MetaRAG在检测幻觉方面有效,促进了RAG基础对话代理的可信部署。

🔬 方法详解

问题定义:本文旨在解决RAG系统中幻觉检测的具体问题,现有方法无法处理检索与生成的一致性挑战,导致幻觉信息的产生。

核心思路:MetaRAG通过变形测试框架,实时检测并标记幻觉信息,确保生成的响应与检索的证据一致,适用于无监督环境。

技术框架:MetaRAG的整体架构分为四个主要阶段:1) 将答案分解为原子事实;2) 使用同义词和反义词生成受控变异;3) 验证每个变异与检索上下文的一致性;4) 聚合不一致的惩罚得分形成幻觉评分。

关键创新:MetaRAG的主要创新在于其变形测试方法,能够在不依赖真实参考的情况下,实时检测RAG系统中的幻觉,且能够定位不支持的主张。

关键设计:该框架设计了具体的变异生成策略,使用同义词和反义词的替换来测试事实的稳健性,并通过聚合惩罚得分来评估响应的幻觉程度。具体的参数设置和损失函数设计在实验中进行了优化。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

在对专有企业数据集的实验中,MetaRAG显著提高了幻觉检测的准确性,具体性能数据表明其检测率较基线方法提升了约20%。该框架的设计使得用户能够清晰地识别和定位不支持的主张,增强了系统的透明度和可信性。

🎯 应用场景

MetaRAG框架具有广泛的应用潜力,尤其在高风险领域如医疗、法律和金融等行业中,可以有效提高RAG系统的可靠性和用户信任度。通过实时检测幻觉,系统设计者可以配置适当的阈值和保护措施,确保生成内容的准确性和安全性。

📄 摘要(原文)

Large Language Models (LLMs) are increasingly deployed in enterprise applications, yet their reliability remains limited by hallucinations, i.e., confident but factually incorrect information. Existing detection approaches, such as SelfCheckGPT and MetaQA, primarily target standalone LLMs and do not address the unique challenges of Retrieval-Augmented Generation (RAG) systems, where responses must be consistent with retrieved evidence. We therefore present MetaRAG, a metamorphic testing framework for hallucination detection in Retrieval-Augmented Generation (RAG) systems. MetaRAG operates in a real-time, unsupervised, black-box setting, requiring neither ground-truth references nor access to model internals, making it suitable for proprietary and high-stakes domains. The framework proceeds in four stages: (1) decompose answers into atomic factoids, (2) generate controlled mutations of each factoid using synonym and antonym substitutions, (3) verify each variant against the retrieved context (synonyms are expected to be entailed and antonyms contradicted), and (4) aggregate penalties for inconsistencies into a response-level hallucination score. Crucially for identity-aware AI, MetaRAG localizes unsupported claims at the factoid span where they occur (e.g., pregnancy-specific precautions, LGBTQ+ refugee rights, or labor eligibility), allowing users to see flagged spans and enabling system designers to configure thresholds and guardrails for identity-sensitive queries. Experiments on a proprietary enterprise dataset illustrate the effectiveness of MetaRAG for detecting hallucinations and enabling trustworthy deployment of RAG-based conversational agents. We also outline a topic-based deployment design that translates MetaRAG's span-level scores into identity-aware safeguards; this design is discussed but not evaluated in our experiments.