DefectReviewer: Towards Generating Defect-Focused Review Comment Based on Fine-Grained Defect Localization
Abstract
Code review is critical to software quality assurance, with defect detection as a primary objective. While LLMs enable automated review comment generation, most approaches treat code review as a general-purpose task, favoring frequent but low-risk feedback. We propose DefectReviewer , a defect-focused review comment generation approach combining task-specific fine-tuning with fine-grained localization signals. The key insight is that while task-specific fine-tuning establishes the foundation for defect-focused review, grounding the model in where the defect is provides complementary guidance to narrow the reasoning space for what the defect is . DefectReviewer uses a Just-In-Time localization tool to identify defect lines, grounding review comment generation through structural prompting and fine-tuning. DefectReviewer is designed as a specialized, selectively applicable component that complements general-purpose reviewers. We evaluate DefectReviewer on a large-scale real-world dataset against six representative baseline methods. DefectReviewer consistently outperforms state-of-the-art baselines, improving BLEU and ROUGE-L by 17.0% and 24.2%, respectively. A dual-track semantic evaluation combining LLM judges with human expert validation confirms that DefectReviewer produces comments with higher defect relevance and readability. Additional analyses show that it can be applied to different generation architectures and that its performance changes moderately as the number of input defect lines varies, although the trend differs across architectures.
// Source
Authors: accept1223, Ao Zeng, Yuxuan Zhang, Xiangping Chen, Zibin Zheng
Institutions: Sun Yat-sen University