Precise Learning of Source Code Contextual Semantics via Hierarchical Dependence Structure and Graph Attention Networks

被引:11
|
作者
Zhao, Zhehao [1 ]
Yang, Bo [2 ]
Li, Ge [1 ]
Liu, Huai [3 ]
Jin, Zhi [1 ]
机构
[1] Peking Univ, Key Lab High Confidence Software Technol, Beijing 100871, Peoples R China
[2] Beijing Forestry Univ, Sch Informat Sci & Technol, Beijing 100083, Peoples R China
[3] Swinburne Univ Technol, Dept Comp Technol, Hawthorn, Vic 3122, Australia
基金
澳大利亚研究理事会; 中国国家自然科学基金; 国家重点研发计划;
关键词
Graph neural network; Program analysis; Deep learning; Abstract syntax Tree; Control flow graph; NEURAL-NETWORK;
D O I
10.1016/j.jss.2021.111108
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Deep learning is being used extensively in a variety of software engineering tasks, e.g., program classification and defect prediction. Although the technique eliminates the required process of feature engineering, the construction of source code model significantly affects the performance on those tasks. Most recent works was mainly focused on complementing AST-based source code models by introducing contextual dependencies extracted from CFG. However, all of them pay little attention to the representation of basic blocks, which are the basis of contextual dependencies. In this paper, we integrated AST and CFG and proposed a novel source code model embedded with hierarchical dependencies. Based on that, we also designed a neural network that depends on the graph attention mechanism. Specifically, we introduced the syntactic structural of the basic block, i.e., its corresponding AST, in source code model to provide sufficient information and fill the gap. We have evaluated this model on three practical software engineering tasks and compared it with other state-of-the-art methods. The results show that our model can significantly improve the performance. For example, compared to the best performing baseline, our model reduces the scale of parameters by 50% and achieves 4% improvement on accuracy on program classification task. (c) 2021 Elsevier Inc. All rights reserved.
引用
收藏
页数:13
相关论文
共 47 条
  • [1] Precise Learning of Source Code Contextual Semantics via Hierarchical Dependence Structure and Graph Attention Networks
    Zhao, Zhehao
    Yang, Bo
    Li, Ge
    Liu, Huai
    Jin, Zhi
    JOURNAL OF SYSTEMS AND SOFTWARE, 2022, 184
  • [2] Automatic source code summarization with graph attention networks
    Zhou, Yu
    Shen, Juanjuan
    Zhang, Xiaoqing
    Yang, Wenhua
    Han, Tingting
    Chen, Taolue
    JOURNAL OF SYSTEMS AND SOFTWARE, 2022, 188
  • [3] Learning Contextual Dependence With Convolutional Hierarchical Recurrent Neural Networks
    Zuo, Zhen
    Shuai, Bing
    Wang, Gang
    Liu, Xiao
    Wang, Xingxing
    Wang, Bing
    Chen, Yushi
    IEEE TRANSACTIONS ON IMAGE PROCESSING, 2016, 25 (07) : 2983 - 2996
  • [4] Learning for mismatch removal via graph attention networks
    Jiang, Xingyu
    Wang, Yang
    Fan, Aoxiang
    Ma, Jiayi
    ISPRS JOURNAL OF PHOTOGRAMMETRY AND REMOTE SENSING, 2022, 190 : 181 - 195
  • [5] Learning graph structure via graph convolutional networks
    Zhang, Qi
    Chang, Jianlong
    Meng, Gaofeng
    Xu, Shibiao
    Xiang, Shiming
    Pan, Chunhong
    PATTERN RECOGNITION, 2019, 95 : 308 - 318
  • [6] A unified structure learning framework for graph attention networks
    Yuan, Jinliang
    Cao, Meng
    Cheng, Hao
    Yu, Hualei
    Xie, Junyuan
    Wang, Chongjun
    NEUROCOMPUTING, 2022, 495 : 194 - 204
  • [7] Reinforcement-Learning-Guided Source Code Summarization Using Hierarchical Attention
    Wang, Wenhua
    Zhang, Yuqun
    Sui, Yulei
    Wan, Yao
    Zhao, Zhou
    Wu, Jian
    Yu, Philip S.
    Xu, Guandong
    IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2022, 48 (01) : 102 - 119
  • [8] Learning Bi-Typed Multi-Relational Heterogeneous Graph Via Dual Hierarchical Attention Networks
    Zhao, Yu
    Wei, Shaopeng
    Du, Huaming
    Chen, Xingyan
    Li, Qing
    Zhuang, Fuzhen
    Liu, Ji
    Kou, Gang
    IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, 2023, 35 (09) : 9054 - 9066
  • [9] CPGBERT: An Effective Model for Defect Detection by Learning Program Semantics via Code Property Graph
    Liu, Jingqiang
    Zhu, Xiaoxi
    Liu, Chaoge
    Cui, Xiang
    Liu, Qixu
    2022 IEEE INTERNATIONAL CONFERENCE ON TRUST, SECURITY AND PRIVACY IN COMPUTING AND COMMUNICATIONS, TRUSTCOM, 2022, : 274 - 282
  • [10] AttPool: Towards Hierarchical Feature Representation in Graph Convolutional Networks via Attention Mechanism
    Huang, Jingjia
    Li, Zhangheng
    Li, Nannan
    Liu, Shan
    Li, Ge
    2019 IEEE/CVF INTERNATIONAL CONFERENCE ON COMPUTER VISION (ICCV 2019), 2019, : 6489 - 6498