AI Agents 相关度: 9/10

AV-SQL: Decomposing Complex Text-to-SQL Queries with Agentic Views

Minh Tam Pham, Trinh Pham, Tong Chen, Hongzhi Yin, Quoc Viet Hung Nguyen, Thanh Tam Nguyen
arXiv: 2604.07041v1 发布: 2026-04-08 更新: 2026-04-08

AI 摘要

AV-SQL通过分解复杂Text-to-SQL查询为多步骤Agent流程,提升了在复杂数据库上的执行准确率。

主要贡献

  • 提出了Agentic Views的概念,用于封装中间查询逻辑
  • 设计了一个多Agent框架,包括重写、视图生成和查询规划/生成/修订
  • 在Spider 2.0上取得了显著的性能提升

方法论

使用LLM Agents将Text-to-SQL任务分解为多个阶段,每个阶段由专门的Agent负责,通过Agentic Views连接。

原文摘要

Text-to-SQL is the task of translating natural language queries into executable SQL for a given database, enabling non-expert users to access structured data without writing SQL manually. Despite rapid advances driven by large language models (LLMs), existing approaches still struggle with complex queries in real-world settings, where database schemas are large and questions require multi-step reasoning over many interrelated tables. In such cases, providing the full schema often exceeds the context window, while one-shot generation frequently produces non-executable SQL due to syntax errors and incorrect schema linking. To address these challenges, we introduce AV-SQL, a framework that decomposes complex Text-to-SQL into a pipeline of specialized LLM agents. Central to AV-SQL is the concept of agentic views: agent-generated Common Table Expressions (CTEs) that encapsulate intermediate query logic and filter relevant schema elements from large schemas. AV-SQL operates in three stages: (1) a rewriter agent compresses and clarifies the input query; (2) a view generator agent processes schema chunks to produce agentic views; and (3) a planner, generator, and revisor agent collaboratively compose these views into the final SQL query. Extensive experiments show that AV-SQL achieves 70.38% execution accuracy on the challenging Spider 2.0 benchmark, outperforming state-of-the-art baselines, while remaining competitive on standard datasets with 85.59% on Spider, 72.16% on BIRD and 63.78% on KaggleDBQA. Our source code is available at https://github.com/pminhtam/AV-SQL.

标签

Text-to-SQL Large Language Models Agent Database

arXiv 分类

cs.DB cs.AI cs.ET cs.HC cs.IR