用结构引导的混合推理,让文本转SQL更准更快。
HES-SQL: Hybrid Reasoning for Efficient Text-to-SQL with Structural Skeleton Guidance
- 融合思维模式的微调与分组相对强化学习,提升生成质量。
- 在BIRD和KaggleDBQA上准确率分别达79.14%和54.9%,延迟降低11%-20%。
- 适合需要高准确率与高效执行的数据库自然语言接口场景。
我们提出HES-SQL,一种新型混合训练框架,通过将思维模式融合的监督微调(SFT)与分组相对策略优化(GRPO)结合,推动文本转SQL生成。其三大创新包括:(1) 结构完整性评分机制,增强生成查询与最优SQL结构间的偏好对齐;(2) 查询延迟感知奖励系统,激励生成计算高效的SQL;(3) 思维模式补全的自蒸馏过程,防止模型推理能力退化。该框架使混合思维模型可在推理与非推理模式间切换,同时提升SQL生成准确率与执行效率。在MySQL 8.0和SQLite 3.42的单用户环境下评估,结果显示:在BIRD基准上执行准确率为79.14%,在KaggleDBQA上为54.9%;相比监督基线,查询延迟降低11%至20%。结果确立了一种新范式:通过执行感知的强化学习,有效平衡语义准确性与计算效率。该方法对构建鲁棒的数据库自然语言接口具有重要意义,并可推广至需兼顾正确性与效率的结构化生成任务。
原文摘要 · Abstract (English)
We present HES-SQL, a novel hybrid training framework that advances Text-to-SQL generation through the integration of thinking-mode-fused supervised fine-tuning (SFT) with Group Relative Policy Optimization (GRPO). Our approach introduces three key innovations: (1) a skeleton-completeness scoring mechanism that enhances preference alignment between generated queries and optimal SQL structures; (2) a query-latency-aware reward system that incentivizes the generation of computationally efficient SQL queries; (3) a self-distillation process for thinking-mode completion that prevents degradation of the model's reasoning capabilities. This framework enables hybrid thinking models to switch between reasoning and non-reasoning modes while improving SQL query accuracy and execution efficiency. Experimental evaluation, conducted on MySQL 8.0 and SQLite 3.42 under controlled single-user conditions, demonstrates that HES-SQL achieves competitive performance with execution accuracies of 79.14\% and 54.9\% on the BIRD and KaggleDBQA benchmarks, respectively. Query latency is measured as the end-to-end execution time of generated queries on the DBMS, averaged over multiple runs to mitigate variance. Efficiency gains range from 11\% to 20\% relative to supervised baselines. Our results establish a new paradigm for Text-to-SQL systems that effectively balances semantic accuracy with computational efficiency through execution-informed reinforcement learning (RL). The proposed methodology has significant implications for developing robust natural language interfaces to databases and can be extended to broader structured generation tasks requiring both correctness and efficiency optimization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。