TL;DR
Chart2Code is a new hierarchical benchmark designed to stress-test Large Multimodal Models (LMMs) on their ability to generate plotting code from visual and textual prompts. It moves beyond simple reproduction, challenging models with complex editing tasks and the transformation of massive, raw data tables into faithful visualizations.
What Problem Does This Paper Address?
While Large Multimodal Models like GPT-4o have shown impressive results on existing chart-to-code benchmarks, these evaluations are reaching a point of "performance saturation." Most current benchmarks focus on simple chart reproduction—essentially asking a model to look at a picture and write the code to recreate it.
However, real-world users rarely stop at reproduction. They need to interactively edit charts (e.g., "change this to a bar chart and add a trend line") or distill massive spreadsheets into a single, interpretable plot. The authors argue that there is a significant gap between a model's ability to write "executable code" and its ability to produce "visually faithful" results in these more demanding, interactive scenarios.
Methods
The researchers developed a hierarchical task design consisting of three progressively difficult levels:
- Level 1 (Chart Reproduction): Models mimic a reference figure. This tests basic visual perception and code reconstruction.
- Level 2 (Chart Editing): Models must modify a reference chart based on instructions. This requires reasoning—for example, calculating correlation coefficients or splitting charts by data category.
- Level 3 (Long-Table to Chart): The most difficult tier. Models are given long, unprocessed data tables (like Excel files) and must perform information retrieval and mathematical calculation before generating the plotting code.
To evaluate these tasks, the authors moved beyond simple "does the code run?" metrics. They introduced a multi-level protocol:
- Executability: Does the generated code actually produce an image?
- Code-Level Evaluation: A mix of rule-based matching (Base-Score) and LLM-based static analysis (LLM-Score) to check if the "intent" of the code matches the ground truth.
- Chart-Level Evaluation (LMM-Score): Using a state-of-the-art LMM as a judge to compare the visual similarity between the model's rendered chart and the target image.
Datasets
The Chart2Code benchmark contains 2,186 tasks covering 22 different chart families (radar, heatmap, scatter, etc.). The data was curated from:
- Academic Literature: Over 5,000 papers from arXiv to ensure high-quality, information-dense charts.
- Programming Communities: Examples from Matplotlib, Seaborn, and Plotly documentation.
- Web-Sourced Tables: 71 diverse Excel files used for the Level 3 long-context tasks.
Key Insights and Ideas
- Execution $\neq$ Fidelity: A major "aha moment" is the discovery that models often generate code that runs perfectly but produces a chart that is visually incorrect. As shown in Figure 3, models might score high on code structure (LLM-score) but collapse when evaluated on the actual pixels (LMM-score).
- The Reasoning Bottleneck: As tasks move from Level 1 to Level 2, the primary failure mode shifts from "perception" to "reasoning." Models struggle to maintain the original style while applying complex new instructions.
- The "Lost-in-the-Middle" Phenomenon: In Level 3, models frequently fail because the sheer volume of raw tabular data exhausts their context window, leading to incomplete data extraction and "hallucinated" values.
- "Thinking" Helps Logic, Not Pixels: Models with internal reasoning chains (like Qwen3-VL-Thinking) showed improved executability and procedural compliance, but they didn't necessarily produce more visually accurate charts, suggesting that "pixel-level exactness" requires different architectural mechanisms.
Key Results
The authors benchmarked 29 SOTA models, including proprietary giants like GPT-5.2 and Gemini-3-Pro, alongside open-source models like InternVL3.5.
- Proprietary Dominance: Top-tier proprietary models have largely "solved" simple reproduction (Level 1), with execution rates near 100%.
- The Level 3 Wall: Performance drops off a cliff at Level 3. Even the best models saw their execution rates plummet to between 10% and 46%.
- Quantitative Gap: For Level 2 editing tasks, GPT-5.2 averaged a respectable 72.21 on code-based evaluation but only 33.41 on chart-quality assessment.
- Open-Source Struggle: While larger open-source backbones are closing the execution gap, their visual fidelity scores remain consistently low (often below 0.5).
Limitations and Future Work
The authors acknowledge two primary limitations:
- Linguistic Bias: The current benchmark is entirely in English. Future iterations will need to include multilingual queries and support for non-Latin text rendering (like CJK languages).
- Judge Bias: Relying on LLMs to judge other models can introduce biases. The authors suggest that developing more objective, reference-free visual metrics is a critical next step.
Ultimately, Chart2Code reveals that while AI is getting better at "writing code," we are still far from having a reliable, end-to-end "AI Data Scientist" that can faithfully visualize complex data.
Summary updated