FlexSQL: Flexible Exploration and Execution Make Better Text-to-SQL Agents
Not on the map. Why?
Abstract (arXiv)
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
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 38 of its 47 references that are in the map. First posted on arXiv 4 May 2026.
Builds on
38 of 47 references.
References · 38
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,737
- 2025gpt-oss-120b & gpt-oss-20b Model Cardcited by 1,386
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2022Inner Monologue: Embodied Reasoning through Planning with Language Modelscited by 1,081
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 477
- 2023Cognitive Architectures for Language Agentscited by 429
26 more
- 2019RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parserscited by 424
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 385
- 2023InterCode: Standardizing and Benchmarking Interactive Coding with Execution Feedbackcited by 238
- 2024Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflowscited by 232
- 2019Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representationcited by 210
- 2024OS-Copilot: Towards Generalist Computer Agents with Self-Improvementcited by 205
- 2024CodeS: Towards Building Open-source Language Models for Text-to-SQLcited by 187
- 2024CHESS: Contextual Harnessing for Efficient SQL Synthesiscited by 169
- 2023MAC-SQL: A Multi-Agent Collaborative Framework for Text-to-SQLcited by 164
- 2024CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQLcited by 138
- 2024Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQLcited by 120
- 2024MCS-SQL: Leveraging Multiple Prompts and Multiple-Choice Selection For Text-to-SQL Generationcited by 105
- 2025Verbalized Sampling: How to Mitigate Mode Collapse and Unlock LLM Diversitycited by 105
- 2021Natural SQL: Making SQL Easier to Infer from Natural Language Specificationscited by 68
- 2024A Survey of Text-to-SQL in the Era of LLMs: Where are we, and where are we going?cited by 56
- 2026Expanding the Capabilities of Reinforcement Learning via Text Feedbackcited by 53
- 2025XiYan-SQL: A Novel Multi-Generator Framework For Text-to-SQLcited by 40
- 2025Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Searchcited by 34
- 2023Evaluating Cross-Domain Text-to-SQL Models and Benchmarkscited by 32
- 2025DeepEye-SQL: A Software-Engineering-Inspired Text-to-SQL Frameworkcited by 28
- 2023Text-to-SQL Error Correction with Language Models of Codecited by 21
- 2025A Study of LLMs' Preferences for Libraries and Programming Languagescited by 20
- 2024Verified Code Transpilation with LLMscited by 15
- 2025Text-to-SQL as Dual-State Reasoning: Integrating Adaptive Context and Progressive Generationcited by 10
- 2025SpotIt: Evaluating Text-to-SQL Evaluation with Formal Verificationcited by 4
- 2025Pi-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming Languagescited by 3
Built on by
Citing papers per year: 2026: 4.
4 papers.
- 2026A Cost-Aware Agentic Architecture for NL-to-SQL over Nested Enterprise Schemas, with a New Benchmarkcited by 0
- 2026Towards Reliable AI Data Scientists: Data Agents with Workflow Harnessescited by 0
- 2026From Benchmarks to Production: A Text-to-SQL System for Complex Financial Datacited by 0
- 2026HarnessSQL: Harness-Native Training for SQL Agents in Realistic Database Environmentscited by 0
- 2026HarnessSQL: Harness-Native Training for SQL Agents in Realistic Database Environments8 Oct 2026
- 2026From Benchmarks to Production: A Text-to-SQL System for Complex Financial Data2 Oct 2026
- 2026Towards Reliable AI Data Scientists: Data Agents with Workflow Harnesses28 Sep 2026
- 2026A Cost-Aware Agentic Architecture for NL-to-SQL over Nested Enterprise Schemas, with a New Benchmark4 Sep 2026
Similar, not cited
Close in wording, no citation either way
- 2026APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQL
- 2025ReFoRCE: A Text-to-SQL Agent with Self-Refinement, Consensus Enforcement, and Column Exploration
- 2026PExA: Parallel Exploration Agent for Complex Text-to-SQL
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agents
- 2025BAPPA: Benchmarking Agents, Plans, and Pipelines for Automated Text-to-SQL Generation
- 2026Iteration Without Elaboration: A Simple ReAct Architecture Suffices for Text-to-SQL Generation
- 2024Tool-Assisted Agent on SQL Inspection and Refinement in Real-World Scenarios
- 2024SQLFixAgent: Towards Semantic-Accurate Text-to-SQL Parsing via Consistency-Enhanced Multi-Agent Collaboration