Automatic Comment Generation via Multi-Pass Deliberation

09/14/2022
by   Fangwen Mu, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/26/2023

EditSum: A Retrieve-and-Edit Framework for Source Code Summarization

Existing studies show that code summaries help developers understand and...
research
02/14/2023

Developer-Intent Driven Code Comment Generation

Existing automatic code comment generators mainly focus on producing a g...
research
08/09/2018

Image Inspired Poetry Generation in XiaoIce

Vision is a common source of inspiration for poetry. The objects and the...
research
03/03/2023

APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentation

Code comments are significantly helpful in comprehending software progra...
research
04/28/2023

Outline, Then Details: Syntactically Guided Coarse-To-Fine Code Generation

For a complicated algorithm, its implementation by a human programmer us...
research
10/29/2018

Learning Comment Generation by Leveraging User-Generated Data

Existing models on open-domain comment generation produce repetitive and...
research
12/20/2022

ReCode: Robustness Evaluation of Code Generation Models

Code generation models have achieved impressive performance. However, th...

Please sign up or login with your details

Forgot password? Click here to reset