作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2025, Vol. 51 ›› Issue (5): 114-123. doi: 10.19678/j.issn.1000-3428.0069127

• 人工智能与模式识别 • 上一篇    下一篇

面向跨域自然语言生成SQL语句的超图神经网络

郝志峰1,2, 黎阳霖1, 许柏炎1, 蔡瑞初1   

  1. 1. 广东工业大学计算机学院, 广东 广州 510006;
    2. 汕头大学理学院, 广东 汕头 515063
  • 收稿日期:2023-12-29 修回日期:2024-02-24 出版日期:2025-05-15 发布日期:2024-05-22
  • 通讯作者: 许柏炎,E-mail:hpakyim@gmail.com E-mail:hpakyim@gmail.com
  • 基金资助:
    科技创新2030-“新一代人工智能”重大项目(2021ZD0111501);国家优秀青年科学基金(62122022);国家自然科学基金(61876043,61976052,62206064)。

Hypergraph Neural Networks for Cross-domain Text-to-SQL

HAO Zhifeng1,2, LI Yanglin1, XU Boyan1, CAI Ruichu1   

  1. 1. School of Computer, Guangdong University of Technology, Guangzhou 510006, Guangdong, China;
    2. School of Science, Shantou University, Shantou 515063, Guangdong, China
  • Received:2023-12-29 Revised:2024-02-24 Online:2025-05-15 Published:2024-05-22

摘要: 近年来,图神经网络(GNN)广泛-应用于跨域自然语言生成结构化查询语言(SQL)语句(Text-to-SQL)的编码器。基于GNN的编码过程通过捕获数据库架构和自然语言问题之间的关联信息,大幅提高生成模型在跨域SQL语句生成下的泛化性。现有的GNN方法在异构图结构编码学习过程中存在缺陷,以节点为中心进行数据库架构和自然语言问题的链接预测,在复杂语义场景下容易出现错配。针对这一问题,提出一种面向跨域Text-to-SQL的异构图学习框架。框架针对异构图以边为中心学习的过程提出关系边子图构建和边超图注意力网络,有效学习异构图中关系边与节点的差异化结构特征,实现复杂语义场景下SQL语句正确生成。为验证所提框架的有效性,在多个跨域Text-to-SQL数据集上进行充分实验对比。结果表明,相较于基线,该框架在F1值和完全匹配准确率(EMA)指标上均取得显著提升,且在复杂跨域场景下具有更强的泛化性。

关键词: 自然语言处理, 自然语言生成SQL语句解析, 深度学习, 图构建, 图神经网络

Abstract: Graph Neural Network (GNN) have been widely used as encoders in recent years for cross-domain Text-to-SQL. The encoding process based on GNN substantially improves the generalization of generative models under cross-domain Text-to-SQL by capturing the association information between database schema and natural language questions. Existing GNN approaches have limitations in the heterogeneous graph structure encoding learning process, and the node-centered linking prediction of database schema and natural language questions is prone to mismatch in complex semantic scenarios. To address this issue, we propose a heterogeneous graph learning framework for cross-domain Text-to-SQL. We propose relational edge subgraph construction and edge hypergraph attention network for the edge-centered learning process of heterogeneous graphs, to effectively learn the differentiated structural features of relational edges and nodes in heterogeneous graphs, and to implement the effective generation of Structured Query Language (SQL) statements in complex semantic scenarios. To validate the effectiveness of the proposed framework, sufficient experimental comparisons are conducted on multiple cross-domain Text-to-SQL datasets. The results demonstrate that compared with the existing GNN baseline algorithms, the framework achieves significant improvement in both F1 value and Exact Matching Accuracy (EMA) metrics, and has stronger generalization in complex cross-domain scenarios.

Key words: Natural Language Processing (NLP), Text-to-SQL parsing, deep learning, graph construction, Graph Neural Network (GNN)

中图分类号: