paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automatic Comment Generation via Multi-Pass Deliberation

基于多轮审议的自动注释生成
ASE Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering2022匹配度 2/10 · 该论文研究自动代码注释生成,属于机器学习与软件工程交叉,但并不涉及用户关注的静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也未以 LLM/Agent 改进程序分析工具。虽然标签含“机器学习与程序语言”,但主题与当前研究画像核心相距较远。引用 13 inbox
Fangwen Mu, Xiao Chen, Lin Shi, Song Wang, Qing Wang
crossref: 2026-09-12

AI 速览

一句话:提出 DECOM 多轮审议框架,以检索到的注释为初稿迭代润色,并由评估模型决定终止,从而生成更优代码注释。

自动注释生成旨在为代码片段生成自然语言描述。受人类「先写草稿、再反复润色」这一认知过程启发,作者提出 DECOM——一个面向自动注释生成的多轮审议框架,由多个审议模型(Deliberation Model)与一个评估模型(Evaluation Model)组成。给定代码片段,先从中抽取关键词,并从预定义语料库中检索相似代码片段,将其注释作为初始草稿;随后把草稿、代码与关键词一并输入 DECOM 开始迭代审议:每轮由审议模型润色草稿并生成新注释,评估模型度量新注释质量,据此决定是否终止迭代。迭代结束后选取最佳注释作为目标注释。在 Java(87K)与 Python(108K)两个真实数据集上的实验表明,该方法优于当前最先进基线;人工评估也证实 DECOM 生成的注释通常更可读、信息量更大且更有用。

问题
已有自动注释生成方法通常一次性生成注释,缺少人类写作中反复润色的过程,导致生成注释的质量与可用性受限。
方法
提出 DECOM 多轮审议框架:先检索相似代码的注释作为初始草稿,再由审议模型逐轮润色生成新注释,并由评估模型评分决定是否终止迭代,最终选出最佳注释。
评估
在 Java(87K)和 Python(108K)两个真实数据集上与最先进基线进行对比实验,并辅以人工评估,从可读性、信息量与实用性方面确认生成注释更优。
原文摘要(Abstract)

Deliberation is a common and natural behavior in human daily life. For example, when writing papers or articles, we usually first write drafts, and then iteratively polish them until satisfied. In light of such a human cognitive process, we propose DECOM, which is a multi-pass deliberation framework for automatic comment generation. DECOM consists of multiple Deliberation Models and one Evaluation Model. Given a code snippet, we first extract keywords from the code and retrieve a similar code fragment from a pre-defined corpus. Then, we treat the comment of the retrieved code as the initial draft and input it with the code and keywords into DECOM to start the iterative deliberation process. At each deliberation, the deliberation model polishes the draft and generates a new comment. The evaluation model measures the quality of the newly generated comment to determine whether to end the iterative process or not. When the iterative process is terminated, the best-generated comment will be selected as the target comment. Our approach is evaluated on two real-world datasets in Java (87K) and Python (108K), and experiment results show that our approach outperforms the state-of-the-art baselines. A human evaluation study also confirms the comments generated by DECOM tend to be more readable, informative, and useful.

链接与引用

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

BibTeX
@inproceedings{paperbot7165,
  title = {Automatic Comment Generation via Multi-Pass Deliberation},
  author = {Fangwen Mu and Xiao Chen and Lin Shi and Song Wang and Qing Wang},
  booktitle = {ASE},
  year = {2022},
  doi = {10.1145/3551349.3556917}
}