SQL Statement Generation Enhanced Through the Fusion of Large Language Models and Knowledge Graphs
Open Access
- 7 January 2026
- journal article
- research article
- Published by MDPI AG in Electronics
- Vol. 15 (2) , 278
Abstract
Current mainstream SQL generation approaches remain insufficient in capturing the semantic information of structured data and handling complex query tasks. To address the challenges of hallucination and accuracy degradation in large language model (LLM)-based SQL generation, this paper proposes an enhanced SQL generation framework that integrates knowledge graphs with large language models. The proposed method introduces an SQL-KG-Verifier module, which synergizes the structured information of knowledge graphs with the generative capabilities of LLMs. By incorporating the verifier, the framework collaboratively refines SQL statements to ensure higher structural consistency, improved accuracy, and enhanced interpretability. Specifically, the verifier employs the entities and relational information retrieved from the knowledge graph as proxies to validate and revise the model outputs, effectively reducing generation errors. Experimental results demonstrate that on the BIRD and Spider datasets, the proposed method achieves execution accuracies of 52.71% and 77.26%, respectively—representing improvements of 19.93 and 21.27 percentage points over baseline models. Moreover, the approach exhibits superior adaptability and generation performance in complex and domain-specific query scenarios.Keywords
Funding Information
- Guizhou Science and Technology Program (QKH-ZC[2023]Key001)
- Guanghe Fund (ghfund202407047557)
- National Natural Science Foundation of China (61461009)
- Guizhou Key Laboratory of Advanced
This publication has 15 references indexed in Scilit:
- A Survey on RAG Meeting LLMs: Towards Retrieval-Augmented Large Language Models2024
- A Survey on Evaluation of Large Language ModelsACM Transactions on Intelligent Systems and Technology, 2024
- Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation2024
- Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationProceedings of the VLDB Endowment, 2024
- Instruction Tuning with GPT-4arXiv, 2023
- QALD-9-plus: A Multilingual Dataset for Question Answering over DBpedia and Wikidata Translated by Native Speakers2022
- Knowledge GraphsACM Computing Surveys, 2021
- Integrating Unstructured Data into Relational Databases2006
- Estimating progress of execution for SQL queries2004
- SuperSQL1998