arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.13659cs.CL
收藏

模糊性下 Text-to-SQL 生成的基准测试与改进

Benchmarking and Improving Text-to-SQL Generation under Ambiguity

IIT Bombay(印度理工学院孟买分校);Princeton University(普林斯顿大学)

Adithya Bhaskar, Tushar Tomar, Ashutosh Sathe, Sunita Sarawagi

AI总结:

针对自然语言查询数据库时的模糊性问题,提出 AmbiQT 基准和 LogicalBeam 解码算法,通过结合计划模板生成与约束填充提升 top-$k$ 候选 SQL 的多样性,显著优于现有模型。

摘要:

Text-to-SQL 转换的研究主要基于每个文本查询对应一个正确 SQL 的数据集进行基准测试。然而,针对真实数据库的自然语言查询通常包含显著的模糊性,由于模式名称重叠和多种混淆的关系路径,导致预期的 SQL 不明确。为弥补这一差距,我们开发了一个名为 AmbiQT 的新基准,包含超过 3000 个示例,其中每个文本由于词汇和/或结构模糊,均可被解释为两个合理的 SQL。面对模糊性,理想的 top-$k$ 解码器应生成所有有效的解释,供用户进行可能的消歧。我们评估了多个 Text-to-SQL 系统和解码算法,包括采用最先进 LLM 的系统,发现它们远未达到这一理想状态。主要原因是流行的束搜索算法及其变体将 SQL 查询视为字符串,在 top-$k$ 中产生无用的 token 级多样性。我们提出 LogicalBeam,一种新的解码算法,结合基于计划的模板生成和约束填充来探索 SQL 逻辑空间。反事实生成的计划使模板多样化,而仅在模式名称上分叉的束搜索填充则提供值多样性。LogicalBeam 在 top-$k$ 排序输出中生成所有候选 SQL 的效果比最先进模型高出 $2.5$ 倍。它还提升了 SPIDER 和 Kaggle DBQA 上的 top-$5$ Exact 和 Execution Match Accuracies。

英文摘要:

Research in Text-to-SQL conversion has been largely benchmarked against datasets where each text query corresponds to one correct SQL. However, natural language queries over real-life databases frequently involve significant ambiguity about the intended SQL due to overlapping schema names and multiple confusing relationship paths. To bridge this gap, we develop a novel benchmark called AmbiQT with over 3000 examples where each text is interpretable as two plausible SQLs due to lexical and/or structural ambiguity. When faced with ambiguity, an ideal top-$k$ decoder should generate all valid interpretations for possible disambiguation by the user. We evaluate several Text-to-SQL systems and decoding algorithms, including those employing state-of-the-art LLMs, and find them to be far from this ideal. The primary reason is that the prevalent beam search algorithm and its variants, treat SQL queries as a string and produce unhelpful token-level diversity in the top-$k$. We propose LogicalBeam, a new decoding algorithm that navigates the SQL logic space using a blend of plan-based template generation and constrained infilling. Counterfactually generated plans diversify templates while in-filling with a beam-search that branches solely on schema names provides value diversity. LogicalBeam is up to $2.5$ times more effective than state-of-the-art models at generating all candidate SQLs in the top-$k$ ranked outputs. It also enhances the top-$5$ Exact and Execution Match Accuracies on SPIDER and Kaggle DBQA.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑