Abstract & Overview
Converting natural language queries into executable SQL statements commonly termed NL2SQL remains a fundamental challenge in the intersection of natural language processing and database systems. While transformer-based models have considerably advanced this field, three persistent bottlenecks continue to limit real-world deployment: (i) poor generalisation across unseen database schemas, (ii) inability to handle complex nested sub-queries and multi-table joins, and (iii) fragile schema linking under ambiguous user phrasing. This paper proposes HierSQL, a Hierarchical Schema-Aware Encoder–Decoder framework that addresses these limitations through three synergistic components: a dual-channel schema encoder that fuses column-level and table-level representations via cross-attention, a graph-augmented SQL decoder that leverages foreign-key relationships encoded as a heterogeneous relational graph, and a curriculum-guided multi-dataset training strategy that jointly trains on four complementary benchmarks. We evaluate HierSQL on BIRD NeurIPS'23, KaggleDBQA, SEDE (Stack Exchange Data Explorer), and ATIS, achieving execution accuracy of 72.4%, 48.3%, 61.7%, and 86.2% respectively, outperforming all supervised fine-tuning baselines and matching or exceeding prompt-based LLM approaches at a fraction of the inference cost. Our ablation study confirms the additive benefit of each module.