Introduction
Translating natural language questions into functional SQL queries (NL2SQL) is a cornerstone of modern data accessibility. Current state-of-the-art systems typically utilize Transformer-based models such as BART or T5. However, these models are constrained by a standard input limit of 512 tokens. In NL2SQL tasks, the user's question is concatenated with the entire database schema—including all table and column names. For large, complex databases, this schema can easily exceed the token limit, causing the model to lose critical information and fail the translation.
Methodology
To overcome these architectural limitations and improve the model's focus, this research proposes two primary techniques: Database Schema Pruning and Multilingual Data Augmentation.
Database Schema Pruning
The authors identified that many database schemas contain redundant information for specific queries. By analyzing training data, they developed the "FIT" dataset, where schemas were manually pruned to include only the tables and columns necessary for the query. This ensures the input remains within the 512-token threshold, preventing information loss.
Multilingual Data Augmentation
Using mT5-large, the researchers expanded the English Spider dataset into a "Quad" dataset by translating it into Portuguese, Spanish, and French. Training on this multilingual corpus acts as a powerful regularizer, forcing the model to learn the underlying logic of SQL across diverse linguistic structures, which improves generalization even for English-only inference.
Experimental Setup and Datasets
The study evaluated performance using three key datasets:
- Spider: The industry-standard cross-domain semantic parsing benchmark.
- Quad Dataset: A multilingual version of Spider totaling 34,636 training examples.
- FIT Dataset: A version of Spider where complex schemas (such as the 353-column
Baseball_1database) were pruned to fit the 512-token limit.
Results and Discussion
The integration of multilingual training and schema pruning led to a significant boost in Exact Set Match (ESM) accuracy on the Spider validation set.
As illustrated in the results, while a monolingual mT5-large (0.684) initially lagged behind the BART-based baseline (0.718), the multilingual "Quad" approach (0.715) nearly matched it. The final addition of schema pruning allowed the model to reach a peak accuracy of 0.736.
The "Sparse Attention" Trap
A key finding was that simply increasing the token limit to 2048 tokens actually decreased performance to 0.697. The authors suggest that longer sequences lead to "diluted" self-attention, where the model struggles to identify relevant columns amidst excessive noise. Pruning effectively concentrates the model's attention on the "signal."
Conclusion and Future Work
This research demonstrates that "less is more" when it comes to input sequences for NL2SQL. By pruning schemas and leveraging multilingual data, models can achieve higher accuracy within standard token limits. Future work will focus on developing automated inference-time pruning to apply these benefits to real-world scenarios where the required columns are not known in advance.
Summary updated