Skip to main navigation Skip to search Skip to main content

PI-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming Languages

  • Yongdong Chi
  • , Hanqing Wang
  • , Yun Chen
  • , Yan Yang
  • , Jian Yang
  • , Zonghan Yang
  • , Xiao Yan
  • , Guanhua Chen*
  • *Corresponding author for this work
  • Shanghai University of Finance and Economics
  • Beihang University
  • Tsinghua University
  • Southern University of Science and Technology

Research output: Contribution to conference › Conference Paper › peer-review

3 Scopus citations

Abstract

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. © 2025 Association for Computational Linguistics.
Original languageEnglish
Pages25120-25144
DOIs
StatePublished - Jan 2025
Event30th Conference on Empirical Methods in Natural Language Processing, EMNLP 2025 - Suzhou, China, Suzhou, China
Duration: 4 Nov 2025 → 9 Nov 2025

Conference

Conference30th Conference on Empirical Methods in Natural Language Processing, EMNLP 2025
Country/TerritoryChina
CitySuzhou
Period4/11/25 → 9/11/25

Funding

Southern University of Science and Technology, Number: 62306132, Acronym: NNSF, National Natural Science Foundation of China, Number: -, Acronym: NNSF, National Natural Science Foundation of China, Number: 2025A1515011564, Acronym: -, Basic and Applied Basic Research Foundation of Guangdong Province, Number: -, Acronym: -, Basic and Applied Basic Research Foundation of Guangdong Province, Number: 25ZR1402136, Acronym: -, Natural Science Foundation of Shanghai Municipality, Number: -, Acronym: -, Natural Science Foundation of Shanghai Municipality, Number: CXJJ-2024-463, Acronym: -, Fundamental Research Funds for the Central Universities, Number: -, Acronym: -, Fundamental Research Funds for the Central Universities (SUSTech)

Indexed by

  • Scopus
  • EI

Fingerprint

Dive into the research topics of 'PI-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming Languages'. Together they form a unique fingerprint.

Cite this