arXiv:2507.10629cs.DBcs.AI2025-07被引 5

用逆向生成和任务分解提升企业级文本转SQL的准确率

SQLord: A Robust Enterprise Text-to-SQL Solution via Reverse Data Generation and Workflow Decomposition

  • 通过逆向生成原始SQL数据,解决领域语料不足问题
  • 复杂查询拆解后准确率超90%,优于现有方法
  • 适合需要高可靠性的企业数据平台使用

将自然语言转化为SQL查询(NL2SQL)对数据驱动型业务应用至关重要。现有框架基于开源数据集训练,在处理复杂业务逻辑时表现不佳,且缺乏用于微调的领域特定数据。此外,评估通常依赖标注数据和可执行数据库环境,这在真实场景中难以获取。为此,我们提出SQLord——一个企业级NL2SQL框架。首先,引入数据逆向生成方法,将原始SQL语句转换为可用于监督微调(SFT)的标注数据。其次,提出一种基于自动化工作流生成器的复杂查询分解方法。此外,SQLord具备全面的GPT-Judge评估框架,包括执行评估(EXE)、查询-SQL评估(QSE)和SQL-SQL评估(SSE),适用于不同场景。离线测试显著优于现有最先进基线,线上准确率持续超过90%,充分体现了其在复杂真实场景中的优势。SQLord已在全球最大B2B电商平台多个场景成功应用。

原文摘要 · Abstract (English)

Transforming natural language into SQL queries (NL2SQL) is crucial for data-driven business applications. Existing frameworks, trained on open-source datasets, struggle with complex business logic and lack domain-specific data for fine-tuning. Additionally, evaluation methods often require annotated data and executable database environments, which are scarce in real-world scenarios. To address these challenges, we propose SQLord, an enterprise-level NL2SQL framework. First, SQLord introduces a data reverse generation approach to convert raw SQL statements into annotated data for supervised fine-tuning (SFT). Second, it proposes a decomposition method for complex queries using an automated workflow generator. Additionally, SQLord features a comprehensive GPT-Judge evaluation framework, including Execution Evaluation (EXE), Query-SQL Evaluation (QSE), and SQL-SQL Evaluation (SSE), tailored to diverse scenarios. Offline tests significantly outperform state of the art baselines, and online accuracy consistently exceeds 90, highlighting SQLord's advantages and effectiveness in complex real world scenarios. SQLord has been successfully applied across multiple scenarios on the world's largest B2B e-commerce platform.

文本转SQL企业应用数据生成评估框架

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