TL;DR
ChartMimic is a new benchmark designed to evaluate how well Large Multimodal Models (LMMs) can translate complex scientific charts into functional Python code. By providing 4,800 human-curated chart-to-code pairs, it reveals a significant performance gap between proprietary models like GPT-4o and open-weight alternatives in mastering the intersection of visual logic and programming.
What Problem Does This Paper Address?
While Large Language Models (LLMs) have become remarkably good at generating code from text descriptions (think HumanEval or MBPP), real-world engineering and research often require "visual-to-code" transitions.
For example, a researcher might see a sophisticated plot in a paper and want to reproduce its style with their own data. Current benchmarks fail to capture this complexity. They are either text-only or use very simple images. Scientific charts are "information-intensive"—they convey nuanced semantic meanings through intricate visual logic, layouts, and color scales. To succeed at this, a model can't just recognize objects; it must harmonize visual understanding, logical reasoning, and precise code generation. The authors introduce ChartMimic to fill this critical gap.
Methods
The researchers developed a pipeline to evaluate LMMs on two distinct tasks:
- Direct Mimic: The model is given a chart and told to write the code (using Matplotlib) to reproduce it exactly.
- Customized Mimic: The model must maintain the aesthetic and layout of a reference chart but incorporate new data provided in a text instruction.
To evaluate the results beyond simple pixel-matching (which is often misleading), they proposed a multi-level evaluation metric:
- High-level (GPT-4o Score): Using GPT-4o as an "expert judge" to rate the similarity between the original and rendered charts across dimensions like layout, data trends, and style.
- Low-level (Code Tracer): A novel automated system that monitors the code execution to extract and compare specific elements: Text (labels/titles), Layout (subplots), Type (bar vs. scatter), and Color.
Datasets
The authors created a high-quality dataset of 4,800 (figure, instruction, code) triplets.
- Source: They scraped over 174,000 figures from arXiv papers published after February 2024 (to minimize the risk that models had already seen the data during training).
- Diversity: The set includes 22 chart categories (18 regular types like Heatmaps and Violins, and 4 advanced types like Plot-in-Plot) across 201 subcategories.
- Curation: Five domain experts filtered the figures for clarity and complexity, resulting in 600 "prototype" charts which were then manually coded by skilled Python developers and augmented to reach the final 4,800 count.
Key Insights and Ideas
- The "System 2" Advantage: The authors found that top-tier models like GPT-4o can significantly improve their performance through self-reflection. When the model is shown its own rendered output and asked to compare it to the original, it can often catch and fix its own mistakes—a hallmark of "System 2" reasoning.
- Open-Source vs. Proprietary Gap: There is a massive "performance wall" for open-weight models. While models like InternVL2-76B are catching up on general vision-language benchmarks, they struggle significantly with the precise coordination required for ChartMimic.
- Hallucination Types: Errors aren't random. Models frequently "hallucinate" by adding non-existent text, missing small but critical data points, or confusing similar chart types (like mistaking a box plot for a violin plot).
- Code vs. Vision: Correlation analysis showed that a model's performance on ChartMimic is more strongly tied to its foundational code generation ability than its general chart-understanding (QA) ability.
Key Results
The researchers benchmarked 17 models, and the results show that ChartMimic is a "hard" test:
- GPT-4o is the current state-of-the-art, achieving an overall score of 81.2 on Direct Mimic and 83.2 on Customized Mimic.
- InternVL2-Llama3-76B (the best open-weight model) lags behind with scores of 58.5 and 64.7, respectively.
- Execution Success: Many open-weight models struggle to even produce code that runs. While GPT-4o has a 93.2% execution success rate, several smaller models fall below 50%, highlighting a lack of robustness in following complex, visually-grounded instructions.
Limitations and Future Work
The authors acknowledge a few key areas for growth:
- Language Scope: The current benchmark focuses exclusively on Python and Matplotlib. Future versions could expand to JavaScript (D3.js) or R (ggplot2).
- Fine-grained Details: The current evaluation metric doesn't perfectly capture very small sub-icons or specific marker styles (like different types of star markers).
- Domain Specifics: While the charts come from various scientific fields, there may still be domain-specific visual languages (like specialized medical imaging plots) not yet fully represented.
The team has made their data and evaluation code available on GitHub, inviting the community to help close the gap between seeing a chart and being able to build it.
Summary updated