arXiv:2509.09360cs.CL2025-09被引 3

MetaRAG通过变异测试检测RAG系统幻觉,无需真实答案或模型内部信息。

MetaRAG: Metamorphic Testing for Hallucination Detection in RAG Systems

  • 将回答拆解为原子事实,用同义词/反义词生成变异版本
  • 通过检索内容验证变异结果,不一致处累积为幻觉得分
  • 定位具体错误片段,适合敏感身份相关查询的可信部署

大型语言模型在企业应用中日益普及,但其可靠性受限于幻觉问题——即自信却事实错误的信息。现有检测方法如SelfCheckGPT和MetaQA主要针对独立大模型,未解决检索增强生成(RAG)系统的独特挑战,即响应必须与检索证据一致。为此,我们提出MetaRAG,一种用于RAG系统幻觉检测的变异测试框架。该框架在实时、无监督、黑盒环境下运行,无需真实参考答案或模型内部访问,适用于专有及高风险领域。流程分为四步:(1) 将回答分解为原子事实单元;(2) 使用同义词和反义词替换生成可控变异;(3) 验证每种变体是否与检索上下文一致(同义词应被蕴含,反义词应被矛盾);(4) 将不一致项累积为整体幻觉评分。对特定身份敏感的主张(如孕期防护、LGBTQ+难民权利、劳动资格)可精确定位至具体事实片段,支持用户识别并配置安全阈值。在某企业专有数据集上的实验表明,MetaRAG能有效检测幻觉,促进可信的RAG对话代理部署。此外,我们还提出一种基于主题的部署设计,将细粒度得分转化为身份感知的防护机制,此设计虽未在实验中评估,但已讨论。

原文摘要 · Abstract (English)

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.

幻觉检测RAG变异测试身份敏感

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。