API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentations
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
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2014Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modelingcited by 2,341
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2018Hierarchical Neural Story Generationcited by 1,182
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2019Learning Deep Transformer Models for Machine Translationcited by 309
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
12 more
- 2020A Transformer-based Approach for Source Code Summarizationcited by 129
- 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 99
- 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 90
- 2020Improved Code Summarization via a Graph Neural Networkcited by 79
- 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 76
- 2019Code Generation as a Dual Task of Code Summarizationcited by 62
- 2019Retrieve and Refine: Exemplar-based Neural Comment Generationcited by 36
- 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
- 2019Automatic Source Code Summarization with Extended Tree-LSTMcited by 28
- 2019Tree-Transformer: A Transformer-Based Method for Correction of Tree-Structured Datacited by 20
- 2019Automatic Code Summarization: A Systematic Literature Reviewcited by 18
- 2020TranS^3: A Transformer-based Framework for Unifying Code Summarization and Code Searchcited by 11
Built on by
Citing papers per year: 2021: 1; 2022: 2; 2023: 4; 2024: 1; 2025: 1; 2026: 1.
10 papers.
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 15
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2023Abstract Syntax Tree for Programming Language Understanding and Representation: How Far Are We?cited by 5
- 2023APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentationcited by 2
- 2021FACOS: Finding API Relevant Contents on Stack Overflow with Semantic and Syntactic Analysiscited by 1
- 2022LAMNER: Code Comment Generation Using Character Language Model and Named Entity Recognitioncited by 1
- 2026Precision in Practice: Knowledge Guided Code Summarizing Grounded in Industrial Expectationscited by 0
- 2026Precision in Practice: Knowledge Guided Code Summarizing Grounded in Industrial Expectations3 Feb 2026
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization1 Jul 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023Abstract Syntax Tree for Programming Language Understanding and Representation: How Far Are We?1 Dec 2023
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?22 May 2023
- 2023APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentation3 Mar 2023
- 2022An Extractive-and-Abstractive Framework for Source Code Summarization15 Jun 2022
- 2022LAMNER: Code Comment Generation Using Character Language Model and Named Entity Recognition5 Apr 2022
- 2021FACOS: Finding API Relevant Contents on Stack Overflow with Semantic and Syntactic Analysis14 Nov 2021