Papers › Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning

Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning

31 Aug 2017ICLR 2018 1arXiv:1709.00103archive 2025-07-28

Victor Zhong, Caiming Xiong, Richard Socher

A significant amount of the world's knowledge is stored in relational databases. However, the ability for users to retrieve facts from a database is limited due to a lack of understanding of query languages such as SQL. We propose Seq2SQL, a deep neural network for translating natural language questions to corresponding SQL queries. Our model leverages the structure of SQL queries to significantly reduce the output space of generated queries. Moreover, we use rewards from in-the-loop query execution over the database to learn a policy to generate unordered parts of the query, which we show are less suitable for optimization via cross entropy loss. In addition, we will publish WikiSQL, a dataset of 80654 hand-annotated examples of questions and SQL queries distributed across 24241 tables from Wikipedia. This dataset is required to train our model and is an order of magnitude larger than comparable datasets. By applying policy-based reinforcement learning with a query execution environment to WikiSQL, our model Seq2SQL outperforms attentional sequence to sequence models, improving execution accuracy from 35.9% to 59.4% and logical form accuracy from 23.4% to 48.3%.

PaperPDFConference PDFCode

In Syntology View this paper on Syntology, its page in Syntology's graph. That page lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

15 repositories listed; official and paper-mentioned ones first.

salesforce/WikiSQL officialmentioned in papermentioned on GitHubBSD-3-ClauseSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to SeaD: End-to-end Text-to-SQL Generation with Schema-aware Denoising (arXiv:2105.07911; that paper's own run record: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report
Baidi96/text2sql mentioned on GitHubpytorchBSD-3-ClauseSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning (arXiv:1711.04436; that paper's own run record: 11 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 1 honoured, 0 violated, 7 with no contract checked; 3 where Syntology's instrument failed) · 8 unverified); nothing checks that they implement this paper's method. report
CX000/sqlnet_inference_py36 mentioned on GitHubpytorchBSD-3-ClauseSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning (arXiv:1711.04436; that paper's own run record: 11 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 1 honoured, 0 violated, 7 with no contract checked; 3 where Syntology's instrument failed) · 8 unverified); nothing checks that they implement this paper's method. report
PriyankaDatar/NLP_Project_Modfications mentioned on GitHubpytorchBSD-3-ClauseSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning (arXiv:1711.04436; that paper's own run record: 11 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 1 honoured, 0 violated, 7 with no contract checked; 3 where Syntology's instrument failed) · 8 unverified); nothing checks that they implement this paper's method. report
PriyankaDatar/NLP_SQL_Project mentioned on GitHubpytorchBSD-3-ClauseSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning (arXiv:1711.04436; that paper's own run record: 11 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 1 honoured, 0 violated, 7 with no contract checked; 3 where Syntology's instrument failed) · 8 unverified); nothing checks that they implement this paper's method. report
abhishekchugh17/sql12 mentioned on GitHubpytorchBSD-3-ClauseSyntology: not harvested report
ist-daslab/rosa mentioned on GitHubpytorchApache-2.0Syntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to RoSA: Accurate Parameter-Efficient Fine-Tuning via Robust Adaptation (arXiv:2401.04679; that paper's own run record: 6 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 1 violated, 3 with no contract checked; 1 where Syntology's instrument failed) · 3 unverified); nothing checks that they implement this paper's method. report
kasnerz/tabgenie mentioned on GitHubMITSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to TabGenie: A Toolkit for Table-to-Text Generation (arXiv:2302.14169; that paper's own run record: 3 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report
kh-mo/QA_wikisql mentioned on GitHubSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Neural Machine Translation of Rare Words with Subword Units (arXiv:1508.07909; that paper's own run record: 21 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 0 violated, 1 with no contract checked; 20 where Syntology's instrument failed) · 9 unverified); nothing checks that they implement this paper's method. report
llSourcell/SQL_Database_Optimization mentioned on GitHubpytorchBSD-3-ClauseSyntology: not harvested report
openbotai/nl2sql mentioned on GitHubnot reachable when probed 2026-09-17 — repositories for recent papers often appear after camera-readySyntology: not harvested report
racheljose21/chatbot mentioned on GitHubpytorchBSD-3-ClauseSyntology: not harvested report
tiwarikajal/Seq2SQL- mentioned on GitHubpytorchSyntology: not harvested report
wronnyhuang/SQLNet_inference mentioned on GitHubpytorchBSD-3-ClauseSyntology: not harvested report
xiaojunxu/SQLNet mentioned on GitHubpytorchBSD-3-ClauseSyntology: not harvested report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Reinforcement LearningReinforcement Learning (RL)Text-To-SQLreinforcement-learning

Datasets

Introduced by this paper, per the archive.

WikiSQL

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Code Generation WikiSQL Seq2SQL (Zhong et al., 2017) Exact Match Accuracy 48.3 #9 of 10 Archive leaderboard report
Code Generation WikiSQL Seq2SQL (Zhong et al., 2017) Execution Accuracy 59.4 #9 of 10 Archive leaderboard report
Code Generation WikiSQL Seq2Seq (Zhong et al., 2017) Exact Match Accuracy 23.4 #10 of 10 Archive leaderboard report
Code Generation WikiSQL Seq2Seq (Zhong et al., 2017) Execution Accuracy 35.9 #10 of 10 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections