AutoRefine: Auto-Calibrating Code Judges from Workflow Outcomes
Shervin Shahidi, James Poon, Hang Xie, Kenneth O. Xu, Robin Håkanson, Vikram Nair, Jens Pillgram-Larsen, Nachiappan Nagappan
cs.AI, cs.SE
2026-11-06
Meta's AutoRefine calibrates LLM code judges from workflow outcomes instead of hand labels; a teacher abstains on labels it cannot explain, and held-out agreement (Scott's π) rose 0.16→0.51.
Coding agents produce diffs at scale, and most of what they write has no test to verify it: refactors, performance work, cleanups. The standard fix is an LLM judge in the pipeline, a model that returns PASS or FAIL and decides which diffs reach human review. A judge is only as good as its calibration to the task, and calibration has meant hand-labeled data: expensive, and stale the moment the agent, the model, or the code distribution moves. In practice many judge prompts are never validated at all.
The development workflow already emits labels for free: tests pass or fail, diffs land or get abandoned. The catch is noise. A diff can be abandoned for scope, process, or a broken pipeline rather than the code, and outcomes can hinge on information the judge never sees, such as hidden tests. Fit a prompt to those labels directly and the judge learns to predict noise. Calibration is a lifecycle problem: it has to run unattended and rerun whenever the agent evolves.
AutoRefine is a loop with two parts: a calibration loop and an informed teacher.
The loop dresses prompt optimization up as training. The prompt is the parameter, agreement with labels (Scott's π) on a training split is the loss, disagreement analysis is the gradient, and an uncurated validation split picks the final prompt and stops the loop. Each iteration runs the judge on the training split; for every wrong verdict, a separate LLM (Claude Opus 4.7) reads the judge's verdict and reasoning next to the label and the teacher's justification, then proposes edits. Edits must be balanced: every new reason to fail is paired with a reason to pass, otherwise the optimizer drifts into the degenerate reject-everything solution. Five iterations at most, on training splits of 125 to 127 diffs. The agent's patches are recorded once and replayed, so calibration never reruns the agent under test.
The teacher screens training labels before the loop sees them, and it sees one thing the judge does not: the outcome. Three actions. Explain: write a justification grounded in the judge's view, which disagreement analysis uses to tell the rewriter where the judge went wrong. Correct: flip a label when the view clearly contradicts it, which happened twice in 512 merge/abandon diffs. Abstain: return SKIP when the outcome cannot be explained from what the judge sees, and drop the sample instead of inventing a label. The design echoes distillation with privileged information: the teacher sees the result, the judge never will, and it translates 'why this outcome' into 'why, from the judge's inputs'; when the translation fails, it refuses. The abstention rate doubles as a monitoring signal: heavy abstention means the judge needs better inputs, and a better prompt will not fix that.
Three layers of experiments.
Under trustworthy labels (industrial monorepo, execution oracle as the label, tests stripped from the patches, judges are Claude Opus 4.8):
| Setting | π | FAIL recall | PASS recall |
| Rubric judge, uncalibrated | 0.36 | 0.50 | 0.89 |
| Uncalibrated, threshold tuned on train | 0.33 | 0.69 | 0.80 |
| Uncalibrated, best threshold picked on test (cheating bound) | 0.42 | n/a | n/a |
| Calibrated | 0.60 | 0.64 | 0.95 |
Threshold tuning does not explain the gain. To reach similar failure recall, the uncalibrated prompt at a train-set threshold flags about four times as many good patches (PASS recall 0.80 vs. 0.95), and the best threshold picked on the test set itself reaches only 0.42. Calibration's paired gain is +0.27 to +0.30 in π, McNemar p ≤ 0.013 in every replay.
Noise reduction. With 25% of labels flipped at random, the teacher set aside 13 of the 24 landed diffs that had been relabeled abandoned, against 16 of 73 genuinely abandoned ones (Fisher p = 0.004); overall noise fell from 24.9% to 20.4%, while dropping the same number of labels at random leaves it unchanged (p < 0.001).
Deployed recalibration. A performance-optimization agent's judge (v1) had been tuned on an older workflow; AutoRefine recalibrated it on 125 diffs from the current workflow, and v2 replaced v1 in production. The judge runs in shadow mode to help triage, so landed recall is the deployment metric. On 17 independently held-out test diffs, π rose from 0.16 to 0.51 and landed recall from 6/8 to 8/8; on 43 current-distribution diffs the paired gain is +0.31 (CI [0.03, 0.61]) with landed recall up from 12/20 to 18/20, hitting the 0.90 target. On 16 diffs from the older workflow v1 still wins and v2 falls to -0.02, which is the paper's own point: the agent moved and the old calibration expired with it.
Abstention as diagnosis. The teacher abstains on 60% of diffs abandoned after review, 32% of abandoned drafts, and 5.5% of landed diffs. Reviewer comments back the reading: comments cite a problem visible in the diff for 13 of 19 diffs the teacher kept, versus 14 of 38 it abstained on (p = 0.048); the rest cite duplicates, superseded work, or a cleanup bot. In the harshest setting, with the reference patch removed and failures visible only in hidden tests, the teacher abstained on 12 of 13 validation failures and none of 72 passes; human engineers reviewing similar tasks blind also missed nearly all failures, rating 54% of them correct. The judge's inputs genuinely cannot carry these failures, and abstention flags exactly that condition.
Teams running agent evaluation or QA pipelines can lift the structure wholesale: labels come from the deployed workflow at zero annotation cost, the loop runs unattended, and it reruns whenever the agent or its pipeline changes. Against calibration routes that need human grades (AutoCalibrate, EvalGen), keeping the supervision signal fresh is an order of magnitude cheaper.
The abstention signal is the more durable idea. Most work on improving LLM judges assumes the inputs are adequate and keeps editing the prompt; this gives a measurable way to separate 'the prompt is wrong' from 'the inputs are wrong'. For the second, the fix is feeding the judge reviewer comments or test results, not another prompt revision.
Honest framing: an engineering paper from one monorepo and one deployed agent, with small samples. The mechanism is credible; the magnitudes are not general numbers.
Stated by the authors: workflow outcomes stand in for code quality, and abstention also drops useful samples, including genuine failures that read clean; judge and teacher share a model family (Claude), with self-preference risk; the teacher is asymmetric by prompt design, catching correct patches labeled FAIL while letting failing patches labeled PASS through (19 of 22 kept in one setting), so use cases needing the opposite must retune it; all studies come from one data source and one agent in use; each calibration loop ran once per setting, and the human review covers 56 tasks with moderate inter-team agreement (κ = 0.43).
Three more from the numbers. The absolute noise reduction is modest, 25% to 20.4%; the value is that removal is targeted and explainable. In the setting where failures are invisible in the patch, the teacher set aside genuine failures almost as often as flipped ones (20 of 27 vs. 19 of 21), so the gain there matches a rule that drops every FAIL label. And the clean 0.36-to-0.60 result depends on the judge seeing the reference patch: with the reference removed, the same loop reaches only 0.35, because the teacher abstains away most training failures and the loop has little to learn from; the method's ceiling is set by whether the judge's view contains the evidence. The 17-diff independent test carries a CI of [0.00, 0.74], with the lower bound on zero, so the deployment claim leans on the 43-diff slice's +0.31.