Research Article

Enhancing NL2SQL Conversion: Addressing Schema and Temporal Challenges with a Hierarchical Tree Structure

Yichen Ren*
Department of Computer Science and Engineering, The Hong Kong University of Science and Technology, Hong Kong, China

* Corresponding author: [email protected]

Abstract

This paper dives deeper into the field of Natural Language to Structured Query Language conversion (NL2SQL). Using the widely accepted NL2SQL agent provided with the Spider-2 dataset, it aims to identify basic and common issues present in most NL2SQL agents. Specifically, it evaluates the performance of the original Spider-2 agent and the Spider-2 + DIN-SQL model on the Spider-2 Snow dataset. Out of the 547 results, the thesis manually examines a subset with a statistically significant sample size. The results reveal that current models struggle to understand semi-structured variable names, such as column names in schemas and table names. The performance is abysmal in the absence of relevant illustrative files. Even when such files are available, the agent often fails to correctly interpret the meaning of file names, leading to the selection of incorrect files or tables that hold the data. This study also proposes potential directions for improvement, particularly in cases where file or table names involve temporal elements, such as dates or times. Based on experiments, the thesis believes incorporating a hierarchical tree structure could offer a promising solution.

Keywords: NL2SQL; Spider-2; Natural Language; Hierarchical Tree Structure
Published: May 30, 2025
DOI: 10.54254/2755-2721/2025.PO23472
Volume: ACE Vol.157
pp. 13-19
Download PDF

References

  1. Liu, X., Shen, S., Li, B., Ma, P., Jiang, R., Luo, Y., Zhang, Y., Fan, J., Li, G., & Tang, N. (2024). A Survey of NL2SQL with Large Language Models: Where are we, and where are we going? ArXiv print, 5109.
  2. Katsogiannis-Meimarakis, G., & Koutrika, G. (2021). A Deep Dive into Deep Learning Approaches for Text-to-SQL Systems, 2846-2851.
  3. Jha, D., Ward, L., Yang, Z., et al. (2019). IRNet: A general purpose deep residual regression framework for materials discovery. Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2385-2393.
  4. Gao, D., Wang, H., Li, Y., Sun, X., Qian, Y., Ding, B., & Zhou, J. (2023). Text-to-SQL Empowered by Large Language Models: A Bench- mark Evaluation. ArXiv print, 15363.
  5. Zhong, V., Xiong, C., & Socher, R. (2017). Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning. ArXiv print, 103.
  6. Yu, T., Zhang, R., Yang, K., Yasunaga, M., Wang, D., Li, Z., Ma, J., Li, I., Yao, Q., Roman, S., Zhang, Z., & Radev, D. (2019). Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task. ArXiv print, 8887.
  7. Lei, F., Chen, J., Ye, Y., Cao, R., Shin, D., Su, H., Suo, Z., Gao, H., Hu, W., Yin, P., Zhong, V., Xiong, C., Sun, R., Liu, Q., Wang, S., & Yu, T. (2024). Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows. ArXiv print, 7763.
  8. Archit, P., & Lee, M. (2022). Learning from Few Examples: A Sum-mary of Approaches to Few-Shot Learning. ArXiv print, 4291.
  9. Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., & Zhou, D. (2022). Chain of Thought Prompting Elicits Reasoning in Large Language Models. ArXiv print, 11903.
  10. Pourreza, M., & Rafiei, D. (2023). DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction. Advances in Neural Information Processing Systems, 36, 36339-36348
  11. Shawkat, M., Badawi, M., Elghamrawy, S. M., Reham Arnous, & El-desoky, A. I. (2021). An optimized FP-growth algorithm for discovery of association rules. The Journal of Supercomputing, 78(4), 5479–5506.