[Paper Review] Early Prediction for Merged vs Abandoned Code Changes in Modern Code Reviews
This paper proposes PredCR, a LightGBM-based machine learning model that predicts early whether a code change in modern code reviews will be merged or abandoned. Trained on 146,612 code changes from three open-source projects using 25 features across reviewer, author, project, text, and code dimensions, PredCR achieves an average AUC of 85%, outperforming prior work by 14-23% in predictive performance while reducing bias against new contributors.
The modern code review process is an integral part of the current software development practice. Considerable effort is given here to inspect code changes, find defects, suggest an improvement, and address the suggestions of the reviewers. In a code review process, usually, several iterations take place where an author submits code changes and a reviewer gives feedback until is happy to accept the change. In around 12% cases, the changes are abandoned, eventually wasting all the efforts. In this research, our objective is to design a tool that can predict whether a code change would be merged or abandoned at an early stage to reduce the waste of efforts of all stakeholders (e.g., program author, reviewer, project management, etc.) involved. The real-world demand for such a tool was formally identified by a study by Fan et al. [1]. We have mined 146,612 code changes from the code reviews of three large and popular open-source software and trained and tested a suite of supervised machine learning classifiers, both shallow and deep learning based. We consider a total of 25 features in each code change during the training and testing of the models. The best performing model named PredCR (Predicting Code Review), a LightGBM-based classifier achieves around 85% AUC score on average and relatively improves the state-of-the-art [1] by 14-23%. In our empirical study on the 146,612 code changes from the three software projects, we find that (1) The new features like reviewer dimensions that are introduced in PredCR are the most informative. (2) Compared to the baseline, PredCR is more effective towards reducing bias against new developers. (3) PredCR uses historical data in the code review repository and as such the performance of PredCR improves as a software system evolves with new and more data.
Motivation & Objective
- To reduce wasted effort in code reviews, where ~12% of changes are abandoned after multiple iterations.
- To develop an early prediction tool that identifies likely merged or abandoned code changes before full review cycles conclude.
- To address limitations in prior work, including late prediction timing, lack of historical context, and bias against new contributors.
- To improve prediction accuracy by incorporating reviewer, author, project, text, and code features in a unified model.
Proposed method
- The authors mined 146,612 code changes from Gerrit-based code reviews in three large open-source projects (Eclipse, LibreOffice, GerritHub).
- They extracted 25 features across five dimensions: reviewer (e.g., reviewer experience, number of past reviews), author (e.g., contribution history), project (e.g., project size, review frequency), text (e.g., patch message length, sentiment), and code (e.g., lines changed, complexity).
- A supervised learning approach was applied using six classifiers: five shallow models (Logistic Regression, SVM, Random Forest, XGBoost, LightGBM) and one deep neural network.
- The model was trained and tested using longitudinal cross-validation to prevent data leakage and ensure realistic early prediction scenarios.
- Class imbalance was addressed via balanced classification loss, and hyperparameter tuning was performed to optimize performance.
- PredCR, the LightGBM-based model, was selected as the best-performing model based on AUC and other metrics.
Experimental results
Research questions
- RQ1Can PredCR outperform the state-of-the-art baseline (Fan et al. [1]) in predicting merged vs. abandoned code changes?
- RQ2How effective is each feature dimension (reviewer, author, project, text, code) in predicting code change outcomes?
- RQ3How well does PredCR handle bias against new contributors with limited contribution history?
- RQ4How does model performance evolve as the system accumulates more historical data over time?
- RQ5How robust is PredCR when applied to new projects or sub-projects with limited training data?
Key findings
- PredCR achieved an average AUC score of 85%, representing a 14-23% relative improvement over the state-of-the-art baseline (Fan et al. [1]).
- The reviewer dimension was the most informative feature set, contributing significantly to prediction performance, followed by author, project, code, and text features.
- PredCR reduced bias against new developers compared to the baseline, maintaining strong performance even when author history was limited.
- Model performance improved over time as more historical data became available, indicating that PredCR benefits from evolving code review repositories.
- PredCR maintained strong performance when retrained on one project and applied to others, demonstrating transferability and generalization across projects.
- The model remained effective even when predictions were updated per revision, showing robustness in dynamic review workflows.
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.