TL;DR
Vision2Code introduces a comprehensive, reference-code-free benchmark to evaluate how well vision-language models (VLMs) can translate images into executable code. By utilizing a VLM-based evaluator equipped with domain-specific rubrics and deterministic guardrails, it effectively measures reconstruction quality across 15 diverse datasets without requiring ground-truth source code. The authors also demonstrate that filtering a model's own generations with this evaluator creates a high-quality training signal, significantly boosting image-to-code performance.
What Problem Does This Paper Address?
When a VLM generates code to recreate an image (like a chart or a diagram), the output is highly valuable because it is structured, editable, and reusable. However, evaluating this "image-to-code" capability is notoriously difficult.
Existing benchmarks suffer from three major flaws:
- Narrow Scope: They focus almost exclusively on single domains like web UI screenshots or standard data charts.
- Reference Code Dependency: They require paired, ground-truth executable code to evaluate the model's output, which limits testing to synthetic or highly curated datasets.
- Weak Evaluation Metrics: They rely on generic pixel-level matching (like MSE) or embedding similarities (like CLIP), which easily miss critical, domain-specific semantic errors—such as a flipped axis on a plot or an incorrect bond in a chemical structure.
Vision2Code addresses these gaps by providing a multi-domain, reference-code-free evaluation framework that judges models purely on the rendered output of their generated code.
Methods
The core innovation of Vision2Code is its domain-aware evaluation pipeline. Instead of comparing code strings, the framework executes the model's generated Python code (primarily using Matplotlib and NumPy) to render an image.
A powerful VLM rater (Qwen3.5-122B) then evaluates this rendered image against the original source image using two key mechanisms:
- Dataset-Specific Rubrics: The rater scores four distinct, weighted categories tailored to the specific domain (e.g., topology for graphs, coordinate precision for geometry).
- Deterministic Guardrails (Caps): To prevent the VLM from being fooled by superficial visual similarity, hard code-level caps are applied. If a model makes a severe semantic error (like an incorrect circuit direction or a flattened 3D scene), its final score is automatically restricted.
Additionally, the authors introduce an evaluator-guided self-training pipeline. They pass images through a two-stage generation process: a model generates code for an image, and then attempts to re-encode its own rendered output. By isolating the "sweet spot"—instances where the model successfully recreates the source once but fails to do so stably a second time—they extract a high-quality fine-tuning dataset.
Datasets
The Vision2Code benchmark aggregates 2,169 test examples (with a 539-sample test-mini subset for lower-cost evaluation) curated from 15 distinct public datasets.
These datasets are harmonized into a unified schema spanning six core visual domains:
- Charts & Plots: ChartQA, DVQA, FigureQA, Matplotlib
- Geometry: Geoperception, GEOQA_8K_R1V, Geometry3K, OlympiadBench
- Graphs: Graph-Algorithms, GraphVQA-Swift
- Science: ChemVQA-2K, EEE-Bench (circuits), Physics
- Documents: DocVQA
- Spatial Scenes: SpatialVLM-QA
Key Insights and Ideas
- Performance is Heavily Domain-Dependent: State-of-the-art models excel at regular charts and graphs but struggle immensely with dense document layouts, chemical structures, and 3D spatial relations. High average scores can mask complete failures in specialized domains.
- Reasoning Helps Structure, Not Grounding: Introducing test-time reasoning (e.g., in models like GPT-5.4 Mini or Kimi-K2.5) alters the failure profile—significantly reducing API syntax errors and improving code organization—but it does not inherently fix a model's inability to perceive precise 3D depth or domain-specific symbols.
- Execution Success $\neq$ Visual Fidelity: Code execution diagnostics must be decoupled from semantic evaluation. A model can achieve near-perfect code execution rates while rendering completely inaccurate visual content.
Key Results
- Superior Human Alignment: The dataset-specific rubric achieved a Pearson correlation of 0.723 and a Spearman correlation of 0.703 against human judgments, substantially outperforming generic rubrics (0.626 / 0.633) and image embedding baselines (0.407 / 0.498).
- Model Leaderboard: Proprietary models led the pack, with GPT-5.4 Mini (with reasoning) scoring the highest overall at 4.06/5.0, closely followed by base GPT-5.4 at 4.05. Kimi-K2.5+R was the strongest open-weight model at 3.23. However, all models performed poorly on 3D spatial scenes (the best score was just 2.42).
- Self-Training Breakthrough: By fine-tuning the lightweight Qwen3.5-9B model on the rater-filtered "self-drop" dataset, its performance on
test-miniimproved from 1.60 to 1.86 without ever exposing it to paired ground-truth source code.
Limitations and Future Work
The authors note that the benchmark scores are inherently tied to the chosen tool stack (Python with Matplotlib/NumPy); a model's score reflects both its visual understanding and its mastery of these specific libraries. Furthermore, while the VLM rater aligns well with humans, it can still occasionally overlook subtle errors in highly dense text documents or complex circuit topologies.
Future work includes expanding the evaluation framework to non-Python toolchains—such as standalone LaTeX or structured drawing formats like Excalidraw—to create a truly tool-agnostic image-to-code ecosystem.
Summary updated