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!
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-Traj
Lego-X/LegoReview-Bench
Spaces citing this paper 0
No Space linking this paper