辅助任务增强的中文跨域NL2SQL算法

2024,46(2):197-204
胡亚红
浙江工业大学 计算机科学与技术学院, 浙江 杭州 310023,huyahong@zjut.edu.cn
刘亚冬
西安交通大学 软件学院, 陕西 西安 710049
朱正东
西安交通大学 计算机科学与技术学院, 陕西 西安 710049,zdzhu@xjtu.edu.cn
刘鹏杰
西安交通大学 计算机科学与技术学院, 陕西 西安 710049
摘要:
自然语言到结构化查询语言(natural language to structured query language,NL2SQL)任务旨在将自然语言询问转化为数据库可执行的结构化查询语言(structured query language,SQL) 语句。本文提出了一种辅助任务增强的中文跨域 NL2SQL 算法,其核心思想是通过在解码阶段添加辅助任务以结合原始模型来进行多任务训练,提升模型的准确率。辅助任务的设计是通过将数据库模式建模成图,预测自然语言询问与数据库模式图中的节点的依赖关系,显式地建模自然语言询问和数据库模式之间的依赖关系。针对特定的自然语言询问,通过辅助任务的提升,模型能够更好地识别数据库模式中哪些表/列对预测目标 SQL 更有效。在中文 NL2SQL 数据集 DuSQL 上的实验结果表明,添加辅助任务后的算法相对于原始模型取得了更好的效果,能够更好地处理跨域 NL2SQL 任务。
基金项目:
国家重点研发计划资助项目(2018YFB0204003,2018YFB0204004)

Chinese cross-domain NL2SQL algorithm enhanced by auxiliary task

HU Yahong
College of Computer Science and Technology, Zhejiang University of Technology, Hangzhou 310023, China,huyahong@zjut.edu.cn
LIU Yadong
School of Software Engineering, Xi′an Jiaotong University, Xi′an 710049, China
ZHU Zhengdong
School of Computer Science and Technology, Xi′an Jiaotong University, Xi′an 710049, China,zdzhu@xjtu.edu.cn
LIU Pengjie
School of Computer Science and Technology, Xi′an Jiaotong University, Xi′an 710049, China
Abstract:
NL2SQL(natural language to structured query language) task aims to translate natural language queries into SQL(structured query language) executable by the database. A Chinese cross-domain NL2SQL algorithm enhanced by auxiliary tasks was proposed. Core idea was to perform multi-task training and improve the accuracy of the model by adding auxiliary tasks in the decoder and combining the prototype model. Auxiliary task was designed by modeling the database schema into a graph, predicting the dependency relations between the natural language queries and the nodes in the database schema graph, and explicitly modeling the dependency relations between the natural language query and the database schema. Through the improvement of auxiliary tasks, the model can better identify which tables/columns in the database schema are more effective for predicting the target SQL for specific natural language queries. Experimental results on the Chinese NL2SQL dataset DuSQL show that the algorithm after adding auxiliary tasks has achieved better results than the prototype model, and can better handle cross-domain NL2SQL task.
收稿日期:
2022-01-18
     下载PDF全文