arXiv:2511.08245cs.CLcs.LG2025-11

通过提示调优与外部知识增强,提升自然语言转SQL的准确率

Prompt Tuning for Natural Language to SQL with Embedding Fine-Tuning and RAG

  • 基于错误诊断机制,分步识别并修正SQL生成错误
  • 结合嵌入微调和RAG,使模型准确率提升12个百分点
  • 适合需要高精度数据库查询的开发者与数据分析师

本文提出一种基于提示调优的自然语言到SQL转换方法,融合最新生成式预训练大模型与检索增强生成(RAG)。针对自然语言接口在数据查询中日益增长的需求,该方法借鉴医学诊断流程,构建包含错误类型识别、成因分析、修复建议和自动修正的闭环纠错机制。通过嵌入微调和外部知识库支持,显著提升生成准确率。实验表明,本框架在多个基准上相比现有基线平均提升12%准确率,具备更强的可解释性与实用性,有望推动现代数据驱动环境中的智能数据访问发展。

原文摘要 · Abstract (English)

This paper introduces an Error Correction through Prompt Tuning for NL-to-SQL, leveraging the latest advancements in generative pre-training-based LLMs and RAG. Our work addresses the crucial need for efficient and accurate translation of natural language queries into SQL expressions in various settings with the growing use of natural language interfaces. We explore the evolution of NLIDBs from early rule-based systems to advanced neural network-driven approaches. Drawing inspiration from the medical diagnostic process, we propose a novel framework integrating an error correction mechanism that diagnoses error types, identifies their causes, provides fixing instructions, and applies these corrections to SQL queries. This approach is further enriched by embedding fine-tuning and RAG, which harnesses external knowledge bases for improved accuracy and transparency. Through comprehensive experiments, we demonstrate that our framework achieves a significant 12 percent accuracy improvement over existing baselines, highlighting its potential to revolutionize data access and handling in contemporary data-driven environments.

自然语言转SQL提示调优RAG数据库查询

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