arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.13369cs.CL
收藏

通过生成后记忆检索减少基于语言模型的SPARQL查询生成中的幻觉

Reducing Hallucinations in Language Model-based SPARQL Query Generation Using Post-Generation Memory Retrieval

Polytechnique Montréal(蒙特利尔理工学院);Mila - Quebec AI Institute(魁北克人工智能研究院);Canada CIFAR AI Chair(加拿大CIFAR人工智能 chair)

Aditya Sharma, Christopher J. Pal, Amal Zouaq

AI总结:

本文提出PGMR框架,通过生成后记忆检索减少语言模型生成SPARQL查询时的URI幻觉,提升查询准确性和系统鲁棒性。

摘要:

从自然语言问题生成SPARQL查询的能力对于确保高效准确地从知识图谱(KG)中检索结构化数据至关重要。尽管大型语言模型(LLMs)已被广泛用于SPARQL查询生成,但它们在生成KG元素(如统一资源标识符(URIs))时往往容易产生幻觉和分布外错误,基于内部参数化知识的模糊性。我们提出了PGMR(生成后记忆检索),一个模块化框架,其中LLM使用自然语言占位符生成中间查询用于URIs,随后非参数化记忆模块被用来检索并解决正确的KG URIs。PGMR在各种LLM、数据集和分布偏移中显著提高了查询正确性(SQM),同时实现了URI幻觉的近完全抑制。关键的是,我们证明了PGMR的优越安全性和鲁棒性:检索置信度阈值使PGMR能够有效拒绝缺乏支持的查询,且检索器在记忆噪声下表现稳健,即使非参数化记忆规模扩大到9倍时仍能保持强劲性能。

英文摘要:

The ability to generate SPARQL queries from natural language questions is crucial for ensuring efficient and accurate retrieval of structured data from knowledge graphs (KG). While large language models (LLMs) have been widely adopted for SPARQL query generation, they are often susceptible to hallucinations and out-of-distribution errors when generating KG elements, such as Uniform Resource Identifiers (URIs), based on opaque internal parametric knowledge. We propose PGMR (Post-Generation Memory Retrieval), a modular framework where the LLM produces an intermediate query using natural language placeholders for URIs, and a non-parametric memory module is subsequently employed to retrieve and resolve the correct KG URIs. PGMR significantly enhances query correctness (SQM) across various LLMs, datasets, and distribution shifts, while achieving the near-complete suppression of URI hallucinations. Critically, we demonstrate PGMR's superior safety and robustness: a retrieval confidence threshold enables PGMR to effectively refuse to answer queries that lack support, and the retriever proves highly resilient to memory noise, maintaining strong performance even when the non-parametric memory size is scaled up to 9 times with irrelevant, distracting entities.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑