用智能体模拟人类探索数据库,提升自然语言查表准确率。
RAISE: Reasoning Agent for Interactive SQL Exploration
- 构建统一智能体框架,整合模式关联、查询生成与迭代优化。
- BIRD数据集上执行准确率从44.8%提升至56.5%,最佳方案达81.8%。
- 动态扩展推理深度,适合复杂模糊查询场景,降低工程复杂度。
大型语言模型的进展推动了自然语言数据库接口的研究。然而,当前主流文本转SQL系统仍依赖复杂的多阶段流程。本文提出一种新型代理式框架,将模式链接、查询生成和迭代优化统一为单一端到端组件。通过利用大模型的内在推理能力,该方法模拟人类在面对陌生数据库时的思考过程:通过提出假设、动态执行查询验证、分析结果并据此修正输出。关键在于,该方法引入了一种新的测试时计算扩展策略——通过加深交互式数据库探索与反思的深度来分配计算资源,尤其适用于模糊和不明确的场景。实验表明,在使用DeepSeek-R1-Distill-Llama-70B模型的情况下,该方法在具有挑战性的BIRD数据集上将执行准确率(EX)从44.8%提升至56.5%。当引入多轮候选生成以增加多样性时,其最佳方案达到81.8%的准确率(8轮),接近排名第一公开方案的82.79%表现,同时显著降低工程复杂性。这表明该统一框架是构建自然语言数据库接口的有力替代方案。
原文摘要 · Abstract (English)
Recent advances in large language models (LLMs) have propelled research in natural language interfaces to databases. However, most state-of-the-art text-to-SQL systems still depend on complex, multi-stage pipelines. This work proposes a novel agentic framework that unifies schema linking, query generation, and iterative refinement within a single, end-to-end component. By leveraging the intrinsic reasoning abilities of LLMs, our method emulates how humans answer questions when working with unfamiliar databases: understanding the data by formulating hypotheses, running dynamic queries to validate them, reasoning over the results, and revising outputs based on observed results. Crucially, our approach introduces a new strategy for scaling test-time computation in text-to-SQL: we scale the depth of interactive database exploration and reflection. This shift enables the model to allocate computation dynamically to better understand the data, especially useful in ambiguous and underspecified scenarios. Our experiments show that it improved the Execution Accuracy (EX) from 44.8% to 56.5% on the challenging BIRD dataset using DeepSeek-R1-Distill-Llama-70B. Furthermore, when equipped with steps to add more diversity to the answers, our agent achieves a Best-of-N accuracy of 81.8% with 8 rounds of candidate generation, rivaling the 82.79% achieved by the top-ranked published solution, while reducing engineering complexity. These findings position our unified framework as a promising alternative for building natural language interfaces to databases.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。