一句话:提出 LAURA 框架,通过审查示例检索、上下文增强与系统引导,提升 LLM 生成代码审查意见的质量。
代码审查耗时且知识密集,现有自动生成方法主要利用历史代码变更与评论,忽略了代码变更上下文与先前审查知识。本文提出基于 LLM 的审查知识增强、上下文感知框架 LAURA,集成审查示例检索、上下文增强和系统化引导,以提升 ChatGPT-4o 和 DeepSeek v3 生成审查评论的能力;同时构建高质量数据集以缓解现有数据低质量问题。实验表明,两模型在 42.2% 和 40.4% 的案例中生成完全正确或至少对开发者有帮助的评论,显著优于 SOTA 基线;消融研究验证各组件均有正向贡献。
Code review is critical for ensuring software quality and maintainability. With the rapid growth in software scale and complexity, code review has become a bottleneck in the development process because of its time-consuming and knowledge-intensive nature and the shortage of experienced developers willing to review code. Several approaches have been proposed for automatically generating code reviews based on retrieval, neural machine translation, pre-trained models, or large language models (LLMs). These approaches mainly leverage historical code changes and review comments. However, a large amount of crucial information for code review, such as the context of code changes and prior review knowledge, has been overlooked. This paper proposes an LLM-based review knowledge-augmented, context-aware framework for code review generation, named LAURA. The framework integrates review exemplar retrieval, context augmentation, and systematic guidance to enhance the performance of ChatGPT-4o and DeepSeek v3 in generating code review comments. Besides, given the extensive low-quality reviews in existing datasets, we also constructed a high-quality dataset. Experimental results show that for both models, LAURA generates review comments that are either completely correct or at least helpful to developers in 42.2% and 40.4% of cases, respectively, significantly outperforming SOTA baselines. Furthermore, our ablation studies demonstrate that all components of LAURA contribute positively to improving comment quality.
@inproceedings{paperbot9382,
title = {LAURA: Enhancing Code Review Generation with Context-Enriched Retrieval-Augmented LLM},
author = {Yuxin Zhang and Yuxia Zhang and Zeyu Sun and Yanjie Jiang and Hui Liu},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00245}
}