LegoReview: Scaling Code Review Data with Verification from Pull Request Histories
Abstract
As coding agents write a growing share of software, automated code review becomes increasingly necessary. Training capable reviewers calls for scaling verifiable tasks and verified trajectories. However, code review produces open-ended, natural-language findings whose correctness cannot be verified simply by running tests. We observe that pull request (PR) histories provide an implicit verification signal: discussions, code revisions, and other actions reveal which findings were accepted or fixed and which were withdrawn or rejected. Therefore, we introduce LegoReview, a pipeline that reconstructs reviewed code snapshots from merged GitHub PRs and uses their discussions and revisions to construct verifiable review tasks and verify training trajectories. From 556k merged PRs, we build 168k review tasks and 60k verified trajectories, spanning eight programming languages and eight finding categories such as correctness, maintainability, and design. Fine-tuning Qwen3.5-35B-A3B-Base on just 1k verified trajectories raises F1 score from 5.7 to 43.1 on our proposed LegoReview-Bench, and scaling to 60k raises it further to 56.1. Further, the benefits of review training extend to coding tasks like feature implementation and issue resolution: compared to coding-only training, joint training with review trajectories raises scores from 26.5 to 31.9 on DeepSWE and from 62.8 to 70.6 on SWE-bench Pro V2 Hard. Behavioral analysis suggests that review training encourages more frequent code checks during implementation and improves the recognition and revision of incorrect patches.
Community
Hi everyone! We are the authors of LegoReview.
Reliable code review closes the loop on software development, enabling stronger coding agents and higher-quality patches. To scale verified review data, we turn GitHub PR discussions, follow-up commits, and clean merges into a finding-level verification signal.
- Open Data & Benchmark: 168k review tasks in LegoReview-Task, 60k verified trajectories in LegoReview-Traj, and LegoReview-Bench covering both defect and clean code changes across 8 languages.
- Stronger Reviewer: LegoReview-35B-A3B raises LegoReview-Bench F1 from 5.7 to 56.1 with a 90.9% Clean Rate, more than doubling Qwen3.5-35B-A3B at 24.4 F1.
- Better Coding: Joint training with review trajectories lifts first-pass accuracy from 26.5% to 31.9% on DeepSWE and 62.8% to 70.6% on SWE-bench Pro V2 Hard, with self-review and revision pushing them further to 34.5% and 74.5%.
All code, datasets, and models are open-source. Happy to answer any questions!
Using what happened to a finding afterwards (fixed, withdrawn or rejected) as the check on whether it was right is a sound idea. Coming from construction estimating, that's how you grade an inspector over time: by which notes turned into a repair, and not by how many notes got written. One thing I'd like to understand is how the pipeline treats findings that were correct but ignored because the team was in a hurry. A merged PR records what people did, which isn't always what was true. Thank you for releasing the tasks and the benchmark.
Thanks, Sal. We label each finding using evidence from the PR history. A follow-up fix or explicit acceptance supports the finding; a withdrawal by the reviewer or an explicit rejection by the author or maintainer counts as opposing evidence. If the evidence is missing or conflicting, we label the finding uncertain. So if the team moves on without addressing a finding and there’s no other evidence either way, it falls into that third category. The merge itself doesn’t count against it.
Across the 558,184 reference findings in our defect tasks, 78.2% were supported, 7.4% opposed, and 14.4% uncertain.
Get this paper in your agent:
hf papers read 2612.00862 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 1
Datasets citing this paper 3
Lego-X/LegoReview-Bench
Lego-X/LegoReview-Traj
Spaces citing this paper 0
No Space linking this paper