Lune

ASE2022Top-tier venue

Automatic Comment Generation via Multi-Pass Deliberation

Fangwen Mu, Xiao Chen, Lin Shi, Song Wang, Qing Wang

Abstract

Deliberation is a common and natural behavior in human daily life. For example, when writing papers or articles, we usually first write drafts, and then iteratively polish them until satisfied. In light of such a human cognitive process, we propose DECOM, which is a multi-pass deliberation framework for automatic comment generation. DECOM consists of multiple Deliberation Models and one Evaluation Model. Given a code snippet, we first extract keywords from the code and retrieve a similar code fragment from a pre-defined corpus. Then, we treat the comment of the retrieved code as the initial draft and input it with the code and keywords into DECOM to start the iterative deliberation process. At each deliberation, the deliberation model polishes the draft and generates a new comment. The evaluation model measures the quality of the newly generated comment to determine whether to end the iterative process or not. When the iterative process is terminated, the best-generated comment will be selected as the target comment. Our approach is evaluated on two real-world datasets in Java (87K) and Python (108K), and experiment results show that our approach outperforms the state-of-the-art baselines. A human evaluation study also confirms the comments generated by DECOM tend to be more readable, informative, and useful.

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.

3 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

  • Developer-Intent Driven Code Comment Generation cites Retrieval-based neural source code summarization
  • Developer-Intent Driven Code Comment Generation cites EditSum: A Retrieve-and-Edit Framework for Source Code Summarization
  • ReACC: A Retrieval-Augmented Code Completion Framework cites EditSum: A Retrieve-and-Edit Framework for Source Code Summarization
  • EditSum: A Retrieve-and-Edit Framework for Source Code Summarization cites Retrieval-based neural source code summarization
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning cites Retrieval-based neural source code summarization
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning cites EditSum: A Retrieve-and-Edit Framework for Source Code Summarization
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context LearningMingyang Geng, Shangwen Wang, Dezun Dong, Haotian Wang et al.ICSE 2024 · 124 citations
  2. Developer-Intent Driven Code Comment GenerationFangwen Mu, Xiao Chen, Lin Shi, Song Wang et al.ICSE 2023 · 25 citations
  3. Learning in the Wild: Towards Leveraging Unlabeled Data for Effectively Tuning Pre-trained Code ModelsShuzheng Gao, Wenxin Mao, Cuiyun Gao, Li Li et al.ICSE 2024 · 15 citations

Builds on4

  1. Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ICSE 2020 · 242 citations
  2. ReACC: A Retrieval-Augmented Code Completion FrameworkShuai Lu, Nan Duan, Hojae Han, Daya Guo et al.ACL 2022 · 208 citations
  3. EditSum: A Retrieve-and-Edit Framework for Source Code SummarizationJia Li, Yongmin Li, Ge Li, Xing Hu et al.ASE 2021 · 55 citations
  4. Circle Loss: A Unified Perspective of Pair Similarity OptimizationYifan Sun, Changmao Cheng, Yuhan Zhang, Chi Zhang et al.CVPR 2020

Related papers

  1. Retrieve and Refine: Exemplar-based Neural Comment GenerationBolin Wei, Yongmin Li, Ge Li, Xin Xia et al.ASE 2020 · 68 citations
  2. SkCoder: A Sketch-based Approach for Automatic Code GenerationJia Li, Yongmin Li, Ge Li, Zhi Jin et al.ICSE 2023 · 50 citations
  3. Let the Comments Speak: A Multi-Agent Framework based on Large Language Model for Comment-Guided Code RefactoringZixuan Wang, Wutong Yu, Deyu ZhouACL Findings 2026
  4. From Draft to Precision: Iterative Agentic Framework for Intent-Aware Code SummarizationYifei Ge, Chunrong Fang, Zhenyu Chen, Juan ZhaiISSTA 2026
  5. CommentFinder: a simpler, faster, more accurate code review comments recommendationYang Hong, Chakkrit Tantithamthavorn, Patanamon Thongtanunam, Aldeida AletiFSE 2022 · 57 citations
Dusk over the sea between two cliffs drawn in fine vertical lines