arXiv:2605.09295cs.CL2026-05被引 1

通过分层自适应细化搜索,提升复杂SQL生成的准确性。

LEAF-SQL: Level-wise Exploration with Adaptive Fine-graining for Text-to-SQL Skeleton Prediction

论文配图:LEAF-SQL: Level-wise Exploration with Adaptive Fine-graining for Text-to-SQL Skeleton Prediction
图 1 · 摘自论文原文
  • 将SQL骨架预测重构为由粗到细的树搜索过程
  • 在BIRD测试集上达71.6%执行准确率,优于现有方法
  • 适合需要处理复杂多层逻辑查询的研究与应用

Text-to-SQL 将自然语言问题转化为可执行的 SQL 查询,使非专家也能轻松访问数据库。尽管大型语言模型通过提示工程在 Text-to-SQL 任务上表现优异,但在涉及深层嵌套逻辑或多个子句的复杂查询上仍存在困难。现有方法常使用 SQL 骨架——查询逻辑的中间表示——来简化生成过程,但受限于单一结构假设且缺乏渐进式推理能力。为此,我们提出 LEAF-SQL,一种将骨架预测重新建模为由粗到细的树搜索框架的新方法。LEAF-SQL 通过系统探索多种结构假设并实现自适应细化,显著提升生成质量。核心技术包括:(1) 三级骨架层次结构引导搜索,(2) 骨架构型代理生成多样化候选,(3) 骨架评估代理高效剪枝搜索空间。该设计产出兼具结构多样性与粒度自适应性的骨架候选,为后续 SQL 生成奠定更强基础。大量实验表明,LEAF-SQL 能持续提升多种 LLM 后端性能。在具有挑战性的 BIRD 基准官方隐藏测试集上,本方法达到 71.6% 的执行准确率,超越领先的基于搜索和骨架的方法,验证了其对复杂查询的有效性。

原文摘要 · Abstract (English)

Text-to-SQL translates natural language questions into executable SQL queries, enabling intuitive database access for non-experts. While large language models achieve strong performance on Text-to-SQL with prompting, they still struggle with complex queries that involve deeply nested logic or multiple clauses. A widely used approach employs SQL skeletons--intermediate representations of query logic--to streamline generation, but existing methods are limited by their reliance on a single structural hypothesis and lack of progressive reasoning. To overcome these limitations, we propose LEAF-SQL, a novel framework that reframes skeleton prediction as a coarse-to-fine tree search process. LEAF-SQL enables systematic exploration of diverse structural hypotheses with adaptive refinement. Several key techniques are employed in LEAF-SQL: (1) a three-level skeleton hierarchy to guide the search, (2) a Skeleton Formulation Agent to generate diverse candidates, and (3) a Skeleton Evaluation Agent to efficiently prune the search space. This integrated design yields skeleton candidates that are both structurally diverse and granularity-adaptive, providing a stronger foundation for the SQL generation. Extensive experiments show that LEAF-SQL consistently improves the performance of various LLM backbones. On the official hidden test set of the challenging BIRD benchmark, our method achieves 71.6 execution accuracy, which outperforms leading search-based and skeleton-based methods, affirming its effectiveness for complex queries.

Text-to-SQL骨架预测大模型生成优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。