Code review is a fundamental process in software development that plays a critical role in ensuring code quality and reducing the likelihood of errors and bugs. However, code review might be complex, subjective, and time-consuming. Comment generation and code refinement are two key tasks of this process and their automation has traditionally been addressed separately in the literature using different approaches. In this paper, we propose a novel deep-learning architecture, DISCOREV, based on cross-task knowledge distillation that addresses these two tasks simultaneously. In our approach, the fine-tuning of the comment generation model is guided by the code refinement model. We implemented this guidance using two strategies, feedback-based learning objective and embedding alignment objective. We evaluated our approach based on cross-task knowledge distillation by comparing it to the state-of-the-art methods that are based on independent training and fine-tuning. Our results show that our approach generates better review comments as measured by the BLEU score.
翻译:代码评审是软件开发中的基本流程,在确保代码质量、降低错误与缺陷可能性方面起着关键作用。然而,代码评审可能复杂、主观且耗时。评论生成与代码精炼是该流程的两项核心任务,传统上文献中采用不同方法分别处理。本文提出一种新颖的基于跨任务知识蒸馏的深度学习架构DISCOREV,可同时完成这两项任务。在我们的方法中,评论生成模型的微调由代码精炼模型引导。我们通过两种策略实现这种引导:基于反馈的学习目标和嵌入对齐目标。我们将基于跨任务知识蒸馏的方法与基于独立训练和微调的最新技术进行了对比评估。结果表明,以BLEU评分为衡量标准,我们的方法能生成更优质的评审评论。