[Paper Review] CORE: Automating Review Recommendation for Code Changes
This paper proposes CORE, a deep learning model that recommends relevant code reviews using only code changes and historical reviews, without requiring full source code. By combining word-level and character-level embeddings with an attention mechanism, CORE achieves 131.03% higher Recall@10 and 150.69% higher Mean Reciprocal Rank than the state-of-the-art model DeepMem on 19 Java projects.
Code review is a common process that is used by developers, in which a reviewer provides useful comments or points out defects in the submitted source code changes via pull request. Code review has been widely used for both industry and open-source projects due to its capacity in early defect identification, project maintenance, and code improvement. With rapid updates on project developments, code review becomes a non-trivial and labor-intensive task for reviewers. Thus, an automated code review engine can be beneficial and useful for project development in practice. Although there exist prior studies on automating the code review process by adopting static analysis tools or deep learning techniques, they often require external sources such as partial or full source code for accurate review suggestion. In this paper, we aim at automating the code review process only based on code changes and the corresponding reviews but with better performance. The hinge of accurate code review suggestion is to learn good representations for both code changes and reviews. To achieve this with limited source, we design a multi-level embedding (i.e., word embedding and character embedding) approach to represent the semantics provided by code changes and reviews. The embeddings are then well trained through a proposed attentional deep learning model, as a whole named CORE. We evaluate the effectiveness of CORE on code changes and reviews collected from 19 popular Java projects hosted on Github. Experimental results show that our model CORE can achieve significantly better performance than the state-of-the-art model (DeepMem), with an increase of 131.03% in terms of Recall@10 and 150.69% in terms of Mean Reciprocal Rank. Qualitative general word analysis among project developers also demonstrates the performance of CORE in automating code review.
Motivation & Objective
- To reduce the manual workload of code reviewers by automating review recommendation without relying on full source code.
- To improve the accuracy of code review recommendation by learning better semantic representations of code changes and reviews.
- To address the challenge of out-of-vocabulary words in code by combining word-level and character-level embeddings.
- To develop a model that learns relevancy between code changes and reviews using only change and review pairs.
- To validate the model’s effectiveness through quantitative evaluation and qualitative feedback from experienced developers.
Proposed method
- CORE uses a multi-level embedding strategy combining word-level and character-level embeddings to represent code changes and reviews.
- The model employs an attentional neural network to compute the relevancy score between code changes and reviews, focusing on semantically important parts.
- Word embeddings are learned from code tokens, while character embeddings capture subword patterns to handle rare or unknown tokens.
- The attention mechanism dynamically weights important tokens in both code changes and reviews during prediction.
- The model is trained end-to-end on code change-review pairs from GitHub repositories without external code context.
- A hierarchical attention mechanism allows the model to focus on relevant code sections and review comments simultaneously.
Experimental results
Research questions
- RQ1Can a deep learning model recommend relevant code reviews using only code changes and past reviews, without access to full source code?
- RQ2How effective is a multi-level embedding (word + character) approach in capturing semantic meaning in code changes and reviews?
- RQ3Does an attention mechanism improve the prediction of relevancy between code changes and reviews compared to baseline models?
- RQ4How does CORE compare to state-of-the-art models like DeepMem in terms of retrieval performance on real-world code review data?
- RQ5To what extent do experienced developers perceive the recommended reviews as useful and relevant?
Key findings
- CORE achieves a 131.03% improvement in Recall@10 over the state-of-the-art model DeepMem on 19 popular Java projects.
- CORE improves Mean Reciprocal Rank (MRR) by 150.69% compared to DeepMem, indicating better ranking of relevant reviews.
- Qualitative analysis with experienced developers confirms that CORE-generated recommendations are relevant and useful in practice.
- The combination of word-level and character-level embeddings significantly enhances representation learning, especially for rare or out-of-vocabulary tokens in code.
- The attention mechanism effectively highlights key code elements and review phrases, improving prediction accuracy.
- The model performs well even without access to full source code, making it practical for real-world deployment in pull request systems.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.