让大模型自己探查数据库,提升文本转SQL准确率。
SDE-SQL: Enhancing Text-to-SQL Generation in Large Language Models via Self-Driven Exploration with SQL Probes
- 大模型自动生成并执行SQL查询,动态获取数据信息。
- 在BIRD基准上比基线提升8.02%执行准确率,无需微调。
- 适合想提升零样本文本转SQL能力的研究者和开发者。
大语言模型在文本转SQL任务上已有显著进展,但以往方法通常依赖推理时提供的静态数据库信息,限制了模型对数据内容的深入理解。缺乏动态交互使模型只能依赖固定的人工上下文,无法自主探索数据。为此,我们提出SDE-SQL框架,使大模型在推理过程中能自主探索数据库。该框架通过生成并执行SQL探测语句,主动从数据库中检索信息,并迭代更新对数据的理解。与以往方法不同,SDE-SQL在零样本设置下运行,不依赖任何问题-答案对作为上下文示范。在BIRD基准上使用Qwen2.5-72B-Instruct评估时,相比原模型,执行准确率相对提升8.02%,成为无需监督微调或模型集成的开源模型中的新最优结果。此外,在进行监督微调后,性能可再提升0.52%。
原文摘要 · Abstract (English)
Recent advancements in large language models (LLMs) have significantly improved performance on the Text-to-SQL task. However, prior approaches typically rely on static, pre-processed database information provided at inference time, which limits the model's ability to fully understand the database contents. Without dynamic interaction, LLMs are constrained to fixed, human-provided context and cannot autonomously explore the underlying data. To address this limitation, we propose SDE-SQL, a framework that enables large language models to perform self-driven exploration of databases during inference. This is accomplished by generating and executing SQL probes, which allow the model to actively retrieve information from the database and iteratively update its understanding of the data. Unlike prior methods, SDE-SQL operates in a zero-shot setting, without relying on any question-SQL pairs as in-context demonstrations. When evaluated on the BIRD benchmark with Qwen2.5-72B-Instruct, SDE-SQL achieves an 8.02% relative improvement in execution accuracy over the vanilla Qwen2.5-72B-Instruct baseline, establishing a new state-of-the-art among methods based on open-source models without supervised fine-tuning (SFT) or model ensembling. Moreover, with SFT, the performance of SDE-SQL can be further enhanced, yielding an additional 0.52% improvement.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。