In recent years, the task of text-to-SQL translation, which converts natural language questions into executable SQL queries, has gained significant attention for its potential to democratize data access. Despite its promise, challenges such as adapting to unseen databases and aligning natural language with SQL syntax have hindered widespread adoption. To overcome these issues, we introduce SQLformer, a novel Transformer architecture specifically crafted to perform text-to-SQL translation tasks. Our model predicts SQL queries as abstract syntax trees (ASTs) in an autoregressive way, incorporating structural inductive bias in the encoder and decoder layers. This bias, guided by database table and column selection, aids the decoder in generating SQL query ASTs represented as graphs in a Breadth-First Search canonical order. Our experiments demonstrate that SQLformer achieves state-of-the-art performance across six prominent text-to-SQL benchmarks.
翻译:近年来,文本到SQL转换任务——即将自然语言问题转化为可执行的SQL查询——因其在促进数据访问民主化方面的潜力而受到广泛关注。尽管前景广阔,但适应未见数据库以及对齐自然语言与SQL语法等挑战阻碍了其广泛应用。为解决这些问题,我们提出了SQLformer,一种专为执行文本到SQL转换任务而设计的新型Transformer架构。我们的模型以自回归方式将SQL查询预测为抽象语法树(AST),并在编码器和解码器层中融入结构化归纳偏置。这种在数据库表和列选择引导下的偏置,有助于解码器以广度优先搜索规范顺序生成表示为图的SQL查询AST。实验表明,SQLformer在六个主流文本到SQL基准测试中均达到了最先进的性能水平。