Modern LLMs have become increasingly powerful, but they are still facing challenges in specialized tasks such as Text-to-SQL. We propose SQL-CRAFT, a framework to advance LLMs' SQL generation Capabilities through inteRActive reFinemenT and enhanced reasoning. We leverage an Interactive Correction Loop (IC-Loop) for LLMs to interact with databases automatically, as well as Python-enhanced reasoning. We conduct experiments on two Text-to-SQL datasets, Spider and Bird, with performance improvements of up to 5.7% compared to the naive prompting method. Moreover, our method surpasses the current state-of-the-art on the Spider Leaderboard, demonstrating the effectiveness of our framework.
翻译:现代大型语言模型(LLM)虽日益强大,但在文本到SQL等专业任务中仍面临挑战。我们提出SQL-CRAFT框架,通过交互式精炼与增强推理提升LLM的SQL生成能力。该框架利用交互式纠错循环(IC-Loop)使LLM能自动与数据库交互,并采用Python增强推理机制。在Spider和Bird两个文本到SQL数据集上的实验表明,相较于朴素提示方法,本方法性能提升最高达5.7%。此外,我们的方法在Spider排行榜上超越了当前最优水平,验证了框架的有效性。