让自然语言转SQL更准:自动发现歧义并引导用户澄清意图
AmbiSQL: Interactive Ambiguity Detection and Resolution for Text-to-SQL
- 基于细粒度歧义分类,识别数据库元素和模型推理中的模糊点
- 通过多选题交互引导用户澄清意图,使生成的SQL准确率提升
- 适合想提升Text-to-SQL系统可用性的开发者和研究者
Text-to-SQL系统将自然语言问题转化为SQL查询,为非专业用户提供巨大价值。尽管大语言模型(LLMs)在此任务上表现良好,但依然存在错误。查询歧义被公认为基于LLM的Text-to-SQL系统的主要障碍,导致用户意图误判和生成错误的SQL。为此,我们提出AmbiSQL,一个交互式系统,可自动检测查询歧义,并通过直观的多选题引导用户澄清意图。该系统引入细粒度歧义分类体系,识别源于数据库元素和LLM推理的歧义,并结合用户反馈重写模糊问题。在演示中,AmbiSQL集成于我们的商业Text-to-SQL后端XiYan-SQL。我们提供了40个来自两个真实世界基准的歧义查询,供SIGMOD'26参会者探索消歧如何提升SQL生成质量。参与者还可将系统应用于自己的数据库和自然语言问题。代码库和演示视频见:https://github.com/JustinzjDing/AmbiSQL 及 https://www.youtube.com/watch?v=rbB-0ZKwYkk。
原文摘要 · Abstract (English)
Text-to-SQL systems translate natural language questions into SQL queries, providing substantial value for non-expert users. While large language models (LLMs) show promising results for this task, they remain error-prone. Query ambiguity has been recognized as a major obstacle in LLM-based Text-to-SQL systems, leading to misinterpretation of user intent and inaccurate SQL generation. To this end, we present AmbiSQL, an interactive system that automatically detects query ambiguities and guides users through intuitive multiple-choice questions to clarify their intent. It introduces a fine-grained ambiguity taxonomy for identifying ambiguities arising from both database elements and LLM reasoning, and subsequently incorporates user feedback to rewrite ambiguous questions. In this demonstration, AmbiSQL is integrated with XiYan-SQL, our commercial Text-to-SQL backend. We provide 40 ambiguous queries collected from two real-world benchmarks that SIGMOD'26 attendees can use to explore how disambiguation improves SQL generation quality. Participants can also apply the system to their own databases and natural language questions. The codebase and demo video are available at: https://github.com/JustinzjDing/AmbiSQL and https://www.youtube.com/watch?v=rbB-0ZKwYkk.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。