Why My Code Summarization Model Does Not Work

Author:

Chen Qiuyuan1,Xia Xin2,Hu Han2,Lo David3,Li Shanping1

Affiliation:

1. College of Computer Science and Technology, Zhejiang University, Hangzhou, Zhejiang, China

2. Faculty of Information Technology, Monash University, Victoria, Australia

3. School of Information Systems, Singapore Management University, Singapore

Abstract

Code summarization aims at generating a code comment given a block of source code and it is normally performed by training machine learning algorithms on existing code block-comment pairs. Code comments in practice have different intentions. For example, some code comments might explain how the methods work, while others explain why some methods are written. Previous works have shown that a relationship exists between a code block and the category of a comment associated with it. In this article, we aim to investigate to which extent we can exploit this relationship to improve code summarization performance. We first classify comments into six intention categories and manually label 20,000 code-comment pairs. These categories include “what,” “why,” “how-to-use,” “how-it-is-done,” “property,” and “others.” Based on this dataset, we conduct an experiment to investigate the performance of different state-of-the-art code summarization approaches on the categories. We find that the performance of different code summarization approaches varies substantially across the categories. Moreover, the category for which a code summarization model performs the best is different for the different models. In particular, no models perform the best for “why” and “property” comments among the six categories. We design a composite approach to demonstrate that comment category prediction can boost code summarization to reach better results. The approach leverages classified code-category labeled data to train a classifier to infer categories. Then it selects the most suitable models for inferred categories and outputs the composite results. Our composite approach outperforms other approaches that do not consider comment categories and obtains a relative improvement of 8.57% and 16.34% in terms of ROUGE-L and BLEU-4 score, respectively.

Funder

Australian Research Council's Discovery Early Career Researcher Award

National Key R8D Program of China

NSFC Program

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Cited by 42 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Automated Mapping of Adaptive App GUIs from Phones to TVs;ACM Transactions on Software Engineering and Methodology;2023-12-22

2. A large-scale exploratory study of android sports apps in the google play store;Information and Software Technology;2023-12

3. A First Look at On-device Models in iOS Apps;ACM Transactions on Software Engineering and Methodology;2023-11-23

4. Snippet Comment Generation Based on Code Context Expansion;ACM Transactions on Software Engineering and Methodology;2023-11-23

5. An Extractive-and-Abstractive Framework for Source Code Summarization;ACM Transactions on Software Engineering and Methodology;2023-11-13

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3