用合成数据和新目标训练模型,让自然语言转SQL更准确可靠。
Thinkquel: A Model Dedicated to Text-to-dbt Using Synthetic Data and a Span-Aware Objective
- 用dbt生成跨平台中间表示,结合跨度感知强化学习优化
- 在500条测试用例上执行成功率93.2%,结果完全匹配率61.8%
- 适合需要高精度数据库查询的工业级应用开发者
将自然语言请求转化为可靠、可生产的数据转换仍具挑战:正确性依赖精确的模式映射和仓库特定的SQL方言,而训练中最强的监督信号——执行成功与结果匹配——仅在序列层面提供。同时,构建大规模、可执行验证的数据集成本高昂,且词元级目标与全局信号不一致,导致优化不稳定、泛化能力差。本文提出Thinkquel,一个专用于文本转SQL的微调模型。其方法融合新型合成数据管道TS-SQL,以dbt作为可移植中间表示,并设计了针对词元级训练信号与序列级执行奖励之间差距的跨度感知强化学习算法(TS-GRPO)。在500例的TS-SQL测试集上,Thinkquel(32B)实现93.2%的执行成功率与61.8%的精确结果匹配率,相较基线分别提升67.2%(执行)和44.4%(匹配)。在Spider(14B)实验中,TS-GRPO提升了训练稳定性,加速了执行-匹配奖励的收敛速度,优于GRPO与GSPO。
原文摘要 · Abstract (English)
Transforming natural-language requests into reliable, production-ready data transformations remains challenging: correctness depends on precise schema linking and warehouse-specific SQL dialects, while the strongest supervision available during training--execution success and result matching--are provided only at the sequence level. At the same time, assembling large, execution-validated corpora is costly, and token-level objectives misalign with these global signals, yielding unstable optimization and limited portability. We introduce Thinkquel, a fine-tuned model for producing robust, portable, and execution-validated database queries. Methodologies in Thinkquel integrates a novel synthetic data pipeline, TS-SQL, that leverages dbt as a portable intermediate representation with a span-aware reinforcement learning objective, and Token-Sequence GRPO (TS-GRPO), specifically designed to bridge the gap between token-level training signals and sequence-level execution rewards when finetuning LLMs. On the 500-example TS-SQL test set, Thinkquel (32B) reaches 93.2% execution success and 61.8% exact-result match with a two-stage SFT curriculum, improving over the base model by 67.2% (exec.) and 44.4% (match). In Spider (14B) experiments, TS-GRPO increases training stability and speeds convergence of the execution-match reward relative to GRPO and GSPO.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。