Journal of Computer Applications ›› 2024, Vol. 44 ›› Issue (9): 2689-2695.DOI: 10.11772/j.issn.1001-9081.2023091360

• Artificial intelligence • Previous Articles     Next Articles

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

Xianglan WU, Yang XIAO, Mengying LIU, Mingming LIU()   

  1. College of Software,Nankai University,Tianjin 300457,China
  • Received:2023-10-09 Revised:2023-12-24 Accepted:2023-12-26 Online:2024-03-15 Published:2024-09-10
  • Contact: Mingming LIU
  • 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.

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

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

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

Abstract:

To optimize Text-to-SQL generation performance based on heterogeneous graph encoder, 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 distance metric to optimize semantically enhanced schema linking graph constructed by the pre-trained language model using probe technology. Secondly, K-head weighted cosine similarity and graph regularization method were used to learn the similarity metric graph so that the initial schema linking graph was iteratively optimized during training. Finally, the improved Relational Graph ATtention network (RGAT) graph encoder and multi-head attention mechanism were used to encode the joint semantic schema linking graphs of the two modules, and Structured Query Language (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.

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

摘要:

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

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

CLC Number: