Papers › PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency

PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency

13 Mar 2024arXiv:2403.09732archive 2025-07-28

Zhishuai Li, Xiang Wang, Jingjing Zhao, Sun Yang, Guoqing Du, Xiaoru Hu, Bin Zhang, Yuxiao Ye, Ziyue Li, Rui Zhao, Hangyu Mao

Recent advancements in Text-to-SQL (Text2SQL) emphasize stimulating the large language models (LLM) on in-context learning, achieving significant results. Nevertheless, they face challenges when dealing with verbose database information and complex user intentions. This paper presents a two-stage framework to enhance the performance of current LLM-based natural language to SQL systems. We first introduce a novel prompt representation, called reference-enhanced representation, which includes schema information and randomly sampled cell values from tables to instruct LLMs in generating SQL queries. Then, in the first stage, question-SQL pairs are retrieved as few-shot demonstrations, prompting the LLM to generate a preliminary SQL (PreSQL). After that, the mentioned entities in PreSQL are parsed to conduct schema linking, which can significantly compact the useful information. In the second stage, with the linked schema, we simplify the prompt's schema information and instruct the LLM to produce the final SQL. Finally, as the post-refinement module, we propose using cross-consistency across different LLMs rather than self-consistency within a particular LLM. Our methods achieve new SOTA results on the Spider benchmark, with an execution accuracy of 87.6%.

PaperPDFCodeCode Syntology ran

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

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2403.09732")

Code

Syntology Ran 6 of 9 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 6 ran with no contract checked.

By repository: official repository: 9 samples from 1 repository, 6 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

zhshlii/petsql officialmentioned in paper 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.

Code Syntology ran Syntology

9 samples harvested; 6 ran; 0 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

6ran
3unverified

Licence: 9 of the 9 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from zhshlii/petsql. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

add_fk zhshlii/petsql/src/sources/data_preprocess.py official repository ran no licence file found · pointer only · 2df2345e37499e87 · report
extract_sql_from_text zhshlii/petsql/src/sources/post_process.py official repository ran fingerprinted no licence file found · pointer only · a9a626332f19ef82 · report
jaccard_similarity zhshlii/petsql/src/sources/sql_gen/sql_gen_utils.py official repository ran fingerprinted no licence file found · pointer only · a1579e74824be11f · report
match_shift zhshlii/petsql/src/sources/sql_gen/sql_gen_utils.py official repository ran no licence file found · pointer only · 6a69173ee0ca1628 · report
parallel_call zhshlii/petsql/src/sources/llms/codellama.py official repository ran no licence file found · pointer only · a449070528b531b5 · report
process_duplication zhshlii/petsql/src/sources/post_process.py official repository ran fingerprinted no licence file found · pointer only · e479cb4ded98503f · report
gen_ppl_from_json zhshlii/petsql/src/sources/data_preprocess.py official repository unverified no licence file found · pointer only · 9ffa3fa74322b44b · report
mask_question_with_schema_linking zhshlii/petsql/src/sources/sql_gen/sql_gen_utils.py official repository unverified no licence file found · pointer only · 8ece35cab7884b63 · report
parallel_call zhshlii/petsql/src/sources/llms/llama2.py official repository unverified no licence file found · pointer only · 09f737d9dfa539d6 · report

Tasks

In-Context LearningText to SQLText-To-SQL

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Text-To-SQL spider PET-SQL Exact Match Accuracy (Test) 66.6 #2 of 20 Archive leaderboard report
Text-To-SQL spider PET-SQL Execution Accuracy (Test) 87.6 #2 of 20 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