用自动生成数据训练出开源小模型,性能超大闭源模型。
OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale
- 用自动化框架合成250万条带思维链的文本转SQL数据
- 训练出7B-32B三款模型,在9个数据集上超越GPT-4o等大模型
- 适合需要低成本、高隐私保护的工业级数据库交互场景
文本转SQL任务使非专业人士能与数据库交互。尽管大语言模型提升了该任务性能,现有方法仍受限:提示法依赖昂贵且不透明的闭源模型,微调法因公开数据覆盖不足导致泛化性差。为此,我们提出一种可扩展的文本转SQL数据合成框架,无需大量人工干预即可生成大规模高质量数据。基于此框架,我们构建了首个百万级文本转SQL数据集SynSQL-2.5M,包含250万条样本,覆盖超过16,000个合成数据库,每条数据含数据库、SQL查询、自然语言问题及链式思维(CoT)解答。利用该数据集,我们开发了OmniSQL开源模型,提供7B、14B、32B三种规模版本。在九个数据集上的广泛评估表明,即使规模更小,OmniSQL性能仍达到或超越当前领先闭源与开源模型,包括GPT-4o和DeepSeek-V3。所有代码、数据集和模型均已开源,以支持后续研究。
原文摘要 · Abstract (English)
Text-to-SQL, the task of translating natural language questions into SQL queries, plays a crucial role in enabling non-experts to interact with databases. While recent advancements in large language models (LLMs) have significantly enhanced text-to-SQL performance, existing approaches face notable limitations in real-world text-to-SQL applications. Prompting-based methods often depend on closed-source LLMs, which are expensive, raise privacy concerns, and lack customization. Fine-tuning-based methods, on the other hand, suffer from poor generalizability due to the limited coverage of publicly available training data. To overcome these challenges, we propose a novel and scalable text-to-SQL data synthesis framework for automatically synthesizing large-scale, high-quality, and diverse datasets without extensive human intervention. Using this framework, we introduce SynSQL-2.5M, the first million-scale text-to-SQL dataset, containing 2.5 million samples spanning over 16,000 synthetic databases. Each sample includes a database, SQL query, natural language question, and chain-of-thought (CoT) solution. Leveraging SynSQL-2.5M, we develop OmniSQL, a powerful open-source text-to-SQL model available in three sizes: 7B, 14B, and 32B. Extensive evaluations across nine datasets demonstrate that OmniSQL achieves state-of-the-art performance, matching or surpassing leading closed-source and open-source LLMs, including GPT-4o and DeepSeek-V3, despite its smaller size. We release all code, datasets, and models to support further research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。