LearNAT: Learning NL2SQL with AST-guided Task Decomposition for Large Language Models
作者: Weibin Liao, Xin Gao, Tianyu Jia, Rihong Qiu, Yifan Zhu, Yang Lin, Xinyu Ma, Junfeng Zhao, Yasha Wang
分类: cs.CL
发布日期: 2026-07-05
💡 一句话要点
提出LearNAT以解决NL2SQL中的任务分解问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 自然语言处理 SQL生成 任务分解 强化学习 大语言模型
📋 核心要点
- 现有方法在NL2SQL中面临开放性和可重复性不足,以及测试时计算成本高等挑战。
- 本文提出LearNAT框架,通过AST引导的搜索和边际感知强化学习来增强LLM的任务分解能力。
- 实验结果表明,LearNAT显著提升了小规模LLM的性能,达到与GPT-4相似的效果。
📝 摘要(中文)
自然语言到SQL(NL2SQL)旨在将自然语言查询转换为可执行的SQL语句,使非专业用户能够直观地访问数据库。尽管近期利用大型私有LLM(如GPT-4)的方法已取得了最先进的成果,但仍面临开放性和可重复性不足、测试时计算成本高等关键挑战。为了解决这些问题,本文探索在资源受限的环境下提升小规模公共LLM在NL2SQL中的性能。实验结果表明,任务分解有助于提升NL2SQL性能,但LLM有效分解查询的难度仍然存在。基于此,本文提出了LearNAT框架,旨在增强LLM的分解能力。LearNAT引入了AST引导的分解合成过程和边际感知强化学习,显著提升了小规模LLM的性能,结果显示其表现可与仅有7B参数的GPT-4相媲美。
🔬 方法详解
问题定义:本文旨在解决NL2SQL任务中,现有方法在开放性和可重复性方面的不足,以及小规模LLM在查询分解能力上的局限性。
核心思路:LearNAT框架通过引入AST引导的分解合成过程,结合边际感知强化学习,旨在提升LLM的任务分解能力,从而改善NL2SQL的性能。
技术框架:该框架主要包括两个模块:1) 分解合成过程,利用AST引导的搜索和剪枝策略生成可验证的高效分解;2) 边际感知强化学习,进行多步推理的细粒度偏好优化。
关键创新:LearNAT的核心创新在于其AST引导的分解合成过程和边际感知强化学习,这与现有方法的单一优化策略有本质区别,能够更有效地处理复杂查询。
关键设计:在设计中,采用了特定的剪枝策略以提高分解效率,并通过细粒度的偏好优化来增强多步推理能力,确保生成的SQL语句的可执行性和准确性。
🖼️ 关键图片
📊 实验亮点
在基准数据集上的实验结果显示,LearNAT显著提升了小规模LLM的性能,达到与仅有7B参数的GPT-4相当的效果。这一成果验证了可验证分解和细粒度偏好学习在NL2SQL中的有效性,推动了该领域的开放性和透明性。
🎯 应用场景
LearNAT框架在数据库查询生成、智能问答系统和数据分析等领域具有广泛的应用潜力。通过提升NL2SQL的性能,非专业用户可以更方便地与数据库交互,推动数据驱动决策的普及。未来,该技术可能在商业智能、教育和科研等多个领域产生深远影响。
📄 摘要(原文)
Natural Language to SQL (NL2SQL) aims to translate natural language queries into executable SQL statements, offering non-expert users intuitive access to databases. While recent approaches leveraging large-scale private LLMs such as GPT-4 have achieved state-of-the-art results, they face two critical challenges: the lack of openness and reproducibility, and the prohibitive computational cost of test-time scaling. To address these issues, we explore improving the model-level performance of small-scale public LLMs in NL2SQL under resource-constrained settings. Our exploratory experiments reveal the potential of task decomposition for enhancing NL2SQL performance, but also highlight the difficulty of enabling LLMs to decompose queries effectively. Motivated by these findings, we propose LearNAT, a novel framework designed to enhance decomposition capabilities of LLM. LearNAT introduces (1) a Decomposition Synthesis Procedure, which leverages AST-guided search with pruning strategies to generate verifiable and efficient decompositions, and (2) Margin-Aware Reinforcement Learning, which provides fine-grained preference optimization for multi-step reasoning beyond standard DPO. Extensive experiments on benchmark datasets demonstrate that LearNAT significantly improves the performance of small-scale LLMs, achieving results comparable to GPT-4 with only a 7B parameter model. These results validate the effectiveness of verifiable decomposition and fine-grained preference learning in advancing NL2SQL towards openness, transparency, and efficiency. Our code is publicly available atthis https URL.