用合成查询日志和探测机制自动解决自然语言转SQL的歧义问题
SOMA-SQL: Resolving Multi-Source Ambiguity in NL-to-SQL via Synthetic Log and Execution Probing

- 构建合成查询日志,引导候选SQL生成
- 通过结构化歧义探测,提升13%执行准确率
- 无需人工干预,适用于未知数据库和复杂查询
自然语言到SQL的接口在真实场景中仍易出错,因问题描述不完整、模式庞大且存在歧义。现有方法依赖人工澄清或仅处理模式表示,难以自动消解歧义。本文提出SOMA-SQL,通过构造合成查询日志来锚定模式理解并指导候选SQL生成;再基于结构化歧义分类和候选差异,执行针对性探测查询,生成用于最终SQL选择与修复的消歧证据。该主动式歧义发现与解决方法在无须人工介入的情况下,泛化至未见模式和查询分布。在六个公开基准上的实验表明,相较于最先进方法,平均提升执行准确率13.0%,在歧义问题上最高达16.7%。
原文摘要 · Abstract (English)
Natural language interfaces to databases aim to translate user questions into executable SQL, yet remain brittle in real-world settings where questions are underspecified and schemas are large and ambiguous. Ambiguity across user questions, database schemas, and model interpretations are central failure modes in NL2SQL, leading to misaligned intent, incorrect schema grounding, and erroneous SQL generation. Existing approaches rely on human clarification or treat ambiguity as a schema representation problem, but these do not scale nor resolve ambiguity autonomously. We propose SOMA-SQL to automatically resolve ambiguity via targeted synthetic query log and ambiguity-driven probing. SOMA-SQL constructs synthetic query log to ground schema interpretation and guide candidate SQL generation; it then executes targeted probing queries, driven by a structured ambiguity taxonomy and candidate disagreements, to produce disambiguation evidence for final SQL selection and repair. This active approach to ambiguity discovery and resolution generalizes across unseen schemas and query distributions without human-in-the-loop. Experiments on six public benchmarks demonstrate that SOMA-SQL improves execution accuracy by 13.0% on average over state-of-the-art baselines, with gains of up to 16.7% on ambiguous questions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。