Pyramid Attention For Source Code Summarization

被引:0
|
作者
Chai, Lei [1 ]
Li, Ming [1 ]
机构
[1] Nanjing Univ, Natl Key Lab Novel Software Technol, Nanjing 210023, Peoples R China
关键词
D O I
暂无
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
This paper presents a multi-granularity method for source code summarization, which generates a concise functional description for the given code snippet. We notice that skilled programmers write and read source codes hierarchically and pay close attention to conceptual entities like statements, tokens, sub-tokens, and the mapping relations between them. The entities have specific emphasis according to their granularities, e.g., statements in coarse-granularity reveal the global logical semantics of code, and the sub-tokens in fine-granularity are more related to the textual semantics. Driven by this observation, we demonstrate that a multi-granularity formulation incorporating these conceptual entities benefit the code summarization task. Concretely, the source code is transformed into a pyramidal representation, and then a pyramid attention mechanism is applied for efficient feature aggregation among different hierarchies in it. We instantiate our multi-granularity method using the proposed pyramid attention and name it PA-former (Pyramid Attention transformer). We evaluated it on two source code summarization benchmarks where it surpasses the prior works and achieves new state-of-the-art results. Our code and data are available at https://github.com/leichainju/pa-former.
引用
收藏
页数:13
相关论文
共 50 条
  • [1] A Convolutional Attention Network for Extreme Summarization of Source Code
    Allamanis, Miltiadis
    Peng, Hao
    Sutton, Charles
    [J]. INTERNATIONAL CONFERENCE ON MACHINE LEARNING, VOL 48, 2016, 48
  • [2] Automatic source code summarization with graph attention networks
    Zhou, Yu
    Shen, Juanjuan
    Zhang, Xiaoqing
    Yang, Wenhua
    Han, Tingting
    Chen, Taolue
    [J]. JOURNAL OF SYSTEMS AND SOFTWARE, 2022, 188
  • [3] Source Code Summarization Using Attention-based Keyword Memory Networks
    Choi, YunSeok
    Kim, Suah
    Lee, Jee-Hyong
    [J]. 2020 IEEE INTERNATIONAL CONFERENCE ON BIG DATA AND SMART COMPUTING (BIGCOMP 2020), 2020, : 564 - 570
  • [4] 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
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2022, 48 (01) : 102 - 119
  • [5] Autofolding for Source Code Summarization
    Fowkes, Jaroslav
    Chanthirasegaran, Pankajan
    Ranca, Razvan
    Allamanis, Miltiadis
    Lapata, Mirella
    Sutton, Charles
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2017, 43 (12) : 1095 - 1109
  • [6] Towards Modeling Human Attention from Eye Movements for Neural Source Code Summarization
    Bansal, Aakash
    Sharif, Bonita
    McMillan, Collin
    [J]. Proceedings of the ACM on Human-Computer Interaction, 2023, 7 (ETRA)
  • [7] Distilled GPT for source code summarization
    Chia-Yi Su
    Collin McMillan
    [J]. Automated Software Engineering, 2024, 31
  • [8] TASSAL: Autofolding for Source Code Summarization
    Fowkes, Jaroslav
    Chanthirasegaran, Pankajan
    Ranca, Razvan
    Allamanis, Miltiadis
    Lapata, Mirella
    Sutton, Charles
    [J]. 2016 IEEE/ACM 38TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING COMPANION (ICSE-C), 2016, : 649 - 652
  • [9] Recommendations for Datasets for Source Code Summarization
    LeClair, Alex
    McMillan, Collin
    [J]. 2019 CONFERENCE OF THE NORTH AMERICAN CHAPTER OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS: HUMAN LANGUAGE TECHNOLOGIES (NAACL HLT 2019), VOL. 1, 2019, : 3931 - 3937
  • [10] Distilled GPT for source code summarization
    Su, Chia-Yi
    McMillan, Collin
    [J]. AUTOMATED SOFTWARE ENGINEERING, 2024, 31 (01)