Introduction
Replicating a chart precisely from a reference image is a complex task that sits at the intersection of visual perception and code generation. It requires a model to interpret layout, color schemes, and typography while simultaneously generating syntactically correct code that preserves data relationships. While state-of-the-art Vision-Language Models (VLMs) like GPT-4o show promise, they often struggle with fine-grained details when prompted directly, leading to errors in color hex codes, axis intervals, or annotation placement.
To address these challenges, we introduce METAL (Multi-agEnT frAmework with vision Language models). METAL decomposes the monolithic generation task into an iterative loop of specialized agents, achieving significant performance gains and demonstrating predictable "test-time scaling" properties.
The METAL Framework
The core of METAL is a collaborative pipeline consisting of four specialized agents designed to handle different aspects of the chart generation process:
- Generation Agent ($\mathcal{A}$): This agent produces the initial Python (Matplotlib) code based on the provided reference image.
- Visual Critique Agent ($\mathcal{V}$): Acting as the system's "eyes," this agent compares the generated chart against the reference to identify visual discrepancies in layout, color, and structure.
- Code Critique Agent ($\mathcal{C}$): This agent reviews the underlying code for logic and syntax, translating visual feedback into actionable programming guidelines.
- Revision Agent ($\mathcal{R}$): The final agent integrates feedback from both critiques to refine and update the code.
A key component of the framework is the Multi-Criteria Verifier. This heuristic-based tool objectively assesses chart quality using EasyOCR for text matching, HSV histograms for color similarity, and SSIM for structural integrity. It serves as an automated "stop" signal, terminating the iteration once a quality threshold is met or the maximum computational budget is reached.
Experimental Evaluation
The framework was rigorously tested using ChartMIMIC, a benchmark of 1,000 human-curated triplets (image, instruction, code) derived from real-world scientific papers. The dataset covers 18 standard chart types and 4 advanced types, such as 3D surfaces and radar charts, across nearly 200 subcategories.
METAL consistently outperformed both open-source and closed-source baselines. Notably, it achieved a 5.2% improvement in F1 score over previous state-of-the-art methods. For open-source models like LLaMA 3.2-11B, the framework provided an even more dramatic boost of 11.33% compared to direct prompting.
Test-Time Scaling and Insights
A significant finding of this work is the observation of "test-time scaling" in multimodal tasks. Similar to scaling laws observed in large language model reasoning, METAL's performance improves predictably as more computational budget (measured in tokens or iterations) is allocated during inference.
Our analysis revealed several key insights:
- Modality-Tailored Critiques: Separating visual and code critiques prevents information loss and allows agents to focus on fine-grained details that a single-prompt approach might overlook.
- Agentic vs. Modular: True "agentic" behavior—where agents possess self-decision-making capabilities—outperforms simple fixed modular pipelines by approximately 4.5%.
Conclusion
METAL demonstrates that a multi-agent approach can significantly enhance the precision of VLM-based chart generation. By leveraging specialized agents and an objective verification loop, the system not only improves accuracy but also provides a pathway for scaling performance through increased inference-time computation. Future research will focus on reducing the associated inference costs and exploring the distillation of these multi-agent reasoning capabilities into more efficient single-model architectures.
Summary updated