Lune

ICSE2022Top-tier venue

On the Evaluation of Neural Code Summarization

Ensheng Shi, Yanlin Wang, Lun Du, Junjie Chen, Shi Han, Hongyu Zhang, Dongmei Zhang, Hongbin Sun

Abstract

Source code summaries are important for program comprehension and maintenance. However, there are plenty of programs with missing, outdated, or mismatched summaries. Recently, deep learning techniques have been exploited to automatically generate summaries for given code snippets. To achieve a profound understanding of how far we are from solving this problem and provide suggestions to future research, in this paper, we conduct a systematic and in-depth analysis of 5 state-of-the-art neural code summarization models on 6 widely used BLEU variants, 4 pre-processing operations and their combinations, and 3 widely used datasets. The evaluation results show that some important factors have a great influence on the model evaluation, especially on the performance of models and the ranking among the models. However, these factors might be easily overlooked. Specifically, (1) the BLEU metric widely used in existing work of evaluating code summarization models has many variants. Ignoring the differences among these variants could greatly affect the validity of the claimed results. Besides, we discover and resolve an important and previously unknown bug in BLEU calculation in a commonly-used software package. Furthermore, we conduct human evaluations and find that the metric BLEU-DC is most correlated to human perception; (2) code preprocessing choices can have a large (from -18% to +25%) impact on the summarization performance and should not be neglected. We also explore the aggregation of pre-processing combinations and boost the performance of models; (3) some important characteristics of datasets (corpus sizes, data splitting methods, and duplication ratios) have a significant impact on model evaluation. Based on the experimental results, we give actionable suggestions for evaluating code summarization and choosing the best method in different scenarios. We also build a shared code summarization toolbox to facilitate future research.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

20 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Code Summarization with Structure-induced Transformer cites Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning
  • Code Summarization with Structure-induced Transformer cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites Code Summarization with Structure-induced Transformer
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites Retrieval-based neural source code summarization
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites Reassessing automatic evaluation metrics for code summarization tasks
  • Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization) cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization) cites Retrieval-based neural source code summarization
  • Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization) cites Reassessing automatic evaluation metrics for code summarization tasks
  • Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization) cites Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Models
  • Reassessing automatic evaluation metrics for code summarization tasks cites Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning
  • Reassessing automatic evaluation metrics for code summarization tasks cites Retrieval-based neural source code summarization
  • What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs? cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs? cites Retrieval-based neural source code summarization
  • Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Models cites Reassessing automatic evaluation metrics for code summarization tasks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers20

  1. OctoPack: Instruction Tuning Code Large Language ModelsNiklas Muennighoff, Qian Liu, Armel Randy Zebaze, Qinkai Zheng et al.ICLR 2024 · 203 citations
  2. Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language ModelsToufique Ahmed, Supriyo Ghosh, Chetan Bansal, Thomas Zimmermann et al.ICSE 2023 · 93 citations
  3. What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs?Shuzheng Gao, Xin-Cheng Wen, Cuiyun Gao, Wenxuan Wang et al.ASE 2023 · 80 citations
  4. Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)Toufique Ahmed, Kunal Suresh Pai, Premkumar T. Devanbu, Earl T. BarrICSE 2024 · 71 citations
  5. Are we building on the rock? on the importance of data preprocessing for code summarizationLin Shi, Fangwen Mu, Xiao Chen, Song Wang et al.FSE 2022 · 65 citations

Builds on11

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  2. Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ICSE 2020 · 242 citations
  3. Reassessing automatic evaluation metrics for code summarization tasksDevjeet Roy, Sarah Fakhoury, Venera ArnaoudovaFSE 2021 · 103 citations
  4. Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual LearningWei Ye, Rui Xie, Jinglei Zhang, Tianxiang Hu et al.WWW 2020 · 83 citations
  5. Code Summarization with Structure-induced TransformerHongqiu Wu, Hai Zhao, Min ZhangACL Findings 2021 · 70 citations

Related papers

  1. SimLLM: Calculating Semantic Similarity in Code Summaries using a Large Language Model-Based ApproachXin Jin, Zhiqiang LinFSE 2024 · 8 citations
  2. How Effectively Do Code Language Models Understand Poor-Readability Code?Chao Hu, Yitian Chai, Hao Zhou, Fandong Meng et al.ASE 2024 · 3 citations
  3. Calibration of Large Language Models on Code SummarizationYuvraj Virk, Premkumar T. Devanbu, Toufique AhmedFSE 2025 · 5 citations
  4. Evaluating Code Summarization Techniques: A New Metric and an Empirical CharacterizationAntonio Mastropaolo, Matteo Ciniselli, Massimiliano Di Penta, Gabriele BavotaICSE 2024 · 28 citations
  5. Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 citations
Dusk over the sea between two cliffs drawn in fine vertical lines