mlsanityData to 7 Oct 2026

API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentations

arXiv 2103.10668 ↗First posted 19 Mar 2021cs.SE cs.CL cs.LGcited by 10

Not on the map. Why?

Abstract (arXiv)

Code comments can help in program comprehension and are considered as important artifacts to help developers in software maintenance. However, the comments are mostly missing or are outdated, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. The recent models explore the integration of external knowledge resources such as Unified Modeling Language class diagrams to improve the generated comments. In this paper, we propose API2Com, a model that leverages the Application Programming Interface Documentations (API Docs) as a knowledge resource for comment generation. The API Docs include the description of the methods in more details and therefore, can provide better context in the generated comments. The API Docs are used along with the code snippets and Abstract Syntax Trees in our model. We apply the model on a large Java dataset of over 130,000 methods and evaluate it using both Transformer and RNN-base architectures. Interestingly, when API Docs are used, the performance increase is negligible. We therefore run different experiments to reason about the results. For methods that only contain one API, adding API Docs improves the results by 4% BLEU score on average (BLEU score is an automatic evaluation metric used in machine translation). However, as the number of APIs that are used in a method increases, the performance of the model in generating comments decreases due to long documentations used in the input. Our results confirm that the API Docs can be useful in generating better comments, but, new techniques are required to identify the most informative ones in a method rather than using all documentations simultaneously.

Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Builds on 24 of its 48 references that are in the map. First posted on arXiv 19 Mar 2021.

Builds on

24 of 48 references.

References · 24

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  4. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
  5. 2014Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modelingcited by 2,341
  6. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  7. 2018Hierarchical Neural Story Generationcited by 1,182
  8. 2018Self-Attention with Relative Position Representationscited by 1,112
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  10. 2019Learning Deep Transformer Models for Machine Translationcited by 309
  11. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
  12. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
12 more
  1. 2020A Transformer-based Approach for Source Code Summarizationcited by 129
  2. 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 99
  3. 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 90
  4. 2020Improved Code Summarization via a Graph Neural Networkcited by 79
  5. 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 76
  6. 2019Code Generation as a Dual Task of Code Summarizationcited by 62
  7. 2019Retrieve and Refine: Exemplar-based Neural Comment Generationcited by 36
  8. 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
  9. 2019Automatic Source Code Summarization with Extended Tree-LSTMcited by 28
  10. 2019Tree-Transformer: A Transformer-Based Method for Correction of Tree-Structured Datacited by 20
  11. 2019Automatic Code Summarization: A Systematic Literature Reviewcited by 18
  12. 2020TranS^3: A Transformer-based Framework for Unifying Code Summarization and Code Searchcited by 11

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2021: 1; 2022: 2; 2023: 4; 2024: 1; 2025: 1; 2026: 1.

10 papers.