arXiv:2509.14507cs.AIcs.CL2025-09EMNLP被引 1

通过精准分解任务与提取关键词,提升自然语言转SQL的准确率。

DeKeyNLU: Enhancing Natural Language to SQL Generation through Task Decomposition and Keyword Extraction

  • 分三步解析用户问题:理解、实体检索、生成SQL
  • 在BIRD和Spider数据集上准确率分别提升至69.10%和88.7%
  • 适合需要高精度数据库查询的非技术用户或系统开发者

自然语言转SQL(NL2SQL)为非技术人员提供了便捷的数据库访问方式。尽管近期结合检索增强生成(RAG)与思维链(CoT)推理的方法已显著提升性能,但大模型在任务分解和关键词提取上的不准确仍是主要瓶颈。现有数据集因任务过度拆分且缺乏领域关键词标注,效果受限。为此,我们构建了DeKeyNLU数据集,包含1,500组精心标注的问答对,用于优化任务分解与关键词提取。基于此,我们提出DeKeySQL——一个RAG驱动的NL2SQL管道,包含用户问题理解、实体检索与生成三个模块。在多种模型配置下测试表明,使用DeKeyNLU微调后,DeKeySQL在BIRD(62.31%→69.10%)和Spider(84.2%→88.7%)开发集上的准确率显著提升。

原文摘要 · Abstract (English)

Natural Language to SQL (NL2SQL) provides a new model-centric paradigm that simplifies database access for non-technical users by converting natural language queries into SQL commands. Recent advancements, particularly those integrating Retrieval-Augmented Generation (RAG) and Chain-of-Thought (CoT) reasoning, have made significant strides in enhancing NL2SQL performance. However, challenges such as inaccurate task decomposition and keyword extraction by LLMs remain major bottlenecks, often leading to errors in SQL generation. While existing datasets aim to mitigate these issues by fine-tuning models, they struggle with over-fragmentation of tasks and lack of domain-specific keyword annotations, limiting their effectiveness. To address these limitations, we present DeKeyNLU, a novel dataset which contains 1,500 meticulously annotated QA pairs aimed at refining task decomposition and enhancing keyword extraction precision for the RAG pipeline. Fine-tuned with DeKeyNLU, we propose DeKeySQL, a RAG-based NL2SQL pipeline that employs three distinct modules for user question understanding, entity retrieval, and generation to improve SQL generation accuracy. We benchmarked multiple model configurations within DeKeySQL RAG pipeline. Experimental results demonstrate that fine-tuning with DeKeyNLU significantly improves SQL generation accuracy on both BIRD (62.31% to 69.10%) and Spider (84.2% to 88.7%) dev datasets.

自然语言转SQLRAG数据集构建

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