paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automated Inline Comment Smell Detection and Repair with Large Language Models

基于大语言模型的自动行内注释坏味检测与修复
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 2/10 · 论文将 LLM 用于行内代码注释坏味的检测与修复,属于软件工程/开发者工具方向,关注点是注释质量而非程序静态分析、形式化验证或 Agentic 程序分析。它与用户画像中的 PL→AI、AI→PL、浮点程序分析和贝叶斯程序分析等核心方向几乎没有直接交集。引用 0 inbox
Hatice Kübra Çağlar, Semih Çağlar, Eray Tüzün
crossref: 2026-09-12

AI 速览

一句话:系统评估四种LLM在零样本与少样本提示下自动检测和修复行内代码注释坏味的效果。

代码注释会因代码演化或表述不清而产生注释坏味,降低可维护性。本文扩展数据得到2211个带修复版本的注释实例,构建检测—修复流水线,评测GPT-4o-mini、o3-mini、DeepSeek-V3和Codestral-2501在零样本/少样本提示下的表现,并对每种配置运行五次以缓解非确定性。检测用准确率、宏F1和MCC,修复用SBERT、METEOR和ROUGE-L。结果显示,o3-mini少样本检测最佳,宏F1 0.41、MCC 0.50、准确率0.72;Codestral-2501零样本修复最佳,SBERT中位数0.61。少样本利于检测,零样本更利于修复,但修复可能过拟合或引入新坏味。

问题
行内代码注释容易随代码演化或由于表述模糊、冗余、意图不一致而产生坏味,现有工作覆盖的坏味类型有限且多只关注检测而不考虑修复。
方法
扩展已有数据集加入修复后注释,形成2211个实例;用四种LLM在零样本/少样本提示下执行多阶段检测—修复,每配置重复五次并报告中位数。
评估
检测用准确率、宏F1和MCC评估;修复用SBERT相似度、METEOR和ROUGE-L评估;比较不同模型与提示策略,并模拟最佳检测结果输入修复阶段。
原文摘要(Abstract)

Context: Code comments play a critical role in improving code readability, maintainability, and collaborative development. However, comments may deviate from best practices due to software evolution, where code changes are not reflected in comments, as well as practitioner-related issues such as vague descriptions, redundancy, or misaligned intent. These issues lead to various comment smells that degrade software quality. While prior studies have explored comment inconsistencies, most are limited in scope, either addressing a narrow subset of smells or focusing solely on detection without considering repair.Objective: This study evaluates the effectiveness of large language models (LLMs) in both detecting and repairing inline code comment smells, using a comprehensive taxonomy of code comment smell types.Method: We extended a prior data set by incorporating repaired versions of smelly comments, resulting in 2,211 unique instances. Four LLMs—GPT-4o-mini, o3-mini, DeepSeek-V3, and Codestral-2501—are evaluated under zero-shot and few-shot prompting strategies. To account for non-deterministic behavior in LLM outputs and ensure robustness, each configuration is executed five times. Detection performance is measured using accuracy, macro F1 score, and Matthews correlation coefficient (MCC); repair is evaluated using SBERT similarity, METEOR, and ROUGE-L. Our multi-stage pipeline feeds detection outputs into the repair phase, where the detection result with the highest macro F1 score is used to simulate the best possible repair scenario. Median scores across runs are reported for comparison.Results: o3-mini with few-shot prompting achieves the highest median detection performance: macro F1 of 0.41, MCC of 0.50, and accuracy of 0.72, exceeding the baseline of GPT-4. For repair, Codestral-2501 in the zero-shot setting yields the best results with a median SBERT score of 0.61, followed by DeepSeek-V3 and GPT-4o-mini at 0.53, and o3-mini at 0.46. Few-shot prompts improve detection, while zero-shot prompts are more effective for repair.Conclusion: Lightweight LLMs such as o3-mini can achieve strong detection performance when guided by effective few-shot prompts. For example, o3-mini with few-shot prompting attains the highest median detection results: macro F1 of 0.41, MCC of 0.50, and accuracy of 0.72, surpassing the GPT-4 baseline. In contrast, repair tasks benefit more from zero-shot prompting, though they introduce challenges such as overfitting and the risk of generating new smells. Our findings support the development of practical tools, including a GitHub-integrated comment repair assistant, and motivate future work on dynamic prompt selection and multilingual benchmark construction.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9232,
  title = {Automated Inline Comment Smell Detection and Repair with Large Language Models},
  author = {Hatice Kübra Çağlar and Semih Çağlar and Eray Tüzün},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00088}
}