NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DTS-SQL: Decomposed Text-to-SQL with Small Large Language Models

Mohammadreza Pourreza, Davood Rafiei

Abstract

Converting natural language questions into executable SQL queries (Text-to-SQL) is a cornerstone of making databases accessible to non-technical users. While large proprietary models like GPT-4 currently lead the field, they pose significant cost and privacy challenges. This paper introduces DTS-SQL (Decomposed Text-to-SQL), a framework that enables small, open-source 7B-parameter models to achieve state-of-the-art performance by decomposing the task into schema-linking and SQL generation stages. Our approach achieves a record-breaking 60.31% execution accuracy on the BIRD benchmark for 7B models.

Introduction

Text-to-SQL systems bridge the gap between non-technical users and complex databases. However, the reliance on massive models like GPT-4 creates barriers for enterprises with sensitive data. Small open-source models often struggle with the inherent complexity of simultaneous schema identification and query logic generation. DTS-SQL addresses this by employing a "divide and conquer" strategy, isolating these two distinct reasoning processes.

Methodology: The DTS-SQL Framework

DTS-SQL utilizes a two-stage fine-tuning approach to reduce the cognitive load on 7B-parameter architectures:

  1. Stage 1: Schema-linking Fine-tuning: The model is trained specifically to identify relevant tables and columns. To manage long schemas, embedding similarity is used to prune the search space before model processing.
  2. Stage 2: SQL Generation Fine-tuning: The model generates the final SQL query using only the "cleaned" schema from Stage 1. By removing irrelevant schema "noise," the model focuses exclusively on query logic.

This "singular objective" training prevents the model from being overwhelmed by multi-tasking, which is a common failure point for smaller LLMs. To prevent positional bias, tables are sorted alphabetically during training and shuffled during inference.

Key Insights: The Power of Decomposition

A critical finding is the performance gap between standard fine-tuning and the decomposed approach. By isolating schema-linking, models saw a 3% to 7% boost in execution accuracy.

Comparison of tuning methods and the theoretical upper bound for schema-linking performance.

As shown in the table above, there remains a significant "Upper Bound" gap—the performance achievable if schema-linking were perfect. For DeepSeek 7B, this gap is nearly 5%, indicating that improving the "search" for tables is the most promising path for future performance gains.

Results and Performance

DTS-SQL enables 7B models to punch well above their weight class, often outperforming much larger, proprietary systems.

Performance comparison of DTS-SQL against state-of-the-art prompting and instruction tuning methods on the Spider dev set.

On the Spider dev set, the DeepSeek 7B variant of DTS-SQL achieved 85.5% execution accuracy (EX), surpassing GPT-4-based prompting methods like DIN-SQL (74.2%) and DAIL-SQL (84.4%). On the more challenging BIRD benchmark, it reached 60.31% EX, the highest recorded for any 7B-parameter model at the time of publication. The method showed consistent gains across different base models (Mistral and DeepSeek), proving the strategy is model-agnostic.

Conclusion and Future Directions

DTS-SQL demonstrates that architectural decomposition is a viable path for making small, private LLMs competitive with proprietary giants. While the system is currently limited by the accuracy of the initial schema-linking stage (~90%), future work will explore advanced retrieval-augmented generation (RAG) techniques and scaling the framework to larger open-source models (e.g., 70B) to further bridge the gap with GPT-4's peak performance.

Summary updated

BibTeX
@inproceedings{pourreza2024dts,
  author = {Mohammadreza Pourreza and Davood Rafiei},
  title = {{DTS-SQL: Decomposed Text-to-SQL with Small Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.481},
}
Figure