Retrieve and Refine: Exemplar-based Neural Comment Generation
Bolin Wei

TL;DR
This paper introduces an exemplar-based neural approach for code comment generation that leverages similar existing comments to improve the quality of generated comments, outperforming previous methods on a large Java dataset.
Contribution
The paper proposes a novel exemplar-guided neural comment generation method that incorporates similar code comments to enhance generation accuracy.
Findings
Significant improvement over state-of-the-art methods.
Effective retrieval of similar code comments enhances generation quality.
Validated on a large-scale Java corpus.
Abstract
Code comment generation is a crucial task in the field of automatic software development. Most previous neural comment generation systems used an encoder-decoder neural network and encoded only information from source code as input. Software reuse is common in software development. However, this feature has not been introduced to existing systems. Inspired by the traditional IR-based approaches, we propose to use the existing comments of similar source code as exemplars to guide the comment generation process. Based on an open source search engine, we first retrieve a similar code and treat its comment as an exemplar. Then we applied a seq2seq neural network to conduct an exemplar-based comment generation. We evaluate our approach on a large-scale Java corpus, and experimental results demonstrate that our model significantly outperforms the state-of-the-art methods.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Topic Modeling
