arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2502.02757cs.SE
收藏

噪声过多难以学习:提升代码评审评论生成的数据质量

Too Noisy To Learn: Enhancing Data Quality for Code Review Comment Generation

Chunhua Liu, Hong Yi Lin, Patanamon Thongtanunam

AI总结:

本文研究代码评审数据中的噪声评论对评论生成模型的影响,提出基于大语言模型的数据清洗方法,并通过微调实验证明清洗后的模型能生成更相似、更具信息量且更相关的评审评论。

摘要:

代码评审是软件开发中的重要实践,但耗时且需要大量精力。尽管开源数据集已被用于训练神经模型以自动化代码评审任务(包括评审评论生成),但这些数据集中仍包含大量噪声评论(例如模糊或不可执行的反馈),即使采用基于启发式规则和机器学习方法的清洗手段,这些噪声依然存在。此类残留噪声可能导致模型生成低质量的评审评论,然而去除这些噪声需要对代码变更和自然语言评论进行复杂的语义理解。在本文中,我们研究了此类噪声对评审评论生成的影响,并提出一种使用大语言模型(LLMs)进一步清洗这些数据集的新方法。基于对大规模代码评审数据集的实证研究,我们的基于LLM的方法在检测有效评论方面达到了66-85%的精确率。使用预测出的有效评论对最先进的代码评审模型(清洗后的模型)进行微调,所生成的评审评论与有效的人工撰写评论的相似度比原始模型提高了13.0% - 12.4%。我们还发现,清洗后的模型能够生成比原始模型更具信息量且更相关的评论。我们的发现强调了数据集质量对评审评论生成性能的关键影响。我们倡导进一步研究训练数据清洗,以提升自动化代码评审的实用性和质量。

英文摘要:

Code review is an important practice in software development, yet it is time-consuming and requires substantial effort. While open-source datasets have been used to train neural models for automating code review tasks, including review comment generation, these datasets contain a significant amount of noisy comments (e.g., vague or non-actionable feedback) that persist despite cleaning methods using heuristics and machine learning approaches. Such remaining noise may lead models to generate low-quality review comments, yet removing them requires a complex semantic understanding of both code changes and natural language comments. In this paper, we investigate the impact of such noise on review comment generation and propose a novel approach using large language models (LLMs) to further clean these datasets. Based on an empirical study on a large-scale code review dataset, our LLM-based approach achieves 66-85% precision in detecting valid comments. Using the predicted valid comments to fine-tune the state-of-the-art code review models (cleaned models) can generate review comments that are 13.0% - 12.4% more similar to valid human-written comments than the original models. We also find that the cleaned models can generate more informative and relevant comments than the original models. Our findings underscore the critical impact of dataset quality on the performance of review comment generation. We advocate for further research into cleaning training data to enhance the practical utility and quality of automated code review.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑