Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: chi, Yongdong, Wang, Hanqing, Yang, Zonghan, Yang, Jian, Yan, Xiao, Chen, Yun, Chen, Guanhua
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:https://arxiv.org/abs/2506.00912
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866915319759503360
author chi, Yongdong
Wang, Hanqing
Yang, Zonghan
Yang, Jian
Yan, Xiao
Chen, Yun
Chen, Guanhua
author_facet chi, Yongdong
Wang, Hanqing
Yang, Zonghan
Yang, Jian
Yan, Xiao
Chen, Yun
Chen, Guanhua
contents Text-to-SQL transforms the user queries from natural language to executable SQL programs, enabling non-experts to interact with complex databases. Existing prompt-based methods craft meticulous text guidelines and examples to facilitate SQL generation, but their accuracy is hindered by the large semantic gap between the texts and the low-resource SQL programs. In this work, we propose Pi-SQL, which incorporates the high-resource Python program as a pivot to bridge between the natural language query and SQL program. In particular, Pi-SQL first generates Python programs that provide fine-grained step-by-step guidelines in their code blocks or comments, and then produces an SQL program following the guidance of each Python program. The final SQL program matches the reference Python program's query results and, through selection from candidates generated by different strategies, achieves superior execution speed, with a reward-based valid efficiency score up to 4.55 higher than the best-performing baseline. Extensive experiments demonstrate the effectiveness of Pi-SQL, which improves the execution accuracy of the best-performing baseline by up to 3.20.
format Preprint
id arxiv_https___arxiv_org_abs_2506_00912
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Pi-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming Languages
chi, Yongdong
Wang, Hanqing
Yang, Zonghan
Yang, Jian
Yan, Xiao
Chen, Yun
Chen, Guanhua
Computation and Language
Artificial Intelligence
Text-to-SQL transforms the user queries from natural language to executable SQL programs, enabling non-experts to interact with complex databases. Existing prompt-based methods craft meticulous text guidelines and examples to facilitate SQL generation, but their accuracy is hindered by the large semantic gap between the texts and the low-resource SQL programs. In this work, we propose Pi-SQL, which incorporates the high-resource Python program as a pivot to bridge between the natural language query and SQL program. In particular, Pi-SQL first generates Python programs that provide fine-grained step-by-step guidelines in their code blocks or comments, and then produces an SQL program following the guidance of each Python program. The final SQL program matches the reference Python program's query results and, through selection from candidates generated by different strategies, achieves superior execution speed, with a reward-based valid efficiency score up to 4.55 higher than the best-performing baseline. Extensive experiments demonstrate the effectiveness of Pi-SQL, which improves the execution accuracy of the best-performing baseline by up to 3.20.
title Pi-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming Languages
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2506.00912