MTSQL-R1:通過代理訓練實現長時序多輪文本到SQL的轉換
MTSQL-R1: Towards Long-Horizon Multi-Turn Text-to-SQL via Agentic Training
October 12, 2025
作者: Taicheng Guo, Hai Wang, ChaoChun Liu, Mohsen Golalikhani, Xin Chen, Xiangliang Zhang, Chandan K. Reddy
cs.AI
摘要
多輪文本到SQL的目標是將用戶的對話語句轉化為可執行的SQL,同時保持對話的連貫性並與目標模式相契合。然而,現有的大多數系統僅將此任務視為簡單的文本翻譯任務,並遵循短視野範式,每輪生成一個查詢而不進行執行、顯式驗證和精煉,這導致了不可執行或不連貫的輸出。我們提出了MTSQL-R1,這是一個面向長視野多輪文本到SQL的代理訓練框架。我們將該任務建模為馬爾可夫決策過程(MDP),其中代理與(i)數據庫進行交互以獲取執行反饋,以及(ii)持久對話記憶以進行連貫性驗證,執行一個迭代的提議執行 -> 驗證 -> 精煉的循環,直到所有檢查通過。在COSQL和SPARC上的實驗表明,MTSQL-R1始終優於強基線,突顯了環境驅動的驗證和記憶引導的精煉在對話語義解析中的重要性。完整的配方(包括代碼、訓練模型、日誌、推理軌跡等)將在內部審查後發布,以貢獻於社區研究。
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.