Large language models (LLMs), despite their remarkable text generation capabilities, often hallucinate and generate text that is factually incorrect and not grounded in real-world knowledge. This poses serious risks in domains like healthcare, finance, and customer support. A typical way to use LLMs is via the APIs provided by LLM vendors where there is no access to model weights or options to fine-tune the model. Existing methods to detect hallucinations in such settings where the model access is restricted or constrained by resources typically require making multiple LLM API calls, increasing latency and API cost. We introduce CONFACTCHECK, an efficient hallucination detection approach that does not leverage any external knowledge base and works on the simple intuition that responses to factual probes within the generated text should be consistent within a single LLM and across different LLMs. Rigorous empirical evaluation on multiple datasets that cover both the generation of factual texts and the open generation shows that CONFACTCHECK can detect hallucinated facts efficiently using fewer resources and achieves higher accuracy scores compared to existing baselines that operate under similar conditions. Our code is available here.
翻译:大语言模型(LLMs)尽管具备卓越的文本生成能力,但经常产生幻觉,生成与事实不符且未基于真实世界知识的文本。这在医疗、金融和客户支持等领域带来了严重风险。使用LLMs的典型方式是通过LLM供应商提供的API,这种方式无法访问模型权重或进行微调。在模型访问受限或资源受限的情况下,现有的幻觉检测方法通常需要进行多次LLM API调用,从而增加了延迟和API成本。我们提出了CONFACTCHECK,一种高效的幻觉检测方法,该方法不依赖任何外部知识库,其核心思想基于一个简单的直觉:在单个LLM内部以及不同LLM之间,对生成文本中事实性探针的回应应该保持一致。在涵盖事实性文本生成和开放性生成的多个数据集上进行的严格实证评估表明,与在类似条件下运行的现有基线方法相比,CONFACTCHECK能够以更少的资源高效地检测出幻觉事实,并获得了更高的准确率分数。我们的代码可在此处获取。