超越文档溯源:面向代码、工具输出与文档的片段级幻觉检测 Beyond Document Grounding: Span-Level Hallucination Detection over Code, Tool Output, and Documents 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-07-01
👁️ 预览文献
💡 AI 中文简介
现有检索增强生成(RAG)的幻觉检测大多只针对自然语言文档,但实际系统越来越多地依赖代码、工具输出、表格等结构化输入。本研究构建了一个统一的片段级幻觉检测基准,覆盖代码、工具输出、结构化文档和自然语言RAG数据,通过从正确答案出发注入局部幻觉并标注精确字符位置来生成数据。作者微调了Qwen3.5-2B检测器,在统一测试集上达到0.689的片段级F1,在代码智能体场景达0.60,远超LettuceDetect-large(0.17)和最强零样本大模型评委(最高0.22),同时在RAGTruth(81.8 example-F1)和PsiloQA(0.724 IoU)上保持竞争力。
领域自然语言处理 / 检索增强生成与可信AI
适合谁读需要一定专业背景(了解RAG、幻觉检测和LLM评估)
核心贡献1)提出首个覆盖代码、工具输出、结构化文档与自然语言RAG的统一片段级幻觉检测基准,并给出精确字符级标注;2)微调的小模型Qwen3.5-2B在代码智能体等结构化场景大幅超越现有检测器和零样本大模型评委,同时在传统自然语言基准上保持竞争力。
关键数据统一测试集片段级F1 0.689;代码智能体来源F1 0.60;对比LettuceDetect-large 0.17、最强零样本LLM评委≤0.22;RAGTruth example-F1 81.8;English PsiloQA IoU 0.724。
推荐理由如果你关心RAG系统在代码和工具调用场景下胡说八道的问题,这篇论文给出了一个统一基准和一个小而强的检测器,数据扎实、对比清晰,值得一读。
关键词["幻觉检测", "检索增强生成", "片段级标注", "代码智能体", "结构化输入", "基准测试"]

原文摘要

查看英文原文摘要

Hallucination detection for retrieval-augmented generation (RAG) is usually evaluated on natural-language document evidence. However, grounded generation systems increasingly rely on structured inputs: source code, developer-tool output, markdown documents, tables, and repository metadata. We introduce a unified benchmark for span-level hallucination detection over code, tool output, structured documents, and existing natural-language RAG datasets. The benchmark is built by starting from grounded correct answers, injecting localized hallucinations with exact character labels, and validating the code test split with evidence-based review. Our fine-tuned Qwen3.5-2B detector reaches 0.689 span-F1 on the unified test set and 0.60 on the code-agent source, where it substantially outperforms LettuceDetect-large (0.17) and the strongest zero-shot LLM judges we evaluated (at most 0.22). The same model remains competitive on established natural-language benchmarks, with 81.8 RAGTruth example-F1 and 0.724 English PsiloQA IoU.