TAHOE: Text-to-SQL with Automated Hint Optimization from Experience

📄 arXiv: 2606.12387v1 📥 PDF

作者: Zhiyi Chen, Jie Song, Peng Li

分类: cs.DB, cs.AI

发布日期: 2026-06-10


💡 一句话要点

提出TAHOE以解决文本到SQL转换中的提示优化问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 文本到SQL 提示优化 动态数据管理 用户意图建模 大型语言模型

📋 核心要点

  1. 现有的文本到SQL方法在处理复杂的SQL方言和用户偏好时面临高成本和灵活性不足的问题。
  2. TAHOE通过动态提示优化和错误驱动学习,将调试信息整合为结构化提示库,提升SQL生成的准确性。
  3. 在Spider 2.0-Snow数据集上,TAHOE将通过率从61.95%提升至79.42%,并在多个指标上显著改善性能。

📝 摘要(中文)

大型语言模型(LLMs)通过文本到SQL(Text-to-SQL)技术使数据库访问变得更加普及,但从原型到生产环境的转变仍然面临挑战。实际部署需要处理严格的SQL方言、大规模的数据库模式以及不断变化的用户偏好,而监督微调成本高且灵活性不足。本文提出了TAHOE,一个将提示优化视为动态数据管理问题的系统。TAHOE通过开发和部署阶段的错误驱动提示学习管道,将调试痕迹整合到结构化的提示库中。它提炼编译器反馈为可重用的语法提示,并将执行和用户反馈转化为语义提示。TAHOE还引入了策略层,建模用户意图的冲突,并在推理时检索相关提示,指导LLM进行逻辑规划和SQL合成。实验结果表明,TAHOE显著提高了文本到SQL的性能。

🔬 方法详解

问题定义:本文旨在解决文本到SQL转换中的提示优化问题,现有方法在处理复杂SQL方言和用户偏好时存在高成本和灵活性不足的痛点。

核心思路:TAHOE将提示优化视为动态数据管理问题,通过错误驱动的学习管道整合调试信息,生成可重用的提示,提升SQL生成的准确性和效率。

技术框架:TAHOE的整体架构包括开发和部署两个阶段,主要模块包括提示库、语法提示和语义提示生成、策略层以及推理阶段的逻辑规划与SQL合成。

关键创新:TAHOE的主要创新在于引入了动态提示优化和策略层,能够有效处理用户意图的冲突,并通过历史反馈不断优化提示的使用。

关键设计:在设计中,TAHOE使用了结构化的提示库,结合编译器反馈和用户反馈生成语法和语义提示,并通过策略层进行用户意图建模,确保在推理时能够高效检索相关提示。

📊 实验亮点

在Spider 2.0-Snow数据集上,TAHOE显著提高了文本到SQL的性能,具体表现为通过率从61.95%提升至79.42%,并且在100% Snowflake语法通过率的基础上,平均编译器反馈轮次从2.79减少至0.12,显示出其在提示优化方面的显著优势。

🎯 应用场景

TAHOE的研究成果在数据库查询生成、智能助手和数据分析等领域具有广泛的应用潜力。通过提高文本到SQL的准确性,能够帮助用户更高效地访问和管理数据,降低技术门槛,促进数据驱动决策的普及。未来,随着人机反馈机制的完善,TAHOE的应用价值将进一步提升。

📄 摘要(原文)

Large Language Models (LLMs) have democratized database access through Text-to-SQL, but moving from prototypes to production remains difficult. Real deployments must handle strict SQL dialects, massive schemas, and evolving user preferences, while supervised fine-tuning is costly and rigid and agentic test-time scaling is expensive. We present Tahoe, a system that treats prompt optimization as a dynamic data management problem. Tahoe uses an error-driven hint learning pipeline across Development and Deployment to consolidate debugging traces into a structured Hint Bank. Compiler feedback is distilled into reusable Syntax Hints for dialect-specific rules, while execution and user feedback are converted into Semantic Hints for schema- and user-specific logic. Tahoe further introduces a Strategy Layer that models conflicting user intents as competing strategies under shared natural-language triggers, with recency signals and post-learning attribution statistics that summarize empirical success, harm, inertness, and support. At inference time, Tahoe retrieves relevant hints and guides the LLM through Logic Planning followed by SQL Synthesis. We implement and evaluate the development-phase workflow, leaving deployment-time human-feedback updates for future work. On Spider 2.0-Snow, Tahoe substantially improves Text-to-SQL without updating model parameters. On 113 supervised Spider 2.0-Snow-0212 examples using GPT-5.5, Tahoe raises pass rate from 61.95 percent to 79.42 percent and pass-at-4 from 72.57 percent to 87.61 percent, achieves 100 percent Snowflake syntax pass rate, and reduces average compiler-feedback critic rounds from 2.79 to 0.12 per sampled candidate. The same Hint Bank also transfers to weaker backbones, including a 19.7 percentage-point pass-rate gain on Doubao-2.0-lite.