通过双状态推理提升复杂数据库的文本转SQL准确率
Text-to-SQL as Dual-State Reasoning: Integrating Adaptive Context and Progressive Generation
- 将文本转SQL建模为自适应上下文与渐进生成的交互过程
- 在Spider 2.0-Snow上达35.28%执行准确率,BIRD上达68.32%
- 无需微调或示例,适合企业级复杂数据库场景
近期基于思维链(Chain-of-Thought, CoT)的分解式推理方法显著提升了大语言模型(LLMs)的文本转SQL能力。然而,在处理复杂企业数据库时,这些方法因上下文容量有限、模式链接不可靠、数据库语义基础薄弱而难以维持连贯推理。为此,我们提出DSR-SQL,一种双状态推理框架,将文本转SQL建模为自适应上下文状态与渐进生成状态之间的交互。前者通过精炼大型模式并选择相关结构构建紧凑且语义忠实的环境;后者将SQL生成形式化为反馈引导的状态转移,使模型能够自我修正并契合用户意图。无需任何微调或上下文示例,DSR-SQL在Spider 2.0-Snow上达到35.28%的执行准确率,在BIRD开发集上达到68.32%。代码将开源至https://github.com/DMIRLAB-Group/DSR-SQL。
原文摘要 · Abstract (English)
Recent divide-and-conquer reasoning approaches, particularly those based on Chain-of-Thought (CoT), have substantially improved the Text-to-SQL capabilities of Large Language Models (LLMs). However, when applied to complex enterprise databases, such methods struggle to maintain coherent reasoning due to limited context capacity, unreliable schema linking, and weak grounding in database semantics. To overcome these issues, we introduce DSR-SQL, a \textbf{D}ual-\textbf{S}tate \textbf{R}easoning framework that models Text-to-SQL as an interaction between an adaptive context state and a progressive generation state. The first constructs a compact, semantically faithful environment by refining large schemas and selecting relevant structures, while the second formalizes SQL synthesis as feedback-guided state transitions, enabling the model to self-correct and align with user intent. Without any post-training or in-context examples, DSR-SQL achieves competitive performance, reaching 35.28\% execution accuracy on Spider 2.0-Snow and 68.32\% on BIRD development set. Our implementation will be open-sourced at: https://github.com/DMIRLAB-Group/DSR-SQL.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。