Code and software engineering data
Code Preference and Reward Data from Review Outcomes
Quick answer
A code preference dataset built from review outcomes pairs two versions of a change written for the same task, with a label saying which one the engineering organization accepted. The strongest signals come from real workflows: the first revision of a pull request versus the merged revision, approved versus "changes requested" reviews, abandoned PRs with a recorded reason, and reverts or hotfixes linked to incidents. Each pair must share the same base commit and task, and confounds such as business-driven abandonment must be filtered before the pairs train a reward model or DPO run.
By SourceX Editorial · Updated
Grader rubric
Code Preference and Reward
Why review outcomes complement synthetic code preferences
Review outcomes carry preferences that real maintainers acted on, which synthetic judgments may not fully reproduce. Much public code preference work relies on generated data: CodeFavor, for example, trains on synthetic Commit-Instruct and Critic-Evol pairs and evaluates on CodePrefBench, 1,364 tasks spanning correctness, efficiency, security and human preference [2]. Recent reward-model research has also drawn a large share of training samples from GitHub commits that were later merged through pull requests, treating the merge as the preference signal [3].
Private review histories go further than public merges. They include the rejected side: the revision a senior reviewer blocked, the PR closed for a security concern, the change reverted after it paged on-call. Expert studies also show that preferences on readability, modularity and commenting are partly subjective [4], so labels from the organization that maintains the code can reflect its own standards more closely than generic crowd judgments; aligning models to human code preferences is an active research area [5]. For the license and data-type framing, see the owner page on licensing code reviews and pull requests and the definition of preference data.
Five review signals and what each one actually labels
Each review signal labels a different property, so treat them as separate label sources rather than one "accepted vs rejected" flag. The table below maps signals to the field evidence you should require.
Illustrative example: invented to show structure; it does not describe an available dataset.
| Signal | Chosen side | Rejected side | Evidence fields to require | Main confound |
|---|---|---|---|---|
| First vs merged revision | Merged head commit | First pushed revision | PR id, base SHA, revision SHAs, review comments between them | Revisions that only rebase or fix merge conflicts |
| Approval vs changes requested | Revision approved | Revision with CHANGES_REQUESTED review state | Review state, reviewer id (pseudonymized), timestamp | Style nits weighted like defects |
| Rejected or abandoned PR | Alternative merged fix for the same issue | Closed, unmerged PR | Linked issue id, close reason, closing comment | Abandoned for priority, staffing or product reasons |
| Revert | Code after the revert or follow-up fix | Reverted change | Revert commit, reverted SHA, reason text | Reverts of good code for release timing or feature flags |
| Incident hotfix | Hotfix change | Causing change | Postmortem or incident id linked to the causing SHA | Misattributed root cause |
The first-versus-merged signal is the most plentiful and the least noisy when review comments explain each revision. Revert and incident signals are scarce but valuable for teaching a reward model about defects that passed review once. Hold them out as a separate slice so you can measure whether your model learns failure modes rather than style.
Controlling confounds before you build pairs
A preference label is only meaningful when the rejection was caused by the code itself. PRs are frequently closed because a roadmap changed, an owner left or a different team shipped first. Reverts often happen during release freezes or because a feature flag was removed, not because the code was wrong.
Ask suppliers to export reason codes where their tools record them, such as close-reason labels, revert commit messages and incident tags. Where no reason exists, filter by evidence of a defect: a failing CI run on the rejected revision, a review comment citing a bug, a linked bug ticket, or a test added in the merged revision that fails on the earlier one. Executable evidence, where the build and test environment can be reproduced, is the strongest filter and turns a soft preference into a verifiable one. Requirements for build and test reproducibility belong in your code dataset request specification.
Keeping both sides of a pair on the same task
Pairs must share the same task context, or the model learns to prefer the task rather than the solution. In practice that means the same linked issue, the same base commit and the same target files, with any rebase noise stripped out. Two PRs against different base SHAs can differ for reasons that have nothing to do with quality.
Store the prompt side as the issue text plus the repository state at the base SHA, and the response sides as diffs against that state. For agentic or repository-level reward models, include the cross-file context each side touched; the page on repository-level code context covers what to request. Deduplicate pairs across forks and vendored copies before splitting train and evaluation sets, as described in deduplicating code training data.
Weighting labels by reviewer and agreement
Not every approval carries the same information, so carry reviewer metadata forward as weights rather than discarding it. Useful fields include a pseudonymized reviewer id, the reviewer's code-owner status for the touched paths, tenure band and the number of independent approvals. A change approved by two code owners after requested changes is a stronger label than a single rubber-stamp approval on a Friday afternoon.
Where several reviewers disagree, keep the disagreement as a soft label or margin. DPO optimizes directly on chosen and rejected pairs without training a separate reward model [1], so noisy pairs flow straight into the policy; curation and pair quality strongly shape preference optimization results [6]. The same agreement data lets you calibrate an LLM judge against the organization's own reviewers before you use it to label more pairs.
A record layout that serves reward models, DPO and judges
One pair record should support reward-model training, DPO and judge calibration without re-export. A useful layout is JSON Lines with one pair per line.
Illustrative example: invented to show structure; it does not describe an available dataset.
{
"pair_id": "p-000412",
"repo_ref": "repo-17",
"language": "java",
"base_sha": "a91f3c2",
"task": {"issue_ref": "ISSUE-2210", "issue_text": "Retry logic double-charges on timeout"},
"chosen": {"revision_sha": "e04b7d1", "diff": "...", "source": "merged_head"},
"rejected": {"revision_sha": "c55a019", "diff": "...", "source": "first_revision"},
"signal": "first_vs_merged",
"evidence": {"ci_rejected": "fail", "ci_chosen": "pass", "review_comments": ["Idempotency key missing on retry path"]},
"reviewers": [{"id": "r-hash-3f2", "code_owner": true, "state": "CHANGES_REQUESTED"}],
"confound_flags": [],
"deidentification": {"method": "pseudonymized author and reviewer ids; secrets scan on diffs"}
}
Request that the evidence and confound_flags fields are filled before delivery, not inferred later. Diffs and review text frequently contain credentials, internal hostnames and customer identifiers, so require a full-history secrets scan as covered in secrets in code datasets.
Rights and diligence questions specific to review data
Review data mixes code, comments written by employees and sometimes contractor or open source contributions, so ownership has to be checked on each layer. Confirm that the supplier owns the repositories, that contributor agreements cover employee and contractor comments, and that vendored third-party code is identified; code ownership due diligence lists the documents to ask for. Copyleft code merged into a private repository can travel into your pairs, which the page on copyleft contamination addresses.
SourceX prepares diligence materials on source, rights, preparation and allowed use for each dataset. It sources operational datasets, including engineering records, from companies in the U.S., Canada, the EU, the UK, Australia, New Zealand, India, Singapore, South Africa, Latin America, the UAE and Saudi Arabia and manages the licensing process; every dataset is rights-reviewed for ownership and consents and delivered under a license that defines records, uses, term and delivery. Personal details such as names and emails are removed or replaced before delivery, the method is recorded and a sample is checked, though no method is perfect. Buyers describe the data they need on the SourceX buyer page, not the businesses that might hold it.
How to evaluate a sample before licensing
A small sample should prove that pairs are task-aligned, labeled with evidence and free of leakage. Check at least these points:
- Every pair shares a base SHA and issue reference, and diffs apply cleanly.
- The share of pairs with defect evidence (failing CI, bug-citing comment, linked bug) is reported per signal.
- Close and revert reasons are present or explicitly marked missing.
- Reviewer fields are pseudonymized consistently across the sample.
- No pair overlaps public repositories used in your benchmarks; see code benchmark contamination.
The broader checklist is in evaluating a code dataset sample, and the code data buyer's map places this page among other code datasets. Post-training teams sourcing SFT and RL data alongside preferences can start from the post-training teams guide and human feedback and QA score datasets.
Request code preference data from real review histories
SourceX sources engineering records from companies in the U.S., Canada, the EU, the UK, Australia, New Zealand, India, Singapore, South Africa, Latin America, the UAE and Saudi Arabia on request; nothing is held in stock and a request does not guarantee a match. The process runs Find, Assess, Agree, Transact and Manage, the supplying company approves the scope and terms and signs before any data is delivered to SourceX, and nothing is contracted until a supplier agrees. Describe the review signals, languages and evidence you need on the SourceX buyer page.
What do the stated reasons for reverts say about the reverted code?
Often something other than the code's quality, and often nothing at all. In the flutter/flutter repository, 5,297 commits reached the master branch in 2025 (counted at commit 2381790 on 2026-10-27), and 155 of them were reverts, not counting reverts of reverts. 99 carry a stated reason, 98 of them in the field the project's revert bot fills in and 1 written by hand; 56 have none. Of the 99, 63 cite a failure in the project's own tests, builds or benchmarks after merge, 13 cite a break in internal or downstream code such as Google's internal tests or a google3 roll, 8 cite process or sequencing (landing during a tree closure, a skipped presubmit, unapproved golden images, a collision with another change, a fix that landed elsewhere), 13 give some other reason and 2 are only a link. Nine hedge the culprit with words such as possibly or likely.
Project policy explains the pattern. Flutter's tree hygiene guide says regressions "should be reverted first and questions asked later", tells contributors to revert a check-in that broke the main branch "even if it isn't yours" and not to forward-fix post-submit test failures. It also notes that the Google Testing check runs tests internally at Google that are not publicly accessible. The project documents the revert-label path for changes less than 24 hours old; older changes are reverted as regular pull requests through GitHub's revert button. A revert therefore records a fast move back to a known-good state, and its reason is a short note written in that hurry.
How often does reverted code come back, and what does that do to a rejected label?
More than a third of the time within 90 days. Of the 155 reverts, 58 (37.4 percent) were followed within 90 days by a commit that landed the change again, matched by title, by a revert of the revert, or by a message naming it as a reland. The rate differs by stated reason: 8 of the 13 internal or downstream reverts and 5 of the 8 process reverts came back, against 31 of 63 reverts for the project's own test failures and 9 of the 56 with no reason field.
These matches are a floor. The guide asks authors to avoid the word Reland and to land the change afresh with its original message, and a reland that changed its title without citing the reverted pull request is missed. For a preference dataset, a revert that came back is not a rejected change: it is one of two or more attempts at the same task, and the difference between the attempts is what deserves the label.
Which preference label can each kind of revert reason support?
Only reasons that point at the code support a code label; the rest call for a different label or none. The rubric below extends the page's revert signal, which pairs the reverted change with the code after it, by asking what each reason can carry before a pair is built:
| Stated reason | Label the revert can support | Evidence to require before pairing | Reliability caveat |
|---|---|---|---|
| Failure in the project's own tests or builds after merge | Rejected for the failure shown, paired with the reland when one exists, else with the parent state | The failing run, a passing run on the parent and the reland diff | Shared or flaky failures; 9 of the 99 stated reasons hedge the culprit |
| Break in internal or downstream code | Breaks a consumer; code quality unknown until the consumer evidence is read | The consumer's failing test or migration note, which only the organization that runs those tests can supply | Not checkable from public history; the defect may be named only in a later reland message |
| Process or sequencing: tree closure, skipped check, collision, superseded | No code label; keep as context for the episode | The tree status or merge queue record at merge time | The code can still change before it returns, as in the case below |
| Hedged culprit: possibly, likely, apparently | Hold out until the culprit is confirmed | A reland outcome, a bisect or a passing rerun without the change | The revert may have removed an innocent change |
| No reason field, or a link only | Unlabeled | The linked run or issue, read by a reviewer | 58 of the 155 reverts in 2025 fall here |
What does one reverted pull request look like with its operational context?
It looks like five commits and three different explanations. A change meant to stop dialogs closing early on Flutter Web with semantics enabled was reverted for breaking internal tests, relanded with a rework, reverted again because it landed during a tree closure and relanded a second time with two files' edits removed or cut back. The defect itself, modal routes made opaque so that platform views stopped receiving pointer events, is named only in the reland messages, which describe each earlier revert as due to test failures.
The defensible pair is the first change against the final reland, both fixing issue 149001, labeled with the defect the reland message names; neither revert reason read alone would produce that label. A buyer requesting reverted pull request context should ask for the revert reason as written, the internal or downstream test results behind it and the reland links, and tie each label to one of them. SourceX's request form asks for scope, volume, language, format, timing and licensing; the reason classes and the reland check above fit there as the acceptance test. The chain, from the public history:
| Commit | When (UTC) | What the record says | What it means for the label |
|---|---|---|---|
| #177570 merged | 18 Nov 2025, 05:39 | Propagates hit-test behavior through semantics and declares modal routes opaque to pointer events; 9 files changed | Candidate rejected side |
| #178744 reverts it | 18 Nov 2025, 17:44 | Reason field: Broke internal tests. | Internal break with no public evidence |
| #178817 relands a rework | 25 Nov 2025, 18:16 | Message: the original incorrectly applied opaque behavior to ModalRoute, which blocked platform views from receiving pointer events; 14 files changed | The defect is named a week later, outside the revert |
| #179100 reverts the reland | 25 Nov 2025, 22:51 | Reason field: change was landed during tree closure | Process reason; silent on the code |
| #179352 relands again | 10 Dec 2025, 22:31 | 13 files changed; the routes.dart edit is gone and the dropdown test edit shrinks from 136 changed lines to 1 | Chosen side; its message gives test failures as the reason for the revert that cited a tree closure |
Sources for this section
- Counted in the flutter/flutter master history at commit 2381790: 5,297 commits in 2025, 155 reverts (reverts of reverts excluded), 99 with a stated reason (98 in the revert bot's field), 58 relanded within 90 days, under the rules stated in the writer notes. Source
- Flutter's tree hygiene guide says regressions should be reverted first and questions asked later, asks contributors to revert a breaking check-in even if it isn't theirs and not to forward-fix post-submit failures, and asks authors to avoid Reland in commit messages and land the change afresh with its original message. Source
- Flutter's Understanding Google Testing page describes Google Testing as a presubmit check that runs a subset of internal Google tests on most pull requests. Source
- Flutter's autosubmit documentation describes the revert label path for broken changes within 24 hours old and the GitHub revert button, treated as a regular pull request, for older changes. Source
- Pull request 177570, merged 18 November 2025, propagated hitTestBehavior through the semantics pipeline and declared modal routes opaque to pointer events (9 files changed). Source
- Pull request 178744 reverted 177570 on 18 November 2025 with the reason field Broke internal tests. Source
- Pull request 178817, merged 25 November 2025, relanded the change and states that the original incorrectly applied opaque behavior to ModalRoute, which blocked platform views from receiving pointer events. Source
- Pull request 179100 reverted 178817 on 25 November 2025 with the reason field change was landed during tree closure. Source
- Pull request 179352, merged 10 December 2025, relanded the change across 13 files and describes the earlier revert as due to test failures. Source
Sources
- arXiv (Rafailov et al., Stanford), "Direct Preference Optimization: Your Language Model is Secretly a Reward Model" (2023). https://arxiv.org/abs/2305.18290v1
- arXiv, "Learning Code Preference via Synthetic Evolution" (2024). https://arxiv.org/pdf/2410.03837
- arXiv, "Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoring" (2026). https://arxiv.org/pdf/2605.00754
- arXiv, "Subjective Code Preferences in Experts and Large Language Models" (2026). https://arxiv.org/pdf/2605.25296
- arXiv, "Learning to Align Human Code Preferences" (2025). https://arxiv.org/pdf/2507.20109
- arXiv, "When Data is the Algorithm: A Systematic Study and Curation of Preference Optimization Datasets" (2025). https://arxiv.org/pdf/2511.10985
Tell us what your models need
Share scope, volume, language, format, timing and licensing requirements.