Render Traces, Not Screenshots: Stable Patch Verification for Visual Program Repair

Repair systems for visual software bugs (a chart axis that renders in the wrong place, a map layer that clips, a button that overlaps its neighbor) now decide which candidate patch to keep by showing a vision-language model (an LLM that reads images) a screenshot of the patched program and asking whether the bug is gone. This judge is where two known weaknesses meet. Multimodal models often misread fine visual detail, and LLM verdicts often flip when a prompt is reworded in a way that should not matter. We propose to measure how much of the judge's error comes from each weakness. We also propose a replacement verifier. It reads a structured trace of what the browser actually drew, meaning element boxes from the page layout or logged canvas drawing calls, and it asks the model to reason over that trace instead of perceiving pixels.

The stakes are highest for multi-hunk fixes, meaning patches that edit several separate places in the code at once. Layout and rendering code is globally coupled, so a coordinated edit in one file can silently shift an element in a distant part of the page. A screenshot judge that attends to the reported symptom will miss that side effect, and a reworded prompt may be enough to make it notice or ignore it. Our claim is that a verifier built on render traces catches these distant regressions and gives the same verdict under rewording, where the screenshot judge does neither reliably. We also claim that a structured verifier is what would let iterative visual repair make coordinated multi-location edits safely, rather than restricting itself to one localized change per round.

Core Claim

The claim has three parts. First, on SWE-bench Multimodal, the VLM judges used for patch validation are unstable under meaning-preserving prompt perturbations, and their instability is concentrated on the cases that are perceptually hard: small spatial changes, and multi-hunk patches whose side effects appear away from the reported symptom. Second, this instability predicts judge error, as it does for text classification in On the Relation between Sensitivity and Accuracy in In-Context Learning. Third, moving the perception step out of the model largely removes both the instability and the error. Here "moving it out" means extracting a deterministic render trace, diffing the traces before and after the patch, and attributing each changed element either to the symptom region or to collateral damage. If the third part holds, better patch selection should follow at a fixed candidate budget, and so should stable iterative repair with multiple edits per round.

The novel element is the verifier, and we do not claim a new repair agent. Prior work supplies the ingredients and the motivation. Seeing is Fixing (GUIRepair) renders candidate patches with Playwright and accepts them using a pixel comparison plus a VLM judgment. It never tests whether that judgment is stable, and it gives no structured account of where a change occurred. FailureMem adds tools that let the agent crop and ground regions of the screenshot, which reduces hallucinated page elements, but the perception it improves is still done by the model on pixels. Rubrics as Visual-Repair Context (RubSE) diagnoses "visual repair coupling," where fixing one element breaks distant ones. It avoids the problem by allowing only one rubric-guided edit per round, which rules out the coordinated multi-hunk edits that distributed bugs require (Multi-Location Program Repair Strategies Learned from Successful Experience). Two perception papers suggest the remedy. CodePercept finds that scaling perception helps downstream tasks more than scaling reasoning, and it uses executable plotting code as a structured perceptual medium. BeaconChart shows that an independent extractor, one that does not see the main agent's reasoning, catches perceptual errors. We carry the "structured medium, independent extraction" idea from chart question answering to patch verification, where the browser, not a model, does the extraction.

Research Program

The render trace. For pages that render to the page layout (the DOM, the browser's tree of page elements), the trace is the set of visible elements with their tag, element path, computed bounding box, and a small set of computed styles, captured at a fixed viewport. Many SWE-bench M repositories, such as Chart.js and OpenLayers, draw to an HTML canvas, which has no element tree. For these, we wrap the canvas 2D drawing context and log each drawing call with its transformed coordinates, fill and stroke state, and text.

The canvas case is the main engineering risk. Canvas logs are noisier, so we report results for DOM pages and canvas pages separately.

The verifier. The verifier renders the pre-patch reproducer and the post-patch program, using GUIRepair-style reproducer snippets as the harness. It then aligns the two traces by element identity, or by call-sequence matching for canvas. From that alignment it computes two quantities: how much the symptom region changed toward the behavior the issue describes, and how many changes fall outside it. The symptom region is localized once, from the issue text and screenshot. This is the only step that still uses the vision model, and we repeat it under perturbation so we can measure its stability too. A text-only LLM then reads a compact summary of the trace diff and returns an accept or reject decision. The model reasons over the trace but never has to perceive pixels.

The sensitivity audit. For every candidate patch, we query the standard screenshot judge under a fixed family of meaning-preserving perturbations. The family covers paraphrased instructions, before/after image order, whether the reference image comes first or last, crop scale, and rubric wording. We record the flip rate: the fraction of perturbations whose verdict differs from the majority verdict. We use the same family on the trace verifier's reasoning step. Following ProSA, which links sensitivity to low decoding confidence and finds sensitivity highest on complex reasoning and code, we expect flip rates to rise with the number of hunks and to fall as the rendered symptom gets larger. ProSA and SENSEL were run only on text. Whether their findings carry over to image-conditioned judgments of code is an open question, and our audit tests it directly.

The iterative-repair extension. In the RubSE loop on Design2Code, we replace the single-rubric restriction with a rule that permits several edits per round. Every edit is gated by the trace verifier, and a round is rejected if collateral changes exceed a threshold. This tests whether structured verification can stand in for the one-edit-per-round restriction.

Baselines

The naive reference point is no verification: the repair agent's first plausible candidate is submitted, which is how SWE-agent M operates. SWE-bench Multimodal reports a 12.2% resolve rate for SWE-agent M with GPT-4o. We rerun it on our candidate pools so that every method selects from exactly the same patches.

The strongest verification competitor is GUIRepair's Code2Image validation, which combines Playwright rendering, a pixel comparison, and a VLM verdict. GUIRepair reports solving 157 instances (30.37%) with GPT-4o and 175 instances with o4-mini. The file lists 619 instances there, against 617 in the benchmark paper, so we fix one instance list. The strongest end-to-end system is FailureMem, which reports a 33.1% resolve rate with GPT-5.1. We use FailureMem's candidate generation, with active perception and failure memory, as an alternative source of candidates, so the verifier is tested on the best available patches and not only on weak ones. For fairness, every verifier receives the same k candidates per issue, generated once and cached. Every verifier gets the same backbone and the same number of model calls, and a matched budget for tuning prompts on a held-out development split of repositories. Beating GUIRepair means a higher resolve rate at equal k and equal calls, measured by the benchmark's hidden unit tests.

We also run the obvious cheaper verifiers. The first is a pure pixel diff restricted to the symptom region, with a global-change penalty. The second is Design2Code-style Block-Match and position similarity between post-patch and expected renders (Design2Code). The third is self-consistency: the screenshot judge sampled at temperature, with a majority vote at the same call count as our perturbation family.

Two ablations isolate the key ingredient. The first gives the trace verifier the trace diff but no attribution of changes to symptom versus collateral regions. The second gives the screenshot judge the symptom-region localization but no trace. We also test SENSEL-style abstention: when the judge's flip rate is high, the patch is routed to the trace verifier or rejected. For judge accuracy on SWE-bench M, measured against hidden tests, we found no reported result on Lacuna, so that number is produced by this project.

Why not just…?

Why not just use a pixel diff or Block-Match, which is deterministic and has no prompt sensitivity at all? This is the most serious threat, and we treat it as a real competitor rather than a strawman. A pixel diff can tell that something changed, but not whether the change is the intended fix or collateral damage. Anti-aliasing, font rasterization, and animated canvas redraws also create changes everywhere. Design2Code's own drop from 93.0 to 56.6 Block-Match on its HARD subset shows that flat visual metrics weaken on complex nested layouts. If the region-restricted pixel diff matches the trace verifier on multi-hunk instances, then our contribution reduces to "localize, then diff pixels," and we will report it that way. The hunk-count stratification settles the question: our prediction is that the gap opens specifically for patches with three or more hunks.

Why not just sample the VLM judge several times and take a majority vote? Self-consistency averages over the model's sampling noise, but a perceptual misreading is usually systematic, not random. A judge that cannot see a 10-pixel shift will vote the same way every time. VCBench (Benchmarking Multimodal Mathematical Reasoning with Explicit Visual Dependency) attributes about 62% of Gemini 2.0 Flash failures to perception, and finds that step-by-step reasoning rationalizes those errors rather than fixing them. Voting cannot repair a premise the model never perceived. The matched-budget comparison checks this directly: if voting closes the gap, the judge's errors were noise rather than perception.

Why not just use a stronger VLM? The file offers some support that scale alone is insufficient. On CharXiv (CharXiv), 20 of 24 models were near chance at counting tick marks. ProSA's "unstable genius" result finds that stronger models can be more volatile at the level of individual instances. Still, this is an empirical question. We run the audit across a weaker and a stronger backbone, and we report whether the flip rate and the trace verifier's advantage shrink with scale.

Why not just rely on reproducer tests, as in GUIRepair? Reproducer tests show that a symptom exists, but they rarely assert where distant elements should sit, so they cannot catch collateral regressions from coupled edits. The trace verifier complements reproducers rather than replacing them: we use the reproducer as its rendering harness.

Proposed Experiments

The first experiment is the audit. On SWE-bench M, we generate k candidates per issue with SWE-agent M and FailureMem-style pipelines and label each with the hidden tests. For every candidate we measure the screenshot judge's accuracy, its flip rate, and the correlation between flipping and error, stratified by number of hunks, symptom area, and DOM versus canvas rendering. A small human audit covers patches that pass the tests but look visually wrong, since the tests may not check layout. The decisive check is whether the flip rate predicts judge error better than the judge's stated confidence, in the spirit of SENSEL's +4.1 AUC gain over maximum softmax probability on GPT-J-6B.

The second experiment is selection. At fixed k and fixed call budget, we compare resolve rates for no verification, GUIRepair-style validation, pixel diff, Block-Match, self-consistency, and the trace verifier and its ablations. The decisive outcome is a resolve-rate gain concentrated on multi-hunk instances, together with a near-zero flip rate for the trace verifier.

The third experiment is iterative repair. On Design2Code, Design2Code-HARD, and UI2Code-Real, we compare multi-edit rounds gated by the trace verifier against RubSE and against naive self-evolution, keeping RubSE's metrics. RubSE reports an average gain of 1.20 visual-fidelity points (on a 0–100 scale) over naive refinement, and trajectories that keep improving to round 5.7 on average versus 3.0. We would count it as a success if gated multi-edit rounds reach higher fidelity in fewer rounds without the late-round collapse. If they collapse anyway, that would show the verifier cannot replace RubSE's one-edit-per-round restriction.