Structured Query Language (SQL) is the program language used to manage and query relational databases. Although considerable research has been conducted to converting natural language into SQL (NL2SQL), the reverse task—SQL2NL—has received relativ...
Structured Query Language (SQL) is the program language used to manage and query relational databases. Although considerable research has been conducted to converting natural language into SQL (NL2SQL), the reverse task—SQL2NL—has received relatively little attention. In this study, we research the underexplored SQL2NL problem and examine whether SQL2NL models can be leveraged to improve the performance of NL2SQL task.
We research two SQL2NL ways. One thing is a retrieval-augmented generation (RAG) framework with SQL-to-Vec embedding, which helps retrieve few-shot examples from a vector database. The other is a SQL parsing rule-based method that converts SQL into natural language through predefined SQL parsing rule. And our study focuses on how SQL2NL can be integrated into the fine-tuning process of NL2SQL models to improve their overall task accuracy.
Experiments are conducted on two representative NL2SQL benchmark domains, BIRD and SPIDER. For SQL2NL evaluation, we assess the RAG-Hybrid model using automatic metrics such as BERT Recall and BLEU-4, while the rule-based SQL2NL model is evaluated using an external general-purpose NL2SQL model to measure its effectiveness indirectly. In addition, we perform an experiment on the BIRD dataset to investigate how SQL2NL can support the fine-tuning process of NL2SQL models. Using execution accuracy (EX) as our primary evaluation criterion, we validate the utility of SQL2NL to improve NL2SQL performance, and our findings demonstrate that SQL2NL can serve as an effective auxiliary mechanism for improving NL2SQL performance in domain-specific settings.