Papers › FlexSQL: Flexible Exploration and Execution Make Better Text-to-SQL Agents

FlexSQL: Flexible Exploration and Execution Make Better Text-to-SQL Agents

4 May 2026arXiv:2605.02815added by Syntology

Quang Hieu Pham, Yang He, Ping Nie, Canwen Xu, Davood Rafiei, Yuepeng Wang, Xi Ye, Jocelyn Qiaochu Chen

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Text-to-SQL over large analytical databases requires navigating complex schemas, resolving ambiguous queries, and grounding decisions in actual data. Most current systems follow a fixed pipeline where schema elements are retrieved once upfront and the database is only revisited for post-hoc repair, limiting recovery from early mistakes. We present FlexSQL, a text-to-SQL agent whose core design principle is flexible database interaction: the agent can explore schema structure, inspect data values, and run verification queries at any point during reasoning. FlexSQL generates diverse execution plans to cover multiple query interpretations, implements each plan in either SQL or Python depending on the task, and uses a two-tiered repair mechanism that can backtrack from code-level errors to plan-level revisions. On Spider2-Snow, using gpt-oss-120b, FlexSQL achieves a 65.4% score, outperforming strong open-source baselines that use stronger, larger models such as gpt-o3 and DeepSeek-R1. When integrated into a general-purpose coding agent (as skills in Claude Code), our approach yields over 10% relative improvement on Spider2-Snow. Further analysis shows that flexible exploration and flexible execution jointly contribute to the effectiveness of our approach, highlighting flexibility as a key design principle. Our code is available at: https://github.com/StringNLPLAB/FlexSQL

PaperPDFCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

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="2605.02815")

Code

Syntology Ran 10 of 13 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · honoured contract; 9 ran · our draft was wrong.

By repository: found in paper text by Syntology: 13 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

StringNLPLAB/FlexSQL found in paper text by Syntology report

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

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

1ran · honoured contract
9ran · our draft was wrong
3unverified

Licence: 13 of the 13 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 StringNLPLAB/FlexSQL. “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.

_get_table_overview_str StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · 4ef61e098f5d60f5 · report
_parse_plan_candidates StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · 0fc76891da04e4c3 · report
_revise_plans_with_invalid_tables StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · d410095619068f37 · report
check_json_structure StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · dad5543700af9460 · report
extract_all_blocks StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · honoured contract no licence file found · pointer only · 41bd9ffcd8abc270 · report
extract_json_from_text StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · d4d75181a4cb0cfb · report
get_db_id StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · a7f24773e28eaab3 · report
get_question_str StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · 081caf427ea760f5 · report
load_table_similarities StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · db843b4aebb143e3 · report
match_table_name_flexible StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology ran · our draft was wrong no licence file found · pointer only · bb85c39aaf8da193 · report
BaseChat StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology unverified no licence file found · pointer only · d776a01edd7a0dbe · report
Chat StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology unverified no licence file found · pointer only · 8bdf1845842d90ce · report
planning_batch_generate StringNLPLAB/FlexSQL/src/planning.py found in paper text by Syntology unverified no licence file found · pointer only · 574b38a4223b9bc4 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2605.02815, was issued in May 2026, after that date, so the archive has no leaderboard rows for it.

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