Using Large-scale Heterogeneous Graph Representation Learning for Code Review Recommendations at Microsoft

Jiyang Zhang, Chandra Maddila, Ram Bairi, Christian Bird, Ujjwal Raizada, Apoorva Agrawal, Yamini Jhawar, Kim Herzig, Arie van DeursenarXiv 2022

TL;DR

Microsoft researchers have developed CORAL, a reviewer recommendation system that uses Graph Convolutional Networks (GCNs) to navigate a massive "socio-technical" graph of development activity. By analyzing the complex web of relationships between developers, pull requests, work items, and even the semantic content of code descriptions, CORAL identifies qualified reviewers that traditional file-history-based systems often overlook.

What Problem Does This Paper Address?

Code review is a cornerstone of modern software engineering, but it’s only as effective as the reviewers involved. Assigning the "wrong" reviewer—someone lacking specific expertise—leads to slower turnaround times, lower-quality feedback, and more post-deployment defects.

Existing recommendation systems typically rely on "classical" heuristics, such as identifying who previously modified or reviewed a specific file (e.g., using git blame). While effective, these methods are "blind" to qualified experts who have the right skills but haven't interacted with those specific files yet. As projects grow in scale and complexity, these traditional models struggle to keep up with the expanding pool of potential reviewers and the cross-repository dependencies common in large organizations like Microsoft.

Methods

The authors propose CORAL, which treats reviewer recommendation as a link prediction problem on a large-scale heterogeneous graph.

  1. Socio-technical Graph Construction: They build a graph where nodes represent entities like Pull Requests (PRs), work items, authors, reviewers, files, and repositories. Edges represent interactions, such as "author creates PR" or "PR changes file."
  2. Semantic Augmentation: To capture the intent of a change, they add natural language "text tokens" from PR titles and descriptions as nodes in the graph. This allows the model to connect developers to specific concepts and topics, even across different repositories.

    Fig. 2: Socio-technical graph
  3. Graph Representation Learning: They employ a 2-layer Graph Convolutional Network (GCN) to learn low-dimensional embeddings for every node. By aggregating information from a node’s neighbors, the model captures second-order relationships (e.g., "User A reviews PRs that are semantically similar to PRs authored by User B").

  4. Inductive Inference: Because new PRs are created constantly and aren't part of the training graph, CORAL uses an inductive approach. It generates an embedding for a new PR on-the-fly based on its immediate neighbors (the files it changes, the words in its description, and its author) and then finds the "closest" potential reviewers in the embedding space.

    Fig. 1: CORAL architecture

Datasets

The study leverages a massive internal dataset from Microsoft:

  • Scope: 332 software repositories.
  • Timeframe: 2.5 years of history (starting Jan 2019).
  • Graph Scale: Approximately 5.8 million nodes and 23.8 million edges.
  • Evaluation Set: A retrospective dataset of 254,000 code reviews (PR-reviewer pairs) used to test the model's ability to replicate historical human choices.

Key Insights and Ideas

  • "No One Model to Rule Them All": One of the most striking findings is that project size dictates model performance. Simple rule-based models (RM) perform well in small projects where a few "hero" developers handle most reviews. However, CORAL significantly outperforms these baselines in large, complex projects.
  • The Power of Semantics: The ablation study revealed that while file history is the strongest single signal, adding natural language tokens provides a "tremendous performance boost." It allows the system to understand what the code is doing, not just where it lives.
  • Uncovering Hidden Experts: A user study confirmed that CORAL identifies qualified reviewers that traditional systems miss. These "hidden experts" often expressed a desire to be involved, suggesting that CORAL can help break down silos and distribute knowledge more effectively.

Key Results

  • Historical Accuracy: CORAL successfully replicated human reviewer selection in its top 3 recommendations for 73% of pull requests.
  • Superiority in Large Projects: In a comparative study on large repositories (>100 developers), CORAL achieved a precision of 0.37, nearly doubling the 0.19 precision of the production rule-based baseline.

    TABLE V: Comparative user study precision across dimen- sions. RM is Rule-based Model. The differences between the two models with the same Greek letter suffix (and only those pairs) are not statistically significant.
  • Developer Validation: In a real-world user study with 500 developers, 67.6% of the feedback was positive, with many developers noting that the recommendations made sense even if they hadn't touched the specific files before.

Limitations and Future Work

  • "People Movement": The biggest source of negative feedback (91%) was "stale" data—developers who had recently changed teams or roles. Future versions need to incorporate temporal decay or dynamic updates to account for organizational changes.
  • Job Role Filtering: The current model sometimes recommends non-engineers (like PMs) who might be semantically linked to a project but don't perform code reviews. Incorporating explicit job roles into node embeddings is a planned improvement.
  • Feature Engineering: The authors suggest that adding node-specific features (like a developer's years of experience) and edge-specific features (like the recency of a file change) could further refine the recommendations.

Summary updated

BibTeX
@misc{zhang2022using,
  author = {Jiyang Zhang and Chandra Maddila and Ram Bairi and Christian Bird and Ujjwal Raizada and Apoorva Agrawal and Yamini Jhawar and Kim Herzig and Arie van Deursen},
  title = {{Using Large-scale Heterogeneous Graph Representation Learning for Code Review Recommendations at Microsoft}},
  year = {2022},
  eprint = {2202.02385},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.02385},
}
Figure