Visual-ERM: Reward Modeling for Visual Equivalence

Ziyu Liu, Shengyuan Ding, Xinyu Fang, Xuanlang Dai, Penghui Yang, Jianze Liang, Jiaqi Wang, Kai Chen, Dahua Lin, Yuhang Zang

TL;DR

Reinforcement learning (RL) for vision-to-code tasks—such as converting charts, tables, or SVGs into executable code—frequently fails due to reward signals that are easily exploited or blind to visual layout. This paper introduces Visual-ERM, a multimodal generative reward model that evaluates code quality by directly analyzing its rendered visual output to provide fine-grained, interpretable, and task-agnostic feedback. Integrating Visual-ERM into RL pipelines yields substantial performance gains across multiple structured visual domains while enabling effective test-time self-correction.

What Problem Does This Paper Address?

Vision-to-code models aim to reconstruct structured visual inputs into executable code or markup. While supervised fine-tuning (SFT) has driven recent progress, scaling these models further requires Reinforcement Learning. However, current RL frameworks suffer from a major bottleneck: unreliable reward signals.

As shown in Figure 1, existing approaches fall into two flawed categories:

  1. Text-based metrics (e.g., TEDS, edit distance) compare code strings directly but are completely blind to rendering errors like layout misalignments or font overlapping.
  2. Vision-encoder metrics (e.g., DINO, CLIP) look at the image but are trained for semantic invariance. They often tolerate small spatial shifts or text changes that completely alter a chart's data meaning.
Figure 1: Overview of vision-to-code reward modeling and Visual-ERM. Top: vision-to-code parses a structured visual input (chart, table, or SVG) into code or markup, which is rendered back to an image so that quality can be judged in the visual space. Bottom: we compare reward signals along four properties: visual, fine-grained, interpretable, and task-agnostic. Text-based rewards (e.g., TEDS, edit distance) ignore visual cues; vision-encoder similarities (e.g., DINO [34], CLIP [29]) capture visual content but remain coarse and opaque. Visual-ERM combines all four properties, providing a reliable supervisor across vision-to-code tasks.

This mismatch leads to reward hacking, where a policy model learns to maximize the reward score without actually improving the visual fidelity of the generated output (see Figure 2).

Figure 2: Analysis of existing rewards and downstream impact. Left: a text-based reward (TEDS) and a vision-based reward (DINO) assign near-perfect scores to predictions that Visual-ERM identifies as visually wrong. Right: (a) RL training curves where text- and vision-based rewards plateau via reward hacking while Visual-ERM keeps improving; (b, c) downstream gains on Chart-to-Code and Table-to-Markdown.

Methods

The authors propose the Visual Equivalence Reward Model (Visual-ERM), a multimodal generative reward model built on top of Qwen3-VL-8B-Instruct. Instead of outputting an opaque scalar score, Visual-ERM acts as a visual judge. It takes the original reference image and the rendered prediction image, then generates a structured JSON list detailing specific errors, their locations, descriptions, and severities (Minor, Moderate, Critical).

Figure 3: (a) Training data and model training. From paired ground-truth and rendered images, we obtain fine- grained discrepancy annotations (category, severity, location, description) and fine-tune a base LVLM into Visual-ERM. (b) Deployment. Visual-ERM produces unified judgments across chart, SVG, and table tasks, yielding scalar rewards for RL and natural-language feedback for test-time scaling.

1. RL Reward Design

For RL training via Group Relative Policy Optimization (GRPO), these severities are aggregated into a bounded scalar reward ($r_{\text{verm}}$) and combined with a render-success reward ($r_{\text{rsr}}$) to penalize unrenderable code.

2. Test-Time Scaling

Because Visual-ERM provides natural language critiques rather than just a number, it can be inserted directly into the inference loop. The policy model can read Visual-ERM's feedback and iteratively revise its own code draft across multiple reflection rounds without updating any weights.

Datasets

  • Training Data: Visual-ERM was trained on a large-scale corpus spanning three domains: Chart-to-Code (104K), Table-to-Markdown (125K), and SVG-to-Code (111K). The image pairs were generated via targeted edits (injecting specific errors) and natural inferences from weaker models, annotated by GPT-5-mini, and filtered for consistency.
  • VC-RewardBench (VisualCritic-RewardBench): The authors introduced a new diagnostic benchmark consisting of 1,335 high-quality annotated instances (595 charts, 442 SVGs, 298 tables) to rigorously evaluate a model's ability to judge fine-grained image-to-image discrepancies.

Key Insights and Ideas

  • Visual Equivalence > Code Matching: Code can look entirely different textually but render identically, or look nearly identical textually but render completely wrong. Evaluating in the rendered visual space is the only way to ensure true equivalence.
  • The Danger of Semantic Invariance: Standard vision foundation models are designed to ignore small shifts (e.g., a cat is still a cat if shifted a few pixels). In vision-to-code, a small shift completely changes data values or table columns. Specialized reward models are required to combat this.
  • Interpretability Prevents Hacking: Forcing the reward model to generate structured, text-based error descriptions grounds its judgment, preventing the policy model from finding mathematical shortcuts to exploit an opaque scalar score.

Key Results

  • RL Performance Boost: Integrating Visual-ERM into GRPO boosted the Qwen3-VL-8B-Instruct baseline by +8.4 points on chart-to-code, +2.7 on table-to-markdown, and +4.1 on SVG parsing.
  • Outperforming Giant Models: On the new VC-RewardBench, the 8B Visual-ERM decisively outperformed the much larger Qwen3-VL-235B-Instruct and approached leading closed-source models in discrepancy judgment.
  • Test-Time Scaling Gains: Using Visual-ERM for a 3-round reflection loop at inference time provided an additional +8.0 average point boost over the base model.

Limitations and Future Work

  • Policy-Bounded Revisions: The gains from test-time scaling are inherently bounded by the policy model's editing capabilities; if the base model cannot understand how to act on the critique, the loop fails to improve the output.
  • Teacher Dependency: The training data relies heavily on distillation from a proprietary teacher model (GPT-5-mini), introducing potential dependency on closed-source ecosystems for data curation.
  • Future Directions: The authors suggest extending Visual-ERM to broader vision-to-code domains like UI-to-code reconstruction or mathematical diagramming, where the underlying principles of visual equivalence still apply.

Summary updated

BibTeX
@inproceedings{liu2026visual,
  author = {Ziyu Liu and Shengyuan Ding and Xinyu Fang and Xuanlang Dai and Penghui Yang and Jianze Liang and Jiaqi Wang and Kai Chen and Dahua Lin and Yuhang Zang},
  title = {{Visual-ERM: Reward Modeling for Visual Equivalence}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=eAUzimU47c},
}
Figure