利用ChatGPT增强代码智能任务
Enhancing Code Intelligence Tasks with ChatGPT
AI总结:
本研究利用ChatGPT生成代码注释重建预训练数据集,通过无参考指标验证其语义一致性,并证明基于该数据集预训练的CodeT5在多项代码智能任务上性能更优。
摘要:
预训练代码模型已成为各种代码智能任务中的关键工具。然而,其有效性取决于预训练数据集的质量,尤其是人工参考注释,这些注释充当编程语言与自然语言之间的桥梁。一个重大挑战是,随着软件的发展,此类注释可能与相应代码变得不一致。这种不一致可能导致模型训练欠佳,降低其性能。大型语言模型在生成高质量代码注释方面展现出卓越能力。鉴于此,我们尝试利用大型语言模型的力量来解决数据集的质量问题。具体而言,我们提出一个问题:能否通过用大型语言模型生成的注释替换原始注释来重建预训练数据集,以获得更有效的预训练代码模型?为了回答这个问题,我们首先进行了一项全面评估,比较ChatGPT生成的注释与人工参考注释。由于现有的基于参考的指标将参考注释视为黄金标准,我们引入了两个辅助任务作为新颖的无参考指标来评估注释质量,即代码-注释不一致检测和代码搜索。实验结果表明,与人工参考相比,ChatGPT生成的注释与代码展现出更优越的语义一致性,表明利用ChatGPT增强预训练数据集质量的潜力。我们使用ChatGPT生成的注释重建了广泛使用的数据集CodeSearchNet。随后的实验涉及使用我们精炼的数据集重新预训练CodeT5。在四个生成任务和一个理解代码智能任务上的评估结果表明,由ChatGPT增强数据预训练的模型在代码摘要、代码生成和代码翻译任务上优于其对应模型。
英文摘要:
Pre-trained code models have emerged as crucial tools in various code intelligence tasks. However, their effectiveness depends on the quality of the pre-training dataset, particularly the human reference comments, which serve as a bridge between the programming language and natural language. One significant challenge is that such comments can become inconsistent with the corresponding code as the software evolves. This discrepancy can lead to suboptimal training of the models, decreasing their performances. LLMs have demonstrated superior capabilities in generating high-quality code comments. In light of that, we try to tackle the quality issue of the dataset by harnessing the power of LLMs. Specifically, we raise the question: Can we rebuild the pre-training dataset by substituting the original comments with LLM-generated ones for more effective pre-trained code models? To answer the question, we first conduct a comprehensive evaluation to compare ChatGPT-generated comments with human reference comments. As existing reference-based metrics treat the reference comments as gold standards, we introduce two auxiliary tasks as novel reference-free metrics to assess the quality of comments, i.e., code-comment inconsistency detection and code search. Experimental results show that ChatGPT-generated comments demonstrate superior semantic consistency with the code compared to human references, indicating the potential of utilizing ChatGPT to enhance the quality of the pre-training dataset. We rebuilt the widely used dataset, CodeSearchNet, with ChatGPT-generated comments. Subsequent experiments involve re-pre-training the CodeT5 with our refined dataset.Evaluation results on four generation tasks and one understanding code intelligence tasks show that the model pre-trained by ChatGPT-enhanced data outperforms its counterpart on code summarization, code generation, and code translation tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。