Fine-Tuning Language Models for Context-Specific SQL Query Generation
Not on the map. Why?
Abstract (arXiv)
The ability to generate SQL queries from natural language has significant implications for making data accessible to non-specialists. This paper presents a novel approach to fine-tuning open-source large language models (LLMs) for the task of transforming natural language into SQL queries within the retail domain. We introduce models specialized in generating SQL queries, trained on synthetic datasets tailored to the Snowflake SQL and GoogleSQL dialects. Our methodology involves generating a context-specific dataset using GPT-4, then fine-tuning three open-source LLMs(Starcoder Plus, Code-Llama, and Mistral) employing the LoRa technique to optimize for resource constraints. The fine-tuned models demonstrate superior performance in zero-shot settings compared to the baseline GPT-4, with Code-Llama achieving the highest accuracy rates, at 81.58% for Snowflake SQL and 82.66% for GoogleSQL. These results underscore the effectiveness of fine-tuning LLMs on domain-specific tasks and suggest a promising direction for enhancing the accessibility of relational databases through natural language interfaces.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 14 of its 17 references that are in the map. First posted on arXiv 4 Dec 2023.
Builds on
14 of 17 references.
References · 14
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 687
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 385
- 2017SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learningcited by 135
- 2023A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capabilitycited by 119
- 2018TypeSQL: Knowledge-based Type-Aware Neural Text-to-SQL Generationcited by 81
- 2020Grounded Adaptation for Zero-shot Executable Semantic Parsingcited by 76
Built on by
Citing papers per year: 2024: 1; 2025: 2.
3 papers.
- 2025Text-to-SQL Domain Adaptation via Human-LLM Collaborative Data Annotationcited by 6
- 2024Towards Automated Data Sciences with Natural Language and SageCopilot: Practices and Lessons Learnedcited by 3
- 2025BAPPA: Benchmarking Agents, Plans, and Pipelines for Automated Text-to-SQL Generationcited by 0
- 2025BAPPA: Benchmarking Agents, Plans, and Pipelines for Automated Text-to-SQL Generation6 Nov 2025
- 2025Text-to-SQL Domain Adaptation via Human-LLM Collaborative Data Annotation21 Feb 2025
- 2024Towards Automated Data Sciences with Natural Language and SageCopilot: Practices and Lessons Learned21 Jul 2024