Grounding Natural Language to SQL Translation with Data-Based Self-Explanations

Yuankai Fan, Tonghui Ren, Can Huang, Zhenying He, X. Sean Wang
11/5/2024
cs.DBcs.CL

No official code found. Best implementation: Kaimary/CycleSQL (17 stars, Apache-2.0, last commit 2025-05-24).

Abstract

Natural Language Interfaces for Databases empower non-technical users to interact with data using natural language (NL). Advanced approaches, utilizing either neural sequence-to-sequence or more recent sophisticated large-scale language models, typically implement NL to SQL (NL2SQL) translation in an end-to-end fashion. However, like humans, these end-to-end translation models may not always generate the best SQL output on their first try. In this paper, we propose CycleSQL, an iterative framework designed for end-to-end translation models to autonomously generate the best output through self-evaluation. The main idea of CycleSQL is to introduce data-grounded NL explanations of query results as self-provided feedback, and use the feedback to validate the correctness of the translation iteratively, hence improving the overall translation accuracy. Extensive experiments, including quantitative and qualitative evaluations, are conducted to study CycleSQL by applying it to seven existing translation models on five widely used benchmarks. The results show that 1) the feedback loop introduced in CycleSQL can consistently improve the performance of existing models, and in particular, by applying CycleSQL to RESDSQL, obtains a translation accuracy of 82.0% (+2.6%) on the validation set, and 81.6% (+3.2%) on the test set of Spider benchmark; 2) the generated NL explanations can also provide insightful information for users, aiding in the comprehension of translation results and consequently enhancing the interpretability of NL2SQL translation.

View on arXivView PDF

Code Implementations(1)

Kaimary/CycleSQLCommunity100%
Apache-2.0

ICDE 2025 Paper, Grounding Natural Language to SQL Translation with Data-Based Self-Explanations

172Shell, PythonJan 3, 20241 years agoApache-2.0
data-provenancefeedback-loopnatural-language-interfaceself-explanationstext-to-sql

Similar Papers

Cite this paper

@article{fan2024grounding,
  title  = {Grounding Natural Language to SQL Translation with Data-Based Self-Explanations},
  author = {Yuankai Fan and Tonghui Ren and Can Huang and Zhenying He and X. Sean Wang},
  year   = {2024},
  eprint = {2411.02948},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.02948v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.02948.svg)](https://codeofpaper.com/paper/2411.02948)

Discussion