ML-Based Comment Ranker for LLM Code Review Quality Improvement

atlassian · Tech · year n/a · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: LLM-powered code review quality control

Atlassian needed to reduce noisy, nit-picky, or factually wrong comments from an LLM code reviewer agent while preserving useful review coverage and adapting as foundation models, repositories, and user bases changed.

Constraints:

Architecture

Atlassian inserted an ML comment ranker between the code reviewer agent's LLM-generated comments and the comments posted to pull requests. The code reviewer agent is triggered when a PR is created and uses the code diff, PR metadata, and Jira work item context to generate candidate comments. A fine-tuned ModernBERT binary classifier scores each raw textual comment for its likelihood of leading to code resolution. Comments must pass an A/B-optimized propensity threshold before posting. User actions after posted comments become ground truth labels, creating a refresh loop that expanded training data from about 10K to 53K comments and restored performance after broader repository rollout.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  Trigger["Pull request trigger"] --> Agent["Code reviewer agent"]
  Agent --> LLM["LLM comment generator"]
  LLM --> Ranker["Comment ranker"]
  Ranker --> Gate["Threshold gate"]
  Gate --> Posted["Posted PR comments"]
  Posted --> Signal["Code resolution signal"]
  Signal --> Refresh["Training data refresh"]
  Refresh --> Ranker
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Pull request trigger Starts the code reviewer agent when a pull request is created. Code reviewer agent
Code reviewer agent Rovo Dev LLM agent that analyzes PR context and generates candidate review comments. Pull request trigger, LLM comment generator, Posted PR comments
LLM comment generator Foundation model component that produces raw code review comments from diff, PR, and Jira context. Code reviewer agent, Comment ranker
Comment ranker Fine-tuned ModernBERT binary classifier that predicts whether a generated comment will lead to code resolution. LLM comment generator, Threshold gate, Training data refresh
Threshold gate A/B-optimized propensity-score cutoff controlling which comments are posted. Comment ranker, Posted PR comments
Posted PR comments Filtered code review comments shown to developers in Bitbucket Cloud. Code reviewer agent, Threshold gate, Code resolution signal
Code resolution signal Behavioral outcome measuring whether authors changed code after a comment. Posted PR comments, Training data refresh
Training data refresh Model refresh process using growing dogfooding data and code-resolution outcomes to retrain ModernBERT. Code resolution signal, Comment ranker

Data flow

When a PR is created, the code reviewer agent calls an LLM with the diff, PR title and description, and Jira context to generate original comments. Those comments are passed to the ModernBERT comment ranker, which predicts a 0-to-1 propensity score for code resolution. Comments above the threshold are posted to the PR. Later author code changes, captured as Bitbucket outdated status, become binary ground truth for training and refreshing the ranker.

3 supporting quotes
“The code reviewer agent gets triggered when a PR is created, and it first calls a LLM to generate original code review comments based on the code diff, PR title/description, and Jira work item/description.”article, stated
“Those originally generated comments now become the input for the comment ranker to perform its task of selecting useful comments.”article, stated
“any comment that we want to post has to pass a threshold score, chosen and optimized through A/B testing.”article, stated

Why this architecture

Atlassian separated comment generation from comment selection because prompt or heuristic filtering alone did not use the growing user-action data. A specialized ModernBERT classifier could learn from real code-resolution outcomes, act as a quality gate for different upstream LLMs, and be refreshed as product rollouts changed the data distribution.

3 supporting quotes
“These heuristic-based filters have proven to be very useful in improving precision albeit giving up recall but they are still not sophisticated enough to fully leverage the data, ML, and state-of-the-art (SOTA) model architectures”article, stated
“Model fine-tuning based on our own data is necessary to ensure that the propensity scores generated for code resolution are useful and accurate.”article, stated
“comment ranker is largely agnostic to the underlying generation model when selecting good comments.”article, stated

Models used: ModernBERT · GPT-4o · Claude Sonnet 3.5 · Claude Sonnet 4 · Rovo Dev code reviewer agent

Scale

Alternatives considered (roads not taken)

Post LLM-generated comments without filtering

Rejected because: Unfiltered LLM comments were noisy, nit-picky, or factually wrong and created negative user feedback.

“Without any filtering process in place, LLM generated comments can be very noisy, nit-picky or even factually wrong which directly leads to users’ negative feedback.”article, stated

Continue relying on heuristic and LLM-category filters

Rejected because: Heuristics helped precision but could not fully leverage proprietary data, modern ML, and transformer architectures.

“Historically, we have implemented multiple filters to select better comments based on heuristics or simple data analysis.”article, stated
“they are still not sophisticated enough to fully leverage the data, ML, and state-of-the-art (SOTA) model architectures like transformers”article, stated

Train only on limited repository data

Rejected because: When the product expanded to all eligible internal repositories, model precision dropped until retraining used broader data.

“we saw the model precision dropped (CRR dropped from ~40% to ~33%) mainly because the first version of the model was trained using a limited number of data signals from those repos.”article, stated

Patterns

confidence-thresholding (quality_control)

The ranker emits a 0-to-1 propensity score, and comments must exceed an A/B-optimized threshold before posting.

“we want to predict code resolution outcome and its output include a propensity score from 0 to 1.”article, stated
“any comment that we want to post has to pass a threshold score, chosen and optimized through A/B testing.”article, stated

fine-tuning-adaptation (model_optimization)

Atlassian fine-tuned ModernBERT on proprietary comment-resolution data for the comment selection task.

“we selected the open source ModernBERT model which is a recent high-performing variant of the BERT model family.”article, stated
“Model fine-tuning based on our own data is necessary to ensure that the propensity scores generated for code resolution are useful and accurate.”article, stated

eval-driven-development (evaluation)

The north-star metric is code resolution rate, linking model selection quality to whether developers actually change code after comments.

“The selection process is optimized based on our north star online metric to measure success, code resolution rate (CRR)”article, stated
“A positive signal is a comment that triggers the code changes (the comment will then show “outdated” status in Bitbucket Cloud)”article, stated

data-quality-loop (data)

User actions after comments become training labels, and broader repository rollout produced more diverse data for retraining.

“We used code resolution binary outcome from internally-sourced dogfooding data as the ground truth to train our model.”article, stated
“they all turn into valuable signals (ground truth labels) in our model training data to guide the model to better select high quality comments to be posted.”article, stated

fallback-degradation (quality_control)

The ranker provides a robust quality gate across upstream LLM switches, reducing dependence on a single generation model's behavior.

“When we switched our comment generation model from GPT-4o to Claude Sonnet 3.5, we were earlier concerned that we may see a CRR drop”article, stated
“After we made the switch with comment ranker in place, we have seen the CRR stay very consistent before and after.”article, stated

Tradeoffs

Optimize for code resolution rate

Chose Behavioral CRR as the primary success signal over Only subjective comment ratings or generic ML accuracy.

Rationale: CRR ties comment selection to whether developers made code changes after a comment, giving a scalable user-action signal.

“The selection process is optimized based on our north star online metric to measure success, code resolution rate (CRR)”article, stated
“It provides a large amount of actual user action signals with more than 53K+ code reviewer comments captured along with their associated code resolution outcomes.”article, stated

Use raw comment text first

Chose LLM-generated comment content as the current ranker input over Immediately adding richer code, file, PR, and Jira features.

Rationale: The raw-text classifier performed well enough for production, while additional signals remain future work.

“We currently only use the LLM generated comment content in its raw textual format. We have seen it’s performing well so far”article, stated
“Examples of such data signals are raw or derived signals from code diff, comment category, file extension, PR title, PR description, Jira title and description etc.”article, stated

Add a specialized ML quality gate instead of relying only on the upstream LLM

Chose ModernBERT ranker as a post-generation filter over Prompting or swapping the generation LLM alone.

Rationale: The ranker complemented LLM generation and stayed robust across GPT-4o, Claude Sonnet 3.5, and Sonnet 4 transitions.

“our comment ranker actually complements LLMs pretty well.”article, stated
“we have smoothly transitioned from GPT-4o to Sonnet 3.5, and also from Sonnet 3.5 to Sonnet 4”article, stated

Gotchas (what bit them)

LLM review comments can harm UX when quality filtering is absent.

Root cause: Generated comments may be noisy, nit-picky, or factually wrong.

Resolution: Atlassian added an ML comment ranker to select useful comments before posting.

“Without any filtering process in place, LLM generated comments can be very noisy, nit-picky or even factually wrong which directly leads to users’ negative feedback.”article, stated
“With those in mind, we developed an ML model used to rank and select good comments.”article, stated

A model trained on limited internal data degraded when repository coverage expanded.

Root cause: The first model version used a limited set of repository signals that did not cover the broader rollout distribution.

Resolution: The team retrained on more diverse data from all eligible Atlassian repositories, increasing training comments from about 10K to 53K.

“we extended our product enablement from a limited number of repos to all Atlassian repos, we saw the model precision dropped (CRR dropped from ~40% to ~33%)”article, stated
“review comments in training data increased from ~10K to ~53K), we retrained the model and the model precision quickly recovered”article, stated

Resolution rate may miss valuable review comments that do not trigger immediate code changes.

Root cause: Code resolution is a binary behavioral outcome centered on code edits at the commented line.

Resolution: The source keeps future feature engineering open to add richer signals beyond raw comment text.

““Code resolution” is a binary outcome. It is defined by whether the PR author made code changes after the comment was created on the line of code where the comment was made.”article, stated
“we are also working on feature engineering efforts which will help to generate and leverage more data signals.”article, stated

Evaluation

Atlassian evaluated the ranker using online code resolution rate, offline precision-like metrics, A/B threshold tests, hold-out datasets, before/after model-switch comparisons, internal human-review benchmarks, external beta metrics, and qualitative customer feedback.

Metrics: code resolution rate · threshold score optimized by A/B testing · hold-out dataset generalization · 40-45% CRR after ranker · human benchmark around 45% · CRR drop from ~40% to ~33% during broader rollout · PR cycle time reduction of 30%

3 supporting quotes
“After training, we evaluate it on a “hold-out” dataset to see how well it generalizes on unseen data.”article, stated
“Both versions of comment ranker has contributed to increasing CRR to 40% ~ 45% while maintaining similar coverage or prevalence level.”article, stated
“the human benchmark which is about 45%, which was determined internally from our engineers’ Bitbucket usage data.”article, stated

Outcomes

The source reports 10K+ MAUs, 43K+ PRs monthly, 400+ external active beta customers, 53K+ code-review comments in training data, and a 30% PR-cycle-time reduction.

3 supporting quotes
“Our team did a study which shows it reduced PR cycle time by 30% for pull requests resolved by the code reviewer agent, compared to those resolved by humans.”article, stated
“the model precision quickly recovered (CRR improved back to ~40%).”article, stated
“After we made the switch with comment ranker in place, we have seen the CRR stay very consistent before and after.”article, stated