paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Code Comment Inconsistency Detection and Rectification Using a Large Language Model

使用大语言模型检测与修复代码注释不一致
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 4/10 · 论文用微调 LLM 检测并修复代码注释不一致,属于软件工程中的代码理解与修复任务;它与用户核心关注的静态分析、LLM 辅助形式化验证、浮点程序分析及贝叶斯程序分析交叉较弱,也未涉及 Agentic 程序或工业静态分析工具。引用 6 inbox
Guoping Rong, Yongda Yu, Song Liu, Xin Tan, Tianyi Zhang, Haifeng Shen, Jidong Hu
crossref: 2026-09-12

AI 速览

一句话:基于 CodeLLaMA 微调出 C4RLLaMA,统一实现代码注释不一致的检测与注释修复,多项指标超越已有方法。

注释与所注释代码片段一致时有助于代码理解,而代码注释不一致(CCI)会损害软件的开发、测试与维护。已有研究主要聚焦于不一致检测且性能参差,但仅检测并不解决问题,完整方案还需修改注释以完成修复,而此类工作十分稀少。本文提出 C4RLLaMA,一个在开源 CodeLLaMA 上微调得到的大语言模型,既能通过修正相关注释内容来修复不一致,又在检测任务上超越当前最优方法。作者在多个数据集上开展实验,结果显示 C4RLLaMA 稳定优于 post hoc 与 just-in-time 两类 CCI 检测方法,并在多项性能指标上大幅领先目前唯一已知的 CCI 修复方法。为进一步考察其修复效果,作者进行了人工评估:在 just-in-time 与 post hoc 设置下,C4RLLaMA 给出正确注释更新的比例分别为 65.0% 与 55.9%,表明其在实际使用中具有真实潜力。

问题
代码注释与代码不一致会负面影响程序理解、开发、测试与维护,而已有工作多只做检测,缺少同时进行检测与注释修复的完整方案。
方法
在开源 CodeLLaMA 上进行微调得到 C4RLLaMA,使其既能定位代码注释不一致,又能直接修正相关注释内容。
评估
在多个数据集上分别评估 just-in-time 与 post hoc 场景下的检测与修复性能,并与现有检测方法及唯一已知修复方法对比,同时开展人工评估检验修复正确率。
原文摘要(Abstract)

Comments are widely used in source code. If a comment is consistent with the code snippet it intends to annotate, it would aid code comprehension. Otherwise, Code Comment Inconsistency (CCI) is not only detrimental to the understanding of code, but more importantly, it would negatively impact the development, testing, and maintenance of software. To tackle this issue, existing research has been primarily focused on detecting inconsistencies with varied performance. It is evident that detection alone does not solve the problem; it merely paves the way for solving it. A complete solution requires detecting inconsistencies and, more importantly, rectifying them by amending comments. However, this type of work is scarce. In this paper, we contribute C4RLLaMA, a fine-tuned large language model based on the open-source CodeLLaMA. It not only has the ability to rectify inconsistencies by correcting relevant comment content but also outperforms state-of-the-art approaches in detecting inconsistencies. Experiments with various datasets confirm that C4RLLaMA consistently surpasses both post hoc and just-in-time CCI detection approaches. More importantly, C4RLLaMA outperforms substantially the only known CCI rectification approach in terms of multiple performance metrics. To further examine C4RLLaMA's efficacy in rectifying inconsistencies, we conducted a manual evaluation, and the results showed that the percentage of correct comment updates by C4RLLaMA was 65.0% and 55.9% in just-in-time and post hoc, respectively, implying C4RLLaMA's real potential in practical use.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8831,
  title = {Code Comment Inconsistency Detection and Rectification Using a Large Language Model},
  author = {Guoping Rong and Yongda Yu and Song Liu and Xin Tan and Tianyi Zhang and Haifeng Shen and Jidong Hu},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00035}
}