Predicting Expert Evaluations in Software Code Reviews

Yegor Denisov-Blanch, Igor Ciobanu, Simon Obstbaum, Michal KosinskiarXiv 2024 · DOI

Abstract

Manual code reviews are the gold standard for software quality but are difficult to scale. This research presents an algorithmic model capable of predicting how expert developers evaluate code commits, specifically regarding the time and effort required for implementation. By training a Random Forest model on judgments from veteran Java experts, the system achieved high correlations ($r = 0.82$ to $0.86$) for time estimation, potentially automating significant portions of the code review process.

Introduction

While manual code reviews ensure high software quality, they are notoriously slow. Reviewers operating under time pressure often focus exclusively on bug detection or architectural flaws, frequently overlooking broader organizational metrics such as the actual effort expended, contributor growth, or long-term maintainability. Neglecting these "soft" metrics leads to missed opportunities for developer mentoring and data-driven project management. This study aims to bridge this gap by creating a tool that provides an "expert's perspective" on code quality and effort instantaneously, allowing human reviewers to focus on more nuanced architectural decisions.

Methods

The researchers developed a static code analysis tool integrated with Git to evaluate code on a per-commit basis. The methodology involved three primary phases:

1. Feature Extraction

The model analyzes four key dimensions of a commit:

  • Code Structure: Changes to classes, interfaces, and methods.
  • Quality Metrics: Cohesion, complexity, and coupling.
  • Implementation Details: Lines of code (LOC) added/deleted, data structures used, and dependency changes.
  • Architectural Elements: Usage of design patterns, persistence layers, and API consumption.

2. Expert Calibration

To establish a ground truth for quality, the team recruited 10 Java experts with significant industry experience. These experts rated commits using a questionnaire that included a Fibonacci scale for time estimation—a standard Agile tool used to account for uncertainty in larger tasks.

Table 5: Characteristics of the 10 expert raters involved in the study, showing high levels of seniority and experience.

3. The Algorithm and Evaluation

The study utilized a Random Forest algorithm to determine feature weights. To ensure the model could generalize to new codebases, the researchers employed Leave-One-Out Cross-Validation (LOOCV), training the model on nine experts' judgments and testing it against the tenth. The evaluation focused on several key questions regarding effort, difficulty, and structure.

Table 6: The questionnaire used by experts to evaluate commits, including response options for time, difficulty, and maintainability.

Datasets

The study utilized two distinct data layers:

  • The Baseline Distribution: The authors onboarded 108 software organizations, analyzing 1.73 million commits from over 50,000 contributors to understand the typical distribution of "Lines of Code" in professional environments.
  • The Evaluation Set: From this pool, 70 representative commits were selected for expert evaluation, resulting in a high-density dataset of 4,900 individual judgments.

Key Insights and Results

"Backward Estimation" vs. Forward Guessing

Traditional project management relies on "forward-looking" estimates (guessing how long a task will take). This research suggests that "backward estimation"—analyzing the code actually produced—provides a much more accurate and objective measure of effort.

Performance and Speed

The model’s predictions strongly correlated with expert judgments, reaching $r = 0.82$ for coding time and $r = 0.86$ for total implementation time (including debugging and QA). Furthermore, while it took experts weeks to evaluate the commit batches, the model processed commits in under one second, representing a potential reduction in assessment time of over 99%.

Subjectivity in Code Quality

The model was remarkably effective at predicting time-based metrics but struggled with highly subjective traits like "author experience" or "maintainability." This mirrors the experts' own behavior: inter-rater reliability was high for time and complexity ($ICC_{2,k} \approx 0.80$) but significantly lower for maintainability ($ICC_{2,k} = 0.52$). This suggests that while effort is encoded in structural complexity, "cleanliness" remains a more elusive, human-centric judgment.

Conclusion and Future Work

The current model demonstrates that structural code features can effectively proxy expert judgments of effort. However, the study is currently limited to the Java language and object-oriented patterns. Future work will involve expanding the dataset to include other programming languages and incorporating developer history or business domain complexity to provide a more contextual understanding of the code. The researchers are currently seeking more expert raters to expand the dataset across different programming paradigms.

Summary updated

BibTeX
@misc{denisovblanch2024predicting,
  author = {Yegor Denisov-Blanch and Igor Ciobanu and Simon Obstbaum and Michal Kosinski},
  title = {{Predicting Expert Evaluations in Software Code Reviews}},
  year = {2024},
  eprint = {2409.15152},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.15152},
}
Figure