Cited by 69Software Engineering ResearchTopic ModelingModel-Driven Software Engineering Techniques

Retrieve and refine: exemplar-based neural comment generation

Open access
Wei, Bolin, Li, Yongmin, Li, Ge, Xia, Xin, Jin, Zhi·2020·Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering

Abstract

Code comment generation which aims to automatically generate natural language descriptions for source code, is a crucial task in the field of automatic software development. Traditional comment generation methods use manually-crafted templates or information retrieval (IR) techniques to generate summaries for source code. In recent years, neural network-based methods which leveraged acclaimed encoder-decoder deep learning framework to learn comment generation patterns from a large-scale parallel code corpus, have achieved impressive results. However, these emerging methods only take code-related information as input. Software reuse is common in the process of software development, meaning that comments of similar code snippets are helpful for comment generation. Inspired by the IR-based and template-based approaches, in this paper, we propose a neural comment generation approach where we use the existing comments of similar code snippets as exemplars to guide comment generation. Specifically, given a piece of code, we first use an IR technique to retrieve a similar code snippet and treat its comment as an exemplar. Then we design a novel seq2seq neural network that takes the given code, its AST, its similar code, and its exemplar as input, and leverages the information from the exemplar to assist in the target comment generation based on the semantic similarity between the source code and the similar code. We evaluate our approach on a large-scale Java corpus, which contains about 2M samples, and experimental results demonstrate that our model outperforms the state-of-the-art methods by a substantial margin.

Integrity signals

Registry

Crossref · 10.1145/3324884.3416578

Cites

2 of 2 references verified0 citation errors · 0 not checkable

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • Existing works mainly focus on the evaluation of LLMs on one or two tasks and do not discuss the construction of in-context demonstrations in-depth.

    “However, these works mainly focus on the evaluation of LLMs on one or two tasks and do not discuss the construction of in-context demonstrations in-depth.”

Cites

Flagged first, then by citations

Cited by

Sorted by citations

Authors
Wei, B., Li, Y., Li, G., Xia, X., & Jin, Z.
Affiliations
  • Peking University (CN)
  • Monash University (AU)
Venue
Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering
Publisher
ACM
Published
2020-12-21
Pages
349-360
OpenAlex
W4249122235
Cited by
69
References
2
Citations by year
2026: 3 · 2025: 13 · 2024: 14 · 2023: 19 · 2022: 17 · 2021: 3
FWCI
7.39
Type
conference paper
Language
en
Open access
Locations
  • IEEE/ACM International Conference on Automated Software Engineering (ASE) (publishedVersion)
  • Brunel University Research Archive (BURA) (Brunel University London) (submittedVersion)
Funders
  • National Key R&D Program (2018YFB1003904)
  • National Natural Science Foundation of China (61832009, 61620106007, 61751210)
  • Australian Research Council's Discovery Early Career Researcher Award (DECRA) (DE200100021)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Software › Model-Driven Software Engineering Techniques
Keywords
code comment generation, information retrieval, sequence-to-sequence models, abstract syntax tree, semantic similarity, Java code, software reuse

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review