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:
- 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.
- 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.
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).
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).
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