《计算机应用》唯一官方网站

• •    下一篇

基于语义增强模式链接的Text-to-SQL模型

吴相岚,肖洋,刘梦莹,刘明铭   

  1. 南开大学 软件学院
  • 收稿日期:2023-10-07 修回日期:2023-12-07 发布日期:2024-03-15 出版日期:2024-03-15
  • 通讯作者: 刘明铭
  • 作者简介:吴相岚(2000—),男,安徽合肥人,硕士研究生,主要研究方向:自然语言处理、SQL语句生成;肖洋(1998—),男,河北秦皇岛人,硕士研究生,主要研究方向:虚假新闻检测、SQL语句生成;刘梦莹(1999—),女,山东济宁人,硕士研究生,主要研究方向:智能软件工程、虚假新闻检测;刘明铭(1979—),女,山东东阿人,讲师,博士,主要研究方向:数据挖掘。

Text-to-SQL model based on semantic enhanced schema linking

WU Xianglan, XIAO Yang, LIU Mengying, LIU Mingming   

  1. College of Software, Nankai University
  • Received:2023-10-07 Revised:2023-12-07 Online:2024-03-15 Published:2024-03-15
  • About author:WU Xianglan, born in 2000, M. S. candidate. His research interests include natural language processing, SQL statement generation. XIAO Yang, born in 1998, M. S. candidate. His research interests include fake news detection, SQL statement generation. LIU Mengying, born in 1999, M. S. candidate. Her research interests include intelligent software engineering, fake news detection. LIU Mingming, born in 1979, Ph. D., lecturer. Her research interests include data mining.

摘要: 为优化基于异构图编码器的Text-to-SQL生成问题,提出了SELSQL模型。首先,模型采用端到端的学习框架,使用双曲空间下的庞加莱距离度量替代欧氏度量,以此优化了使用探针技术从预训练语言模型中构建的语义增强的模式链接图;其次,利用K头加权的余弦相似度以及图正则化方法学习相似度度量图使得初始模式链接图在训练中迭代优化;最后,模型使用改良的关系图注意网络(RGAT)图编码器以及多头注意力机制对两个模块的联合语义模式链接图进行编码,并且使用了基于语法的神经语义解码器和预定义的结构化语言进行SQL语句解码。在Spider数据集上的实验结果表明,使用ELECTRA-large预训练模型时,SELSQL模型比最佳基线模型的准确率提升了2.5个百分点,对于复杂SQL语句生成的提升效果很大,并且在更一般的使用场景下有更好的鲁棒性。

关键词: 模式链接, 图结构学习, 预训练语言模型, Text-to-SQL, 异构图

Abstract: To optimize Text-to-SQL generation problem based on heterogeneous graph encoder, the SELSQL model was proposed. Firstly, an end-to-end learning framework was employed by the model, and the Poincaré distance metric in hyperbolic space was used instead of the Euclidean metric as a way to optimize semantically enhanced pattern link graph constructed from the pre-trained language model using probe technology. Secondly, K-head weighted cosine similarity and graph regularization methods were used to learn the similarity metric graph so that the initial pattern link graph was iteratively optimized during training. Finally, the improved Relationship Graph ATtention network (RGAT) graph encoder and multi-head attention mechanism were used to encode the joint semantic pattern link graphs of the two modules, and SQL statement decoding was solved using a grammar-based neural semantic decoder and a predefined structured language. Experimental results on Spider dataset show that when using ELECTRA-large pre-training model, the accuracy of SELSQL model is increased by 2.5 percentage points compared with the best baseline model, which has a great improvement effect on the generation of complex SQL statements, and has better robustness in more general usage scenarios.

Key words: schema linking, graph structure learning, pre-trained language model, Text-to-SQL, heterogeneous graph

中图分类号: