Skip to content
Preprint

SQuaD-SQL: Efficient Text-to-SQL with Small Language Models via LLM-Guided Knowledge Distillation

Jul 2026 · 0 citations · 41 references
Computer Science

TL;DR

SQuaD-SQL (Small-Qualified and Distilled for SQL), a novel approach that empowers small language models to approach the performance of LLMs on the Text-to-SQL task while significantly improving efficiency through knowledge distillation and synthetic data generation, is introduced.

Abstract

Text-to-SQL is a fundamental task in natural language processing that enables users to interact with structured databases using natural language. While large language models (LLMs) have demonstrated remarkable performance on this task, their substantial computational requirements hinder deployment in resource-constrained settings. In this paper, we introduce SQuaD-SQL (Small-Qualified and Distilled for SQL), a novel approach that empowers small language models (SLMs) to approach the performance of LLMs on the Text-to-SQL task while significantly improving efficiency through knowledge distillation and synthetic data generation. Our method comprises three key components: (1) LLM-based synthetic data generation, where structured knowledge is extracted from LLMs via carefully designed prompting strategies; (2) parameter-efficient fine-tuning, enabling full model training on a single consumer-grade GPU; and (3) domain-adaptive fine-tuning, where domain-specific synthetic data further enhances performance in targeted domains. Experiments on the WikiSQL dataset demonstrate that SQuaD-SQL achieves an execution accuracy of 86.9% on the test set, approaching the performance of LLMs while offering faster inference and lower memory usage. These results suggest that, with proper training strategies, SLMs can serve as practical and efficient alternatives for Text-to-SQL applications in resource-limited environments.

View source

Similar papers

Book Open access Jul 2026

Bridging the Language Gap in Text-to-SQL: Adapting LLMs for Chichewa in a Low-Resource Setting

Recent advances in Large Language Models (LLMs) have significantly improved Text-to-SQL performance in high-resource languages. However, their effectiveness in low-resource language settings remains largely underexplored. In this work, we investigate the adaptation of LLMs for Text-to-SQL generation in Chichewa, a low-resource Bantu language spoken by over 12 million people in Malawi and neighboring regions. We construct a structured Chichewa Text-to-SQL benchmark consisting of 400 manually curated natural language–SQL pairs grounded in a unified relational database covering agriculture, commodity prices, population statistics, market data, and food insecurity. We systematically evaluate five open-source LLMs under zero-shot, random 5-shot, and retrieval-augmented 5-shot prompting, in both English and Chichewa. We then apply parameter-efficient fine-tuning (QLoRA) to selected models and, crucially, evaluate the combined effect of QLoRA fine-tuning with retrieval-augmented prompting. QLoRA alone improves English execution accuracy to 78.3% and Chichewa execution accuracy to 41.7%. When combined with retrieval-augmented prompting, QLoRA achieves 53.3% execution accuracy in Chichewa, representing the best reported result for this language on this benchmark and narrowing the English–Chichewa gap to 23.4 percentage points. Our findings offer practical guidance for deploying database interfaces in linguistically underserved environments.

John Emeka Eze, Dunstan Matekenya, Evance Mathewe · 0 citations
Open access Jul 2026

GradeSQL: Outcome reward models for intelligent Text-to-SQL generation from LLMs

As Large Language Models (LLMs) become foundational to next-generation Intelligent Information Systems, the bridge between natural language interfaces and structured database systems remains a critical bottleneck. While Text-to-SQL generation enables cooperative support for complex query formulation, ensuring the reliability of these generated queries at inference time is a central challenge. Conventional methods rely on coarse execution-based signals, which may limit their ability to capture the nuanced semantic alignment required for high-stakes database environments. In this work, we propose the use of Outcome Reward Models (ORMs) as a fine-grained, probabilistic feedback mechanism for test-time verification in Text-to-SQL tasks. We introduce GradeSQL, a framework for training task-specific ORMs that assign scalar utility scores to candidate SQL queries based on their semantic correctness and alignment with database schema. Our approach is evaluated on the BIRD and Spider benchmarks across multiple open-source LLM families. Experimental results demonstrate that ORM-based verification consistently outperforms traditional execution-based heuristics.

M. Tritto, G. Farano, Dario Di Palma et al. · 2 citations
Open access Jul 2026

Schema-Guided Prompt Strategies for Text-to-SQL over Relational Databases Using Local LLMs

It is suggested that structured prompt engineering provides a practical alternative to model fine-tuning for locally deployed LLMs, offering an effective balance between SQL generation accuracy, computational efficiency, and data privacy.

Nurjayanti Nurjayanti, A. Adiwijaya, A. Romadhony et al. · 0 citations
Preprint Aug 2026

SPOC-SQL: Stage-wise Preference Optimization for Controllable Text-to-SQL

SPOC-SQL is proposed, which decomposes Text-to-SQL into four sequential subtasks following standard SQL execution logic and designs stage-specific optimization strategies for the model to learn key decisions, with the objective of enhancing structured decision-making during query construction.

Yingnan Chen, Chun Ding, Tianshi Xu et al. · 0 citations
Open access Aug 2026

Evaluation of Large Language Models for Natural Language to SQL Query Generation: A Comparative Study Using Exact Match and Execution Accuracy

Decisions are being made based on data, and the demands for easy-to-use interfaces that enable users to simply type in a question to a relational database without having to be a Structured Query Language (SQL) expert have increased. Although the development of Large Language Models (LLMs) has seen remarkable advancements in the past few years, and has led to the emergence of LLMs that have significantly improved the generation of SQL from natural language (Text-to-SQL)[1], there is a relative lack of systematic comparisons between the latest commercial LLMs that has been tested against a series of graded SQL complexity levels with both syntactic and execution-based metrics. This research aims to assess and contrast ChatGPT, Google Gemini, DeepSeek, and Microsoft Copilot for their accuracy and efficacy in creating SQL queries from natural language queries. In a quantitative experimental design, 100 natural language questions were given using a purpose-built benchmark, with six types of queries that included simple retrieval, filtering, joins, aggregation, GROUP BY and HAVING, and nested subqueries. The results of the models were assessed using the manually written and validated ground truth query, with the use of normalised Exact Match Accuracy (EMA) and Execution Accuracy (EXA). The best overall results (EMA 97%, EXA 97%) were obtained by ChatGPT. The Copilot scored EMA 56% and EXA 96%, DeepSeek EMA 55% and EXA 93% and Gemini the lowest with a score of EMA 36% and EXA 87%. The large margin between EMA and EXA for the models (+51 points, +40 points, +38 points) demonstrates the significant shortcomings of exact-match scoring when it comes to assessing real-world skills for producing valid but structurally different SQL. The study empirically demonstrates comparative behaviours of the current LLMs, and suggests the use of execution-aware evaluation in the studies and deployment of Text-to-SQL.

Bharath Kumar N, T L Manasa · 0 citations