Learning to Generate Code Comments from Class Hierarchies
Descriptive code comments are essential for supporting code comprehension and maintenance. We propose the task of automatically generating comments for overriding methods. We formulate a novel framework which accommodates the unique contextual and linguistic reasoning that is required for performing this task. Our approach features: (1) incorporating context from the class hierarchy; (2) conditioning on learned, latent representations of specificity to generate comments that capture the more specialized behavior of the overriding method; and (3) unlikelihood training to discourage predictions which do not conform to invariant characteristics of the comment corresponding to the overridden method. Our experiments show that the proposed approach is able to generate comments for overriding methods of higher quality compared to prevailing comment generation techniques.
Code (0)
등록된 구현이 없습니다.
Tasks
Comment GenerationDescriptiveSpecificitySimilar Papers 제목 키워드 기반
Leveraging Class Hierarchy for Code Comprehension
Object-oriented programming languages enable a hierarchical class structure, which provides rich contextual information to guide code comprehension and synthesis. In this work, we propose the novel task of generating com…
Towards Controlled and Diverse Generation of Article Comments
Much research in recent years has focused on automatic article commenting. However, few of previous studies focus on the controllable generation of comments. Besides, they tend to generate dull and commonplace comments, …
ArticlesComment GenerationDecoderDiversity+1Commenting with Copilot: A Taxonomy and Multi-Year Analysis of Student Code-Generation Specifications
As AI code tools become integrated into programming environments, students increasingly describe intended behavior in natural language and rely on these tools to generate code, shifting emphasis from code writing to spec…
Code GenerationAn Exploratory Study on LLM-Generated Code and Comments in Code Repositories
The use of LLMs in software development has become increasingly widespread on tasks such as code generation and summarization. Reports from large technology companies showed that around 20% to 30% of their code are gener…
Code GenerationLeveraging Generative AI: Improving Software Metadata Classification with Generated Code-Comment Pairs
In software development, code comments play a crucial role in enhancing code comprehension and collaboration. This research paper addresses the challenge of objectively classifying code comments as "Useful" or "Not Usefu…
Language ModellingLarge Language Model