Context-aware code summarization with multi-relational graph neural network

被引:0
|
作者
Wang, Yanlin [1 ]
Shi, Ensheng [2 ]
Du, Lun [3 ]
Yang, Xiaodi [4 ]
Hu, Yuxuan [5 ]
Wang, Yanli [1 ]
Guo, Daya [1 ]
Han, Shi [3 ]
Zhang, Hongyu [6 ]
Zhang, Dongmei [3 ]
机构
[1] Sun Yat Sen Univ, Guangzhou, Peoples R China
[2] Xi An Jiao Tong Univ, Xian, Peoples R China
[3] Microsoft Res Asia, Beijing, Peoples R China
[4] Univ Hong Kong, Hong Kong, Peoples R China
[5] Beijing Univ Technol, Beijing, Peoples R China
[6] Chongqing Univ, Chongqing, Peoples R China
关键词
Source code summarization; Unified modeling language; Graph neural network; Transformer;
D O I
10.1007/s10515-025-00490-z
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Source code summaries are short natural language descriptions of code snippets that help developers better understand and maintain source code. There has been a surge of work on automatic code summarization to reduce the burden of writing summaries manually. However, contemporary approaches only leverage the information within the boundary of the method being summarized (i.e., local context), and ignore the broader context that could assist with code summarization. This paper explores two global contexts, namely intra-class and inter-class contexts, and proposes CoCoSUM: Context-Aware Code Summarization with Multi-Relational Graph Neural Network. CoCoSUM first incorporates class names as the intra-class context to generate the class semantic embeddings. Then, relevant Unified Modeling Language (UML) class diagrams are extracted as inter-class context and are encoded into the class relational embeddings using a novel Multi-Relational Graph Neural Network (MRGNN). Class semantic embeddings and class relational embeddings, together with the outputs from code token encoder and AST encoder, are passed to a decoder armed with a two-level attention mechanism to generate high-quality, context-aware code summaries. Experimental results show that CoCoSUM outperforms state-of-the-art methods and the global contexts adopted in CoCoSUM can also strengthen existing code summarization models. Our replication package is anonymously available at https://github.com/DeepSoftwareAnalytics/cocosum.
引用
收藏
页数:26
相关论文
共 50 条
  • [21] Multi-view learning for context-aware extractive summarization
    Yang, Zhenyu
    Yang, Jie
    Yecies, Brian
    Li, Wanqing
    2020 IEEE SYMPOSIUM SERIES ON COMPUTATIONAL INTELLIGENCE (SSCI), 2020, : 1762 - 1769
  • [22] Context-Aware Knowledge Graph Framework for Traffic Speed Forecasting Using Graph Neural Network
    Zhang, Yatao
    Wang, Yi
    Gao, Song
    Raubal, Martin
    IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS, 2025, 26 (03) : 3885 - 3902
  • [23] Multi-Relational Graph Convolution Network for Stock Movement Prediction
    Zhou, Zihao
    Zhang, Le
    Zha, Rui
    Hao, Qiming
    Xu, Tong
    Wu, Di
    Chen, Enhong
    2022 INTERNATIONAL JOINT CONFERENCE ON NEURAL NETWORKS (IJCNN), 2022,
  • [24] Improved Code Summarization via a Graph Neural Network
    LeClair, Alexander
    Haque, Sakib
    Wu, Lingfei
    McMillan, Collin
    2020 IEEE/ACM 28TH INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION, ICPC, 2020, : 184 - 195
  • [25] Context-Aware Structural Adaptive Graph Neural Networks
    Chen, Jiakun
    Xu, Jie
    Hu, Jiahui
    Qiao, Liqiang
    Wang, Shuo
    Huang, Feiran
    Li, Chaozhuo
    PRICAI 2024: TRENDS IN ARTIFICIAL INTELLIGENCE, PT I, 2025, 15281 : 467 - 479
  • [26] Medical Triage Chatbot Diagnosis Improvement via Multi-relational Hyperbolic Graph Neural Network
    Liu, Zheng
    Li, Xiaohan
    You, Zeyu
    Yang, Tao
    Fan, Wei
    Yu, Philip
    SIGIR '21 - PROCEEDINGS OF THE 44TH INTERNATIONAL ACM SIGIR CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION RETRIEVAL, 2021, : 1965 - 1969
  • [27] Context-Aware Surveillance Video Summarization
    Zhang, Shu
    Zhu, Yingying
    Roy-Chowdhury, Amit K.
    IEEE TRANSACTIONS ON IMAGE PROCESSING, 2016, 25 (11) : 5469 - 5478
  • [28] MDGNN: Multi-Relational Dynamic Graph Neural Network for Comprehensive and Dynamic Stock Investment Prediction
    Qian, Hao
    Zhou, Hongting
    Zhao, Qian
    Chen, Hao
    Yao, Hongxiang
    Wang, Jingwei
    Liu, Ziqi
    Yu, Fei
    Zhang, Zhiqiang
    Zhou, Jun
    THIRTY-EIGHTH AAAI CONFERENCE ON ARTIFICIAL INTELLIGENCE, VOL 38 NO 13, 2024, : 14642 - 14650
  • [29] Multi-relational Heterogeneous Graph Attention Networks for Knowledge-Aware Recommendation
    Wang, Youxuan
    Meng, Shunmei
    Yan, Qi
    Zhang, Jing
    WEB AND BIG DATA, PT IV, APWEB-WAIM 2023, 2024, 14334 : 108 - 123
  • [30] Graph Heterogeneous Multi-Relational Recommendation
    Chen, Chong
    Ma, Weizhi
    Zhang, Min
    Wang, Zhaowei
    He, Xiuqiang
    Wang, Chenyang
    Liu, Yiqun
    Ma, Shaoping
    THIRTY-FIFTH AAAI CONFERENCE ON ARTIFICIAL INTELLIGENCE, THIRTY-THIRD CONFERENCE ON INNOVATIVE APPLICATIONS OF ARTIFICIAL INTELLIGENCE AND THE ELEVENTH SYMPOSIUM ON EDUCATIONAL ADVANCES IN ARTIFICIAL INTELLIGENCE, 2021, 35 : 3958 - 3966