DB-Explore: Automated Database Exploration and Instruction Synthesis for Text-to-SQL

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ma, Haoyuan, Shen, Yongliang, Liu, Hengwei, Zhang, Wenqi, Xu, Haolei, Peng, Qiuying, Wang, Jun, Lu, Weiming
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909617773084672
author Ma, Haoyuan
Shen, Yongliang
Liu, Hengwei
Zhang, Wenqi
Xu, Haolei
Peng, Qiuying
Wang, Jun
Lu, Weiming
author_facet Ma, Haoyuan
Shen, Yongliang
Liu, Hengwei
Zhang, Wenqi
Xu, Haolei
Peng, Qiuying
Wang, Jun
Lu, Weiming
contents Recent text-to-SQL systems powered by large language models (LLMs) have demonstrated remarkable performance in translating natural language queries into SQL. However, these systems often struggle with complex database structures and domain-specific queries, as they primarily focus on enhancing logical reasoning and SQL syntax while overlooking the critical need for comprehensive database understanding. To address this limitation, we propose DB-Explore, a novel framework that systematically aligns LLMs with database knowledge through automated exploration and instruction synthesis. DB-Explore constructs database graphs to capture complex relational schemas, leverages GPT-4 to systematically mine structural patterns and semantic knowledge, and synthesizes instructions to distill this knowledge for efficient fine-tuning of LLMs. Our framework enables comprehensive database understanding through diverse sampling strategies and automated instruction generation, bridging the gap between database structures and language models. Experiments conducted on the SPIDER and BIRD benchmarks validate the effectiveness of DB-Explore, achieving an execution accuracy of 67.0% on BIRD and 87.8% on SPIDER. Notably, our open-source implementation based on Qwen2.5-Coder-7B achieves state-of-the-art results at minimal computational cost, outperforming several GPT-4-driven Text-to-SQL systems.
format Preprint
id arxiv_https___arxiv_org_abs_2503_04959
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle DB-Explore: Automated Database Exploration and Instruction Synthesis for Text-to-SQL
Ma, Haoyuan
Shen, Yongliang
Liu, Hengwei
Zhang, Wenqi
Xu, Haolei
Peng, Qiuying
Wang, Jun
Lu, Weiming
Computation and Language
Recent text-to-SQL systems powered by large language models (LLMs) have demonstrated remarkable performance in translating natural language queries into SQL. However, these systems often struggle with complex database structures and domain-specific queries, as they primarily focus on enhancing logical reasoning and SQL syntax while overlooking the critical need for comprehensive database understanding. To address this limitation, we propose DB-Explore, a novel framework that systematically aligns LLMs with database knowledge through automated exploration and instruction synthesis. DB-Explore constructs database graphs to capture complex relational schemas, leverages GPT-4 to systematically mine structural patterns and semantic knowledge, and synthesizes instructions to distill this knowledge for efficient fine-tuning of LLMs. Our framework enables comprehensive database understanding through diverse sampling strategies and automated instruction generation, bridging the gap between database structures and language models. Experiments conducted on the SPIDER and BIRD benchmarks validate the effectiveness of DB-Explore, achieving an execution accuracy of 67.0% on BIRD and 87.8% on SPIDER. Notably, our open-source implementation based on Qwen2.5-Coder-7B achieves state-of-the-art results at minimal computational cost, outperforming several GPT-4-driven Text-to-SQL systems.
title DB-Explore: Automated Database Exploration and Instruction Synthesis for Text-to-SQL
topic Computation and Language
url https://arxiv.org/abs/2503.04959