APEX-SQL: 通过智能体探索与数据对话实现Text-to-SQL
APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQL
AI总结:
提出APEX-SQL框架,通过假设验证循环、逻辑规划、双路径剪枝、并行数据分析和确定性探索机制,解决静态模式表示在复杂企业数据库中的语义模糊和扩展性问题,在BIRD和Spider 2.0-Snow上取得领先性能。
摘要:
由大型语言模型驱动的Text-to-SQL系统在学术基准测试中表现出色,但在复杂的企业环境中却难以应对。主要限制在于它们依赖静态模式表示,这无法解决语义模糊性,也无法有效扩展到大型复杂数据库。为了解决这个问题,我们提出了APEX-SQL,一个智能体Text-to-SQL框架,它将范式从被动翻译转变为智能体探索。我们的框架采用假设验证循环,将模型推理基于真实数据。在模式链接阶段,我们使用逻辑规划来表述假设,双路径剪枝来减少搜索空间,并行数据分析来验证列角色与真实数据的关系,然后进行全局合成以确保拓扑连通性。对于SQL生成,我们引入了一种确定性机制来检索探索指令,使智能体能够有效地探索数据分布、细化假设并生成语义准确的SQL。在BIRD(执行准确率70.65%)和Spider 2.0-Snow(执行准确率51.01%)上的实验表明,APEX-SQL在减少token消耗的同时优于竞争基线。进一步的分析表明,智能体探索作为性能倍增器,释放了基础模型在企业环境中的潜在推理能力。消融研究证实了每个组件在确保稳健和准确数据分析中的关键贡献。我们的代码发布在https://github.com/Tencent/APEX-SQL-Project。
英文摘要:
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. 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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。