APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQL

Bowen Cao, Weibin Liao, Yushi Sun, Dong Fang, Haitao Li +1 more
2/11/2026
10 citations
cs.DBcs.AI

Official code: Tencent/APEX-SQL-Project (20 stars, Python, last commit 2026-05-18).

Abstract

Text-to-SQL systems powered by Large Language Models have excelled on academic benchmarks but struggle in complex enterprise environments. The primary limitation lies in their reliance on static schema representations, which fails to resolve semantic ambiguity and scale effectively to large, complex databases.

Show full abstract

To address this, we propose APEX-SQL, an Agentic Text-to-SQL Framework that shifts the paradigm from passive translation to agentic exploration. Our framework employs a hypothesis-verification loop to ground model reasoning in real data. In the schema linking phase, we use logical planning to verbalize hypotheses, dual-pathway pruning to reduce the search space, and parallel data profiling to validate column roles against real data, followed by global synthesis to ensure topological connectivity. For SQL generation, we introduce a deterministic mechanism to retrieve exploration directives, allowing the agent to effectively explore data distributions, refine hypotheses, and generate semantically accurate SQLs. Experiments on BIRD (70.65% execution accuracy) and Spider 2.0-Snow (51.01% execution accuracy) demonstrate that APEX-SQL outperforms competitive baselines with reduced token consumption. Further analysis reveals that agentic exploration acts as a performance multiplier, unlocking the latent reasoning potential of foundation models in enterprise settings. Ablation studies confirm the critical contributions of each component in ensuring robust and accurate data analysis. Our code is released at https://github.com/Tencent/APEX-SQL-Project.

View on arXivView PDF

Code Implementations(1)

APEX-SQL is an agentic Text-to-SQL framework that shifts the paradigm from passive schema perception to agentic exploration.

205PythonMay 18, 20266 months ago
aiai-agentstext-to-sql

Similar Papers

Cite this paper

@article{cao2026apexsql,
  title  = {APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQL},
  author = {Bowen Cao and Weibin Liao and Yushi Sun and Dong Fang and Haitao Li and Wai Lam},
  year   = {2026},
  eprint = {2602.16720},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.16720v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2602.16720.svg)](https://codeofpaper.com/paper/2602.16720)

Discussion