{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/seq2sql-generating-structured-queries-from","title":"Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning","arxiv_id":"1709.00103","date":"2017-08-31","proceeding":"ICLR 2018 1","authors":["Victor Zhong","Caiming Xiong","Richard Socher"],"abstract":"A significant amount of the world's knowledge is stored in relational\ndatabases. However, the ability for users to retrieve facts from a database is\nlimited due to a lack of understanding of query languages such as SQL. We\npropose Seq2SQL, a deep neural network for translating natural language\nquestions to corresponding SQL queries. Our model leverages the structure of\nSQL queries to significantly reduce the output space of generated queries.\nMoreover, we use rewards from in-the-loop query execution over the database to\nlearn a policy to generate unordered parts of the query, which we show are less\nsuitable for optimization via cross entropy loss. In addition, we will publish\nWikiSQL, a dataset of 80654 hand-annotated examples of questions and SQL\nqueries distributed across 24241 tables from Wikipedia. This dataset is\nrequired to train our model and is an order of magnitude larger than comparable\ndatasets. By applying policy-based reinforcement learning with a query\nexecution environment to WikiSQL, our model Seq2SQL outperforms attentional\nsequence to sequence models, improving execution accuracy from 35.9% to 59.4%\nand logical form accuracy from 23.4% to 48.3%.","url_abs":"http://arxiv.org/abs/1709.00103v7","url_pdf":"http://arxiv.org/pdf/1709.00103v7.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/salesforce/WikiSQL","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/Baidi96/text2sql","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/CX000/sqlnet_inference_py36","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/PriyankaDatar/NLP_Project_Modfications","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/PriyankaDatar/NLP_SQL_Project","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/abhishekchugh17/sql12","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/ist-daslab/rosa","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/kasnerz/tabgenie","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/kh-mo/QA_wikisql","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/llSourcell/SQL_Database_Optimization","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/openbotai/nl2sql","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/racheljose21/chatbot","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/tiwarikajal/Seq2SQL-","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/wronnyhuang/SQLNet_inference","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"seq2sql-generating-structured-queries-from","repo_url":"https://github.com/xiaojunxu/SQLNet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"reinforcement-learning","task_name":"Reinforcement Learning"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"text-to-sql","task_name":"Text-To-SQL"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[],"datasets_introduced":[{"slug":"wikisql","name":"WikiSQL","full_name":"WikiSQL"}],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-generation-on-wikisql","task":"Code Generation","dataset":"WikiSQL","model":"Seq2SQL (Zhong et al., 2017)","rank_in_archive_order":9,"of":10,"metrics":{"Exact Match Accuracy":"48.3","Execution Accuracy":"59.4"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-wikisql","task":"Code Generation","dataset":"WikiSQL","model":"Seq2Seq (Zhong et al., 2017)","rank_in_archive_order":10,"of":10,"metrics":{"Exact Match Accuracy":"23.4","Execution Accuracy":"35.9"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1709.00103","mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}