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 条
  • [1] A RECURRENT GRAPH NEURAL NETWORK FOR MULTI-RELATIONAL DATA
    Ioannidis, Vassilis N.
    Marques, Antonio G.
    Giannakis, Georgios B.
    2019 IEEE INTERNATIONAL CONFERENCE ON ACOUSTICS, SPEECH AND SIGNAL PROCESSING (ICASSP), 2019, : 8157 - 8161
  • [2] Graph Neural Network for Context-Aware Recommendation
    Sattar, Asma
    Bacciu, Davide
    NEURAL PROCESSING LETTERS, 2023, 55 (05) : 5357 - 5376
  • [3] Graph Neural Network for Context-Aware Recommendation
    Asma Sattar
    Davide Bacciu
    Neural Processing Letters, 2023, 55 : 5357 - 5376
  • [4] A multi-relational neighbors constructed graph neural network for heterophily graph learning
    Xu, Huan
    Gao, Yan
    Liu, Quanle
    Bie, Mei
    Che, Xiangjiu
    APPLIED INTELLIGENCE, 2025, 55 (01)
  • [5] Relation-aware Graph Convolutional Networks for Multi-relational Network Alignment
    Fang, Yujie
    Li, Xin
    Ye, Rui
    Tan, Xiaoyan
    Zhao, Peiyao
    Wang, Mingzhong
    ACM TRANSACTIONS ON INTELLIGENT SYSTEMS AND TECHNOLOGY, 2023, 14 (02)
  • [6] Mixed-Curvature Multi-Relational Graph Neural Network for Knowledge Graph Completion
    Wang, Shen
    Wei, Xiaokai
    dos Santos, Cicero Nogueira
    Wang, Zhiguo
    Nallapati, Ramesh
    Arnold, Andrew
    Xiang, Bing
    Yu, Philip S.
    Cruz, Isabel F.
    PROCEEDINGS OF THE WORLD WIDE WEB CONFERENCE 2021 (WWW 2021), 2021, : 1761 - 1771
  • [7] A Vectorized Relational Graph Convolutional Network for Multi-Relational Network Alignment
    Ye, Rui
    Li, Xin
    Fang, Yujie
    Zang, Hongyu
    Wang, Mingzhong
    PROCEEDINGS OF THE TWENTY-EIGHTH INTERNATIONAL JOINT CONFERENCE ON ARTIFICIAL INTELLIGENCE, 2019, : 4135 - 4141
  • [8] SDGNN: Structure-aware Dual Graph Neural Network for Code Summarization
    Hao, Zhifeng
    Lin, Zonghao
    Zhang, Shengqiang
    Xu, Boyan
    Cai, Ruichu
    INTERNATIONAL JOURNAL OF MACHINE LEARNING AND CYBERNETICS, 2025,
  • [9] Mining Relational Context-aware Graph for Rater Identification
    Shi, Yue
    Larson, Martha
    Hanjalic, Alan
    PROCEEDINGS OF THE RECSYS'2011 ACM CHALLENGE ON CONTEXT-AWARE MOVIE RECOMMENDATION (CAMRA2011), 2011, : 53 - 59
  • [10] Multi-Relational Graph Neural Network for Out-of-Domain Link Prediction
    Sattar, Asma
    Deligiorgis, Georgios
    Trincavelli, Marco
    Bacciu, Davide
    2024 INTERNATIONAL JOINT CONFERENCE ON NEURAL NETWORKS, IJCNN 2024, 2024,