Enhancing NL2SQL Conversion: Addressing Schema and Temporal Challenges with a Hierarchical Tree Structure
Yichen Ren · Applied and Computational Engineering · 2025
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.