Seq2SQL: Generating Structured Queries From Natural Language Using Reinforcement Learning Download PDF

15 Feb 2018 (modified: 22 Oct 2023)ICLR 2018 Conference Blind SubmissionReaders: Everyone
Abstract: Relational databases store a significant amount of the worlds data. However, accessing this data currently requires users to understand a query language such as SQL. We propose Seq2SQL, a deep neural network for translating natural language questions to corresponding SQL queries. Our model uses rewards from in the loop query execution over the database to learn a policy to generate the query, which contains unordered parts that are less suitable for optimization via cross entropy loss. Moreover, Seq2SQL leverages the structure of SQL to prune the space of generated queries and significantly simplify the generation problem. In addition to the model, we release WikiSQL, a dataset of 80654 hand-annotated examples of questions and SQL queries distributed across 24241 tables fromWikipedia that is an order of magnitude larger than comparable datasets. By applying policy based reinforcement learning with a query execution environment to WikiSQL, Seq2SQL outperforms a state-of-the-art semantic parser, improving execution accuracy from 35.9% to 59.4% and logical form accuracy from 23.4% to 48.3%.
TL;DR: We introduce Seq2SQL, which translates questions to SQL queries using rewards from online query execution, and WikiSQL, a SQL table/question/query dataset orders of magnitude larger than existing datasets.
Keywords: deep learning, reinforcement learning, dataset, natural language processing, natural language interface, sql
Code: [![github](/images/github_icon.svg) salesforce/WikiSQL](https://github.com/salesforce/WikiSQL) + [![Papers with Code](/images/pwc_icon.svg) 13 community implementations](https://paperswithcode.com/paper/?openreview=Syx6bz-Ab)
Data: [WikiSQL](https://paperswithcode.com/dataset/wikisql), [WikiTableQuestions](https://paperswithcode.com/dataset/wikitablequestions)
Community Implementations: [![CatalyzeX](/images/catalyzex_icon.svg) 14 code implementations](https://www.catalyzex.com/paper/arxiv:1709.00103/code)
15 Replies

Loading