SPS-SQL: Enhancing Text-to-SQL generation on small-scale LLMs with pre-synthesized queries
Large Language Models (LLMs) have demonstrated strong performance in Text-to-SQL generation, converting natural language questions into SQL queries. While most researches focus on enhancing large LLMs like GPT-4 by OpenAI, small-scale open-source LLMs remain overlooked and underutilized. This paper introduces SPS-SQL, a novel lightweight approach designed to boost the Text-to-SQL accuracy on small-scale open-source LLMs. By leveraging semantic information to extract templates from training data , SPS-SQL pre-synthesizes queries based solely on schema information , which serve as few-shot examples to guide further SQL generation. SPS-SQL achieves execution accuracies on the Spider development and test set with Qwen 2.5 Coder (7 billion parameters) of 81.7% and 82.1%. Competitive results are seen on other LLMs as well, further emphasizing its flexibility and adaptability, significantly outperforming other methods on the same model. • Focus on improving Text-to-SQL accuracy on open-source small-scale LLMs. • Extract templates from prior SQL queries to synthesis new queries. • Pre-synthesis SQL queries with database schema as few-shot examples. • Achieve high execution accuracy on Spider dataset. • Improve accuracies of SQL generation on multiple small-scale LLMs.
Authors
- Chuanyi Liu (ORCID: https://orcid.org/0000-0002-0891-2544)
- Shaoming Duan (ORCID: https://orcid.org/0000-0002-7546-9562)
- Yong Xu (ORCID: https://orcid.org/0000-0003-0530-2123)
- Peiyi Han (ORCID: https://orcid.org/0000-0003-0417-4473)
- Liang Yan
- Qing Wan (ORCID: https://orcid.org/0009-0006-3879-694X)
Institutions
- Shenzhen Institute of Information Technology (CN)
- Harbin Institute of Technology (CN)
- Peng Cheng Laboratory (CN)
- Inspur (China) (CN)
- Cloud Computing Center (CN)
Publication Details
- Journal
- Pattern Recognition Letters
- Published
- 2025-04-29
- DOI
- https://doi.org/10.1016/j.patrec.2025.04.016
- Citations
- 1
- Primary Topic
- Semantic Web and Ontologies
- Type
- article
- Field-Weighted Citation Impact
- 2.48