Skip to main navigation Skip to search Skip to main content

TS-SQL: Test-driven Self-refinement for Text-to-SQL

  • Wenbo Xu
  • , Haifeng Zhu
  • , Liang Yan
  • , Chuanyi Liu*
  • , Peiyi Han*
  • , Shaoming Duan
  • , Jeff Z. Pan
  • *Corresponding author for this work
  • Harbin Institute of Technology Shenzhen
  • Ltd
  • Peng Cheng Laboratory
  • University of Edinburgh

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Large Language Model (LLM)-based self-refinement has advanced Text-to-SQL, but it struggles with SQL semantic errors, such as omitted conditions and misinterpreted requirements. This is because self-refinement depends on LLMs’ semantic understanding of questions, a process prone to hallucination-induced biases, leading to uncorrectable errors. To solve this problem, we propose Test-driven Self-refinement for Text-to-SQL (TS-SQL). It leverages a collaborative LLM agent framework to automatically synthesize high-quality test cases, including test data and test code. The test cases are further employed to provide execution feedback for LLM self-refinement towards SQL semantic errors. Rigorous evaluation shows the superiority of TS-SQL: for BIRD-dev, TS-SQL improves at least 6% over existing SQL self-refinement methods; for Spider-dev, TS-SQL identifies and corrects 131 gold SQL errors, exposing system flaws in benchmark rigor.

Original languageEnglish
Title of host publicationEMNLP 2025 - 2025 Conference on Empirical Methods in Natural Language Processing, Findings of EMNLP 2025
EditorsChristos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, Violet Peng
PublisherAssociation for Computational Linguistics (ACL)
Pages2864-2889
Number of pages26
ISBN (Electronic)9798891763357
DOIs
StatePublished - 2025
Externally publishedYes
Event30th Conference on Empirical Methods in Natural Language Processing, EMNLP 2025 - Suzhou, China
Duration: 4 Nov 20259 Nov 2025

Publication series

NameEMNLP 2025 - 2025 Conference on Empirical Methods in Natural Language Processing, Findings of EMNLP 2025

Conference

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

Fingerprint

Dive into the research topics of 'TS-SQL: Test-driven Self-refinement for Text-to-SQL'. Together they form a unique fingerprint.

Cite this