用AI重写代码注释,提升可读性和准确性
AI-Mediated Code Comment Improvement
- 用大模型定制化重写注释,覆盖多个质量维度
- 在真实代码上验证,注释质量显著提升
- 支持本地部署,保护数据隐私
本文提出一种通过定制化AI工具重写代码注释以提升其多维度质量的方法。研究基于实证分析与扎根理论,确定了需改进的注释质量维度,并设计了一套基于大语言模型(LLM)的重写流程。我们使用GPT-4o实现该流程,并将其结果蒸馏为小型模型,可在本地运行,保障数据隐私。通过评估验证,该方法有效提升了代码注释在各项质量维度上的表现。所有数据与源码均已公开,确保可复现性。
原文摘要 · Abstract (English)
This paper describes an approach to improve code comments along different quality axes by rewriting those comments with customized Artificial Intelligence (AI)-based tools. We conduct an empirical study followed by grounded theory qualitative analysis to determine the quality axes to improve. Then we propose a procedure using a Large Language Model (LLM) to rewrite existing code comments along the quality axes. We implement our procedure using GPT-4o, then distil the results into a smaller model capable of being run in-house, so users can maintain data custody. We evaluate both our approach using GPT-4o and the distilled model versions. We show in an evaluation how our procedure improves code comments along the quality axes. We release all data and source code in an online repository for reproducibility.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。