paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Developer-Intent Driven Code Comment Generation

开发者意图驱动的代码注释生成
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 2/10 · 该论文属于机器学习与程序语言交叉中的代码注释生成任务,但核心是意图感知的注释生成模型,并非静态分析、Agentic 程序分析、浮点程序分析或贝叶斯程序分析,与用户当前研究画像的核心问题弱相关。引用 52 inbox
Fangwen Mu, Xiao Chen, Lin Shi, Song Wang, Qing Wang
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 DOME,利用意图引导的选择性注意力,为同一代码生成反映不同开发者意图的注释。

现有自动代码注释生成方法通常只为给定代码片段生成通用的功能描述,未考虑开发者的不同意图;但在真实实践中,注释往往承载功能总结、设计理由、实现细节、代码属性等多种意图。为弥合自动注释生成与真实注释实践之间的差距,本文定义了“开发者意图驱动代码注释生成”任务,即为同一源代码按不同意图生成相应的注释。作者提出 DOME 方法,采用意图引导的选择性注意力机制,显式地从源代码中选取与目标意图相关的信息,进而生成反映不同意图的多样化注释。该方法在两个真实 Java 数据集上进行了评估,实验结果表明其优于当前最优基线;人工评估也证实 DOME 在实际使用中具有显著潜力,可帮助开发者根据自身需求高效地撰写注释。

问题
现有自动代码注释生成器仅生成通用功能描述,忽略了真实注释中反映的多种开发者意图,无法按意图生成相应注释。
方法
定义开发者意图驱动的代码注释生成任务,并提出 DOME,利用意图引导的选择性注意力显式选取意图相关源码信息以生成不同意图的注释。
评估
在两个真实 Java 数据集上与当前最优基线比较,实验指标更优,并通过人工评估验证了实际应用潜力。
原文摘要(Abstract)

Existing automatic code comment generators mainly focus on producing a general description of functionality for a given code snippet without considering developer intentions. However, in real-world practice, comments are complicated, which often contain information reflecting various intentions of developers, e.g., functionality summarization, design rationale, implementation details, code properties, etc. To bridge the gap between automatic code comment generation and real-world comment practice, we define Developer-Intent Driven Code Comment Generation, which can generate intent-aware comments for the same source code with different intents. To tackle this challenging task, we propose DOME, an approach that utilizes Intent-guided Selective Attention to explicitly select intent-relevant information from the source code, and produces various comments reflecting different intents. Our approach is evaluated on two real-world Java datasets, and the experimental results show that our approach outperforms the state-of-the-art baselines. A human evaluation also confirms the significant potential of applying DOME in practical usage, enabling developers to comment code effectively according to their own needs.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2302-07055,
  title = {Developer-Intent Driven Code Comment Generation},
  author = {Fangwen Mu and Xiao Chen and Lin Shi and Song Wang and Qing Wang},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00073}
}