Reducing Hallucinations in Language Model-based SPARQL Query Generation Using Post-Generation Memory Retrieval
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 22 of its 50 references that are in the map. First posted on arXiv 19 Feb 2025.
Builds on
22 of 50 references.
References · 22
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,568
- 2017Billion-scale similarity search with GPUscited by 2,497
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,141
- 2020MPNet: Masked and Permuted Pre-training for Language Understandingcited by 981
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
- 2023FacTool: Factuality Detection in Generative AI -- A Tool Augmented Framework for Multi-Task and Multi-Domain Scenarioscited by 251
10 more
- 2023A Stitch in Time Saves Nine: Detecting and Mitigating Hallucinations of LLMs by Validating Low-Confidence Generationcited by 206
- 2023ChatDB: Augmenting LLMs with Databases as Their Symbolic Memorycited by 140
- 2024Seven Failure Points When Engineering a Retrieval Augmented Generation Systemcited by 139
- 2023RecurrentGPT: Interactive Generation of (Arbitrarily) Long Textcited by 84
- 2021The Factual Inconsistency Problem in Abstractive Text Summarization: A Surveycited by 79
- 2021A Survey on Complex Knowledge Base Question Answering: Methods, Challenges and Solutionscited by 78
- 2022Modern Baselines for SPARQL Semantic Parsingcited by 34
- 2024LLM-based SPARQL Query Generation from Natural Language over Federated Knowledge Graphscited by 22
- 2024Leveraging small language models for Text2SPARQL tasks to improve the resilience of AI assistancecited by 13
- 2023A Comprehensive Evaluation of Neural SPARQL Query Generation from Natural Language Questionscited by 9
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.