用树状结构和回溯机制提升大模型写SQL的准确性
ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Models

- 构建多路径树状调试流程,支持回溯纠错
- 在BIRD-Critic上比当前最优方法高9.42%准确率
- 已在真实线上系统部署,执行准确率从36.77%提至53.61%
大型语言模型(LLMs)在文本转SQL系统中日益普及,但SQL错误仍是实际推理管道中的主要障碍。现有修正方法或依赖大规模高质量训练数据且开销大,或采用单一路径的代理工作流,对早期错误敏感且易传播错误。为应对工业场景需求,我们提出无需训练的框架,将SQL修正建模为计划引导、树状结构的调试过程。通过维护多种修正策略并支持回溯,缓解迭代优化中的错误累积。进一步融合基于执行的验证与语句级诊断工具,实现策略剪枝与精准错误定位。在BIRD-Critic基准上评估,该系统持续优于强基线模型与代表性代理方法,相较此前最优方法提升9.42%。该框架已部署于火山引擎的Torch Log Service(TLS)中,支撑在线Text-to-TLS API。生产环境中,使用强基线模型(GPT-5)时,真实用户查询的执行准确率从36.77%提升至53.61%,证明了其在真实场景下的有效性与稳定性。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have been increasingly adopted in Text-to-SQL systems, yet SQL errors remain a major obstacle in real-world Text-to-SQL inference pipelines. Existing SQL correction approaches either rely on large-scale, high-quality training data with substantial overhead, or adopt single-path agentic workflows that are brittle to early mistakes and prone to error propagation. To develop a practical SQL correctness system for industrial scenarios, we present a training-free framework that formulates SQL correction as a plan-guided, tree-structured debugging process. By maintaining multiple correction strategies and enabling backtracking, the framework mitigates error accumulation during iterative refinement. We further integrate execution-based verification and clause-level diagnostic tools to support strategy pruning and precise error localization. We evaluate the system on the BIRD-Critic benchmark and observe consistent accuracy gains over strong LLM backbones and representative agent-based baselines, achieving a 9.42% improvement over the previous state-of-the-art method. The framework is also deployed in the Torch Log Service (TLS) of Volcano Engine to support an online Text-to-TLS API. In production, it improves execution accuracy from 36.77% to 53.61% on real user queries with a representative strong LLM backbone (GPT-5). These results demonstrate the effectiveness and stability of our approach in real-world deployments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。