Text-to-SQL conversion is a critical innovation, simplifying the transition from complex SQL to intuitive natural language queries, especially significant given SQL's prevalence in the job market across various roles. The rise of Large Language Models (LLMs) like GPT-3.5 and GPT-4 has greatly advanced this field, offering improved natural language understanding and the ability to generate nuanced SQL statements. However, the potential of open-source LLMs in Text-to-SQL applications remains underexplored, with many frameworks failing to leverage their full capabilities, particularly in handling complex database queries and incorporating feedback for iterative refinement. Addressing these limitations, this paper introduces SQLfuse, a robust system integrating open-source LLMs with a suite of tools to enhance Text-to-SQL translation's accuracy and usability. SQLfuse features four modules: schema mining, schema linking, SQL generation, and a SQL critic module, to not only generate but also continuously enhance SQL query quality. Demonstrated by its leading performance on the Spider Leaderboard and deployment by Ant Group, SQLfuse showcases the practical merits of open-source LLMs in diverse business contexts.
翻译:文本到SQL转换是一项关键创新,它简化了从复杂SQL到直观自然语言查询的过渡,鉴于SQL在各行各业职位中的普遍性,这一点尤为重要。以GPT-3.5和GPT-4为代表的大型语言模型(LLMs)的兴起极大地推动了该领域的发展,提供了改进的自然语言理解能力以及生成细致入微的SQL语句的能力。然而,开源LLMs在文本到SQL应用中的潜力仍未得到充分探索,许多框架未能充分利用其全部能力,特别是在处理复杂数据库查询以及整合反馈进行迭代优化方面。针对这些局限性,本文提出了SQLfuse,这是一个将开源LLMs与一套工具集成的鲁棒系统,旨在提升文本到SQL翻译的准确性和可用性。SQLfuse包含四个模块:模式挖掘、模式链接、SQL生成以及SQL评判模块,不仅能生成SQL查询,还能持续提升其质量。通过在Spider排行榜上的领先表现以及在蚂蚁集团的实际部署,SQLfuse展示了开源LLMs在多样化商业场景中的实用价值。