arXiv:2510.12831cs.CLcs.AI2025-10ACL被引 5

让AI对话生成可执行的复杂SQL,通过反复验证和修正提升准确性

MTSQL-R1: Towards Long-Horizon Multi-Turn Text-to-SQL via Agentic Training

  • 将对话转SQL建模为智能体与数据库、记忆库交互的决策过程
  • 在COSQL和SPARC数据集上超越强基线,实现更准确的多轮查询生成
  • 适合需要高可靠性的自然语言转数据库查询的研究与应用

多轮文本转SQL任务旨在将用户对话转化为可执行的SQL语句,同时保持对话连贯性并符合目标模式。然而,现有系统通常将其视为简单的文本翻译,采用短周期范式,每轮仅生成一个查询而不进行执行、显式验证和修正,导致输出不可执行或不连贯。本文提出MTSQL-R1,一种面向长周期多轮文本转SQL的智能体训练框架。将该任务建模为马尔可夫决策过程(MDP),其中智能体与(i)数据库交互以获取执行反馈,以及(ii)持久对话记忆交互以验证连贯性,执行迭代的‘提出-执行-验证-修正’循环,直至所有检查通过。在COSQL和SPARC数据集上的实验表明,MTSQL-R1持续优于强基线,凸显了环境驱动验证和记忆引导修正的重要性。完整训练方案(包括代码、训练模型、日志、推理轨迹等)将在内部审查后公开,以推动社区研究。

原文摘要 · Abstract (English)

Multi-turn Text-to-SQL aims to translate a user's conversational utterances into executable SQL while preserving dialogue coherence and grounding to the target schema. However, most existing systems only regard this task as a simple text translation task and follow a short-horizon paradigm, generating a query per turn without execution, explicit verification, and refinement, which leads to non-executable or incoherent outputs. We present MTSQL-R1, an agentic training framework for long-horizon multi-turn Text-to-SQL. We cast the task as a Markov Decision Process (MDP) in which an agent interacts with (i) a database for execution feedback and (ii) a persistent dialogue memory for coherence verification, performing an iterative propose to execute -> verify -> refine cycle until all checks pass. Experiments on COSQL and SPARC demonstrate that MTSQL-R1 consistently outperforms strong baselines, highlighting the importance of environment-driven verification and memory-guided refinement for conversational semantic parsing. Full recipes (including code, trained models, logs, reasoning trajectories, etc.) will be released after the internal review to contribute to community research.

文本转SQL多轮对话智能体数据库查询

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。