SQL思維:具備引導式錯誤修正的多代理文本轉SQL系統
SQL-of-Thought: Multi-agentic Text-to-SQL with Guided Error Correction
August 30, 2025
作者: Saumya Chaturvedi, Aman Chadha, Laurent Bindschaedler
cs.AI
摘要
將自然語言查詢轉換為SQL查詢是工業界和學術界共同面臨的關鍵挑戰,旨在提升對數據庫和大規模應用程式的訪問能力。本研究探討如何利用上下文學習和思維鏈來開發一個穩健的文本到SQL系統解決方案。我們提出了SQL思維鏈:一個多代理框架,將Text2SQL任務分解為模式鏈接、子問題識別、查詢計劃生成、SQL生成以及引導式修正循環。與以往僅依賴基於執行的靜態修正系統不同,我們引入了基於上下文學習的、由分類法引導的動態錯誤修正機制。SQL思維鏈在Spider數據集及其變體上取得了最先進的成果,結合了引導式錯誤分類與基於推理的查詢規劃。
English
Converting natural language queries into SQL queries is a crucial challenge
in both industry and academia, aiming to increase access to databases and
large-scale applications. This work examines how in-context learning and
chain-of-thought can be utilized to develop a robust solution for text-to-SQL
systems. We propose SQL-of-Thought: a multi-agent framework that decomposes the
Text2SQL task into schema linking, subproblem identification, query plan
generation, SQL generation, and a guided correction loop. Unlike prior systems
that rely only on execution-based static correction, we introduce
taxonomy-guided dynamic error modification informed by in-context learning.
SQL-of-Thought achieves state-of-the-art results on the Spider dataset and its
variants, combining guided error taxonomy with reasoning-based query planning.