Shanghai AI Lab's Visual-ERM Beats a 235B Model at Catching Vision-to-Code Errors
A new 8B multimodal reward model scores rendered outputs directly, boosting chart-to-code by 8.4 points and beating a 235B judge.
ProTakeaways
- Visual-ERM is a new 8B reward model that scores vision-to-code outputs in rendered image space
- Boosts Qwen3-VL-8B-Instruct by +8.4 on chart-to-code, +2.7 on tables, +4.1 on SVGs via GRPO
- Outperforms Qwen3-VL-235B-Instruct on the new VC-RewardBench of 1,335 discrepancy judgment instances
- Emits structured discrepancy annotations that double as inference-time reflection feedback for policies
- Trained on 340K image pairs with error taxonomies distilled from GPT-5-mini
- Weights and code are open on GitHub and Hugging Face
Reinforcement learning has become the go-to trick for pushing vision-language models past what supervised fine-tuning can squeeze out, but it only works if the reward signal actually measures what you care about. For vision-to-code tasks, where a model has to read a chart, table, or SVG and spit out code that renders back to the same picture, the reward signals people currently use are surprisingly bad. A new model called Visual-ERM, from Shanghai AI Laboratory and collaborators, tries to fix that by scoring outputs directly in the rendered image space with fine-grained, interpretable feedback, and it delivers meaningful gains across three separate parsing tasks.
The team released the paper, model weights on Hugging Face, and code on GitHub, along with a new benchmark specifically for judging image-to-image discrepancies on structured visuals.
Why current rewards break vision-to-code RL
Vision-to-code covers a family of practical parsing problems: turning a chart image into matplotlib code, a table screenshot into markdown, or an icon into SVG. These tasks require models to reconstruct structured visual inputs into executable or structured representations with high visual fidelity, but existing reward designs have major limitations: text-based rewards like edit distance or TEDS ignore important visual cues such as layout, alignment, spacing, and style, while vision embedding rewards like DINO similarity are often coarse-grained, semantically biased, and vulnerable to reward hacking.
The paper shows this concretely. A table-to-markdown output can hit TEDS = 0.92 while its rendered version has header hierarchy and numeric cell errors that any human would immediately flag. A chart prediction can score above 0.99 DINO similarity while getting the colorbar, bubble positions, and y-axis wrong. When you run RL against either signal, the training curve rises smoothly, but downstream chart-to-code and table-to-markdown scores stagnate or even regress below the supervised baseline. Classic reward hacking.

A generative judge that looks at the rendered pixels
Visual-ERM is a multimodal generative reward model built on Qwen3-VL-8B-Instruct. Instead of returning a scalar, it takes the reference image and the rendered prediction and emits a structured list of discrepancies with categories, severities, and location descriptions. That structure is what makes it useful in two ways at once: severities can be aggregated into a scalar reward for RL, and the natural-language critique can be fed back to the policy for reflection and revision at inference time.
The training pipeline has three stages:
- Image pair construction. The team creates flawed predictions two ways: high-capacity models perturb ground-truth code with a taxonomy of injected errors (systematic coverage), and weaker LVLMs generate predictions directly (realistic distribution). Every candidate is rendered and paired with the reference.
- Fine-grained annotation. A stronger teacher, GPT-5-mini, proposes discrepancies over each image pair, which are then filtered against the rendered output and ground-truth code. This yields roughly 340K training instances split across charts (104K), tables (125K), and SVGs (111K).
- Supervised fine-tuning. The 8B backbone is trained with a standard next-token objective to predict the structured discrepancy list conditioned on both images.
At deployment, the same model produces a discrepancy set with per-error severities that get summed and normalized within the batch, then clipped to [0,1] and combined with a render-success term that returns 1 only if the generated code actually executes. That total reward feeds a GRPO-based policy optimization loop.

The numbers
Trained on top of Qwen3-VL-8B-Instruct and used as the reward for GRPO, Visual-ERM improves the base model by +8.4 on chart-to-code, +2.7 on table-to-markdown, and +4.1 on SVG-to-code. On ChartMimic direct reproduction, the RL-tuned policy jumps from an overall 67.7 to 79.5, and applying the same recipe on top of the already-strong VinciCoder-8B-SFT policy still adds +10.3 points, suggesting the reward signal is useful even for highly optimized starting points.
The comparison against DINO-based rewards is where the argument gets sharp. On chart-to-code, DINO rewards give some gain but consistently lag Visual-ERM. On table-to-markdown, DINO rewards actively degrade performance because tables are dominated by precise text and layout that DINO's semantic-invariant features can't discriminate. TEDS-based rewards do better on tables but don't transfer to charts.
An 8B judge that beats a 235B one
To evaluate Visual-ERM itself rather than just its downstream effect, the authors built VisualCritic-RewardBench, a diagnostic suite with 1,335 curated instances covering 595 chart, 442 SVG, and 298 table cases. Each instance pairs a reference image with a corrupted counterpart plus fine-grained discrepancy annotations produced through multi-model consensus (GPT-5-mini, Gemini-2.5-Pro, Gemini-3-Pro) and expert review.
Visual-ERM at 8B posts an average F1_hard of 42.1 versus 29.5 for Qwen3-VL-235B-Instruct and 40.6 for Gemini-3-Flash. It effectively matches proprietary judges while being roughly 30x smaller than the open-source model it beats. The lesson the authors draw: fine-grained discrepancy detection comes from reward-model specialization, not from scale alone, and a task-agnostic unified reward model that generalizes across multiple vision-to-code tasks is achievable.
Reflection at inference time
Because Visual-ERM emits localized natural-language critiques and not just a scalar, the same model doubles as a critic for test-time scaling. The policy generates code, renders it, sends both images through Visual-ERM, then rewrites the code conditioned on the previous draft and the returned discrepancy list. Three rounds hit the sweet spot; four rounds show diminishing returns.
On top of the RL-tuned policy, three reflection rounds add another +3.1 average points on ChartMimic. On the untuned base model, reflection alone adds +8.0, essentially matching what RL gave and confirming that the interpretable feedback carries most of the value. Self-reflection without Visual-ERM (the policy critiquing its own output) actually degrades performance, which is a nice negative control.
When to use it
Visual-ERM is a good fit if you are training or refining vision-to-code models and need a supervisor that catches element-level errors. Practical use cases include:
- Chart parsing pipelines that regenerate matplotlib or plotting code from figure screenshots
- Document intelligence stacks that convert table images to markdown or HTML
- Icon and vector graphics reconstruction from raster inputs
- Any RL loop where DINO or CLIP similarity currently plateaus due to reward hacking
- Inference-time refinement loops where a critic can localize what to fix
Some caveats. The reward model was trained specifically on charts, tables, and SVGs, so extending to UI screenshots or math diagrams is plausible but unproven. Gains from reflection are bounded by the policy's editing ability, since test-time scaling doesn't update weights. And the training labels were distilled from GPT-5-mini, so any residual annotator bias propagates into the reward, though the authors argue the downstream RL gains on independent benchmarks bound how much this matters in practice.
The bigger point is methodological. Visual quality in structured outputs isn't a semantic-similarity problem, and it isn't a text-matching problem either. Treating the reward itself as a specialized multimodal model trained on rendered discrepancies turns out to be both necessary and, apparently, sufficient for making RL actually work on this class of tasks.