Code summarization is to provide a high-level comment for a code snippet that typically describes the function and intent of the given code. Recent years have seen the successful application of data-driven code summarization. To improve the performance of the model, numerous approaches use Abstract Syntax Trees (ASTs) to represent the structural information of the code, which is considered by most researchers to be the main factor that distinguishes code from natural language. Then, such data-driven methods are trained on large-scale labeled datasets to obtain a model with strong generalization capabilities that can be applied to new examples. Nevertheless, we argue that state-of-the-art approaches suffer from two key weaknesses: (1) inefficient encoding of ASTs; (2) reliance on a large labeled corpus for model training. As a result, such drawbacks lead to (1) oversized model, slow training, information loss and instability; (2) inability to be applied to programming languages with only a small amount of labeled data. In light of these weaknesses, we propose PassSum, a code summarization approach that addresses the aforementioned weaknesses via (1) a novel input representation which contains an efficient AST encoding method; (2) introducing three pre-training objectives and pre-training our model with a large amount of (easy-to-obtain) unlabeled data under the guidance of self-supervised learning. Experimental results on code summarization for Java, Python and Ruby methods demonstrate the superiority of PassSum to state-of-the-art methods. Further experiments demonstrate that the input representation we use has both temporal and spatial advantages in addition to performance leadership. In addition, pre-training is also shown to make the model more generalizable with less labeled data, and also to speed up the convergence of the model during training.
Source Code Summarization with Structural Relative Position Guided Transformer
Harbin Institute of Technology (Shenzhen)(哈尔滨工业大学(深圳));Noah’s Ark Lab, Huawei Technologies(华为技术有限公司诺亚方舟实验室);The Chinese University of Hong Kong(香港中文大学)
What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Code
National Engineering Research Center for Big Data Technology and System, Services Computing Technology and System Lab, Cluster and Grid Computing Lab, HUST(华中科技大学(HUST)大数据技术与系统国家工程研究中心、服务计算技术与系统实验室、集群与网格计算实验室);School of Computer Science and Technology, Huazhong University of Science and Technology(华中科技大学计算机科学与技术学院);University of Newcastle(纽卡斯尔大学);School of Computer Science, University of Technology Sydney(悉尼科技大学计算机学院)
HGAdapter: Hypergraph-based Adapters in Language Models for Code Summarization and Clone Detection
Data Technology Group, Technology Research and Development Department, Guotai Haitong Securities, China(国泰君安证券数据技术部、技术研发部);School of Computer Science and Technology, East China Normal University, China(华东师范大学计算机科学与技术学院)
Improving Automatic Source Code Summarization via Deep Reinforcement Learning
Zhejiang University(浙江大学);Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences(中国科学院深圳先进技术研究院);University of Technology Sydney(悉尼科技大学);University of Illinois at Chicago(伊利诺伊大学芝加哥分校);Tsinghua University(清华大学)
GraphCodeBERT: Pre-training Code Representations with Data Flow
Sun Yat-sen University(中山大学);Microsoft Research Asia(微软亚洲研究院);Microsoft Devdiv(微软开发工具事业部);Microsoft STCA(微软中国科技中心);Beihang University(北京航空航天大学);Peking University(北京大学);Harbin Institute of Technology(哈尔滨工业大学)