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.


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

0
下载
关闭预览

相关内容

SPARQL(读作“sparkle”,SPARQL协议和RDF查询语言的首字母缩写)是一种RDF查询语言,也就是说,它是一种语义查询语言,用于数据库检索和操作以资源描述框架(RDF)格式存储的数据。
大语言模型中的检索与结构化增强生成综述
专知会员服务
32+阅读 · 2025年9月17日
定制化大型语言模型的图检索增强生成综述
专知会员服务
37+阅读 · 2025年1月28日
《大型语言模型中基于检索的文本生成》综述
专知会员服务
59+阅读 · 2024年4月18日
KnowledGPT:基于知识库的检索和存储访问增强大型语言模型
TextInfoExp:自然语言处理相关实验(基于sougou数据集)
全球人工智能
12+阅读 · 2017年11月12日
语料库构建——自然语言理解的基础
计算机研究与发展
11+阅读 · 2017年8月21日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
VIP会员
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员