使用基于合一的 DeepStochLog 生成有效的 Text-to-SQL
Valid Text-to-SQL Generation with Unification-based DeepStochLog
AI总结:
针对大语言模型生成不可执行 SQL 的问题,提出基于合一语法与 DeepStochLog 的神经符号框架,通过硬约束和双向语言模型接口保证查询有效,并显著提升执行准确率与真实结果一致性。
摘要:
大语言模型已被用于将自然语言问题翻译为 SQL 查询。由于在语法和数据库模式方面缺乏硬约束,它们偶尔会生成不可执行的无效查询。这些失败限制了此类系统在现实场景中的使用。我们提出一种神经符号框架,利用基于合一的定子句语法施加 SQL 语法和模式约束,从而保证生成有效查询。该框架还构建了与语言模型的双向接口,以利用其自然语言理解能力。在 SQL 语法子集上的评估结果表明,我们输出的所有查询均有效。这项工作是利用基于合一的语法扩展语言模型的第一步。我们证明,该扩展大幅提升了底层语言模型的有效性、执行准确率以及与真实结果的一致性。代码可在 https://github.com/ML-KULeuven/deepstochlog-lm 获取。
英文摘要:
Large language models have been used to translate natural language questions to SQL queries. Without hard constraints on syntax and database schema, they occasionally produce invalid queries that are not executable. These failures limit the usage of these systems in real-life scenarios. We propose a neurosymbolic framework that imposes SQL syntax and schema constraints with unification-based definite clause grammars and thus guarantees the generation of valid queries. Our framework also builds a bi-directional interface to language models to leverage their natural language understanding abilities. The evaluation results on a subset of SQL grammars show that all our output queries are valid. This work is the first step towards extending language models with unification-based grammars. We demonstrate this extension enhances the validity, execution accuracy, and ground truth alignment of the underlying language model by a large margin. Our code is available at https://github.com/ML-KULeuven/deepstochlog-lm.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。