Breaking the SFT Plateau: Multimodal Structured Reinforcement Learning for Chart-to-Code Generation
While reinforcement learning (RL) has proven highly effective for general reasoning in vision-language models, its application to tasks requiring deep understanding of information-rich images and structured output generation remains underexplored. Chart-to-code generation exemplifies this challenge, demanding complex reasoning over visual charts to produce structured code. Supervised finetuning (SFT) alone is often insufficient, highlighting the need for effective RL strategies tailored to structured outputs. In this paper, we systematically investigate the performance plateau of SFT through large-scale experiments and propose Multimodal Structured Reinforcement Learning (MSRL) for chart-to-code generation. We construct the largest training corpus to date, with 3 million chart-code pairs curated from real-world tables in arXiv papers, addressing the limitations of previous synthetic datasets. Despite achieving state-of-the-art performance, our experiments show that simply increasing SFT data eventually leads to diminishing improvements. To break this plateau, MSRL employs a multi-granularity reward system that integrates both textual and visual feedback. At the textual level, rule-based rewards validate fine-grained code details, while at the visual level, a model-based reward assesses the structural similarity between rendered code and ground-truth charts. We implement a two-stage curriculum training strategy, first optimizing the model with textual rewards and then incorporating visual signals for further enhancement. Experimental results demonstrate that MSRL substantially breaks the SFT plateau, improving high-level metrics by 6.2% and 9.9% on ChartMimic and ReachQA benchmarks, respectively. Notably, our method outperforms all existing approaches in the chart domain and achieves competitive results with advanced closed-source models.
Introduction. Large language models (LLMs) have demonstrated impressive reasoning capabilities on complex textual problems, including code generation and mathematical problem-solving OpenAI (2025b); Guo et al. (2025). Pivotal to this success is the implementation of reinforcement learning (RL) to optimize the capacities of LLM to generate step-by-step reasoning Wei et al. (2022) and verify final answers Shao et al. (2024). While multimodal large language models (MLLMs) have achieved impressive performance on established visual reasoning tasks like visual question answering Zhang et al. (2024a); Huang et al. (2025), their core reasoning capabilities remain limited, especially when tasks require processing information-dense images like charts Xu et al. (2024); Chen et al. (2025a), and generating structured outputs like code Xia et al. (2024); Zhao et al. (2025b).
Among these challenges, chart-to-code generation Yang et al. (2024a); Zhang et al. (2024c) stands out as a task of both high complexity and significant practical value. Charts are widely used to communicate scientific findings, business insights, and statistical data, yet their information is often locked in visual formats that are difficult for automated systems to interpret or repurpose. Enabling MLLMs to accurately convert charts into executable code not only advances their visual understanding and structured reasoning capabilities, but also opens up impactful applications, such as assisting researchers in automating the reproduction of scientific visualizations. Although previous works have attempted to solve this task by using methods like Supervised Fine-Tuning (SFT) Zhang et al. (2024b); Zhao et al. (2025b) or Direct Preference Optimization (DPO) Rafailov et al. (2023); Zhang et al. (2025) on synthetic data, their performance remains limited due to the simplistic patterns of the corpus and ineffective generalization strategies. Therefore, a promising direction is to leverage more realistic data and robust strategies to enhance model performance.
In this work, we first systematically investigate the SFT performance plateau through experiments at various data scales. To enable this analysis, we construct the largest training corpus to date for chart-to-code generation, covering 24 distinct chart types and comprising 3 million chart-code pairs. Our two-stage data pipeline curates high-quality tables from arXiv papers and then utilizes LLMs to generate diverse and complex plot codes, ensuring realistic distributions and avoiding monotonous trends. Unlike prior works Ni et al. (2025); Chen et al. (2025b) that apply RL directly after SFT, we establish saturated SFT baselines to isolate the true effectiveness of our proposed multimodal structured reinforcement learning (MSRL) strategy. Through experiments with varying SFT data scales, we demonstrate that simply increasing the volume of SFT data leads to a performance plateau that cannot be overcome by data quantity alone. To break through this plateau, we propose the MSRL training strategy, which incorporates multi-granularity reward functions from both textual and visual aspects. For textual rewards, we standardize code formats in the training corpus and design a comprehensive reward function that verifies code correctness from five key perspectives. Recognizing that text-based rewards alone may overlook overall chart structure, we introduce a visual reward mechanism: generated code is rendered into images and an MLLM evaluates their similarity to the original input chart. By jointly leveraging these multi-granularity rewards, MSRL optimizes both global chart context and fine-grained code details. We evaluate models on various chart-to-code benchmarks Yang et al. (2024a); He et al. (2024). The results demonstrate that it establishes a new state-of-the-art, as it outperforms all previous open-source models and rivals advanced proprietary MLLMs. In summary, the main contributions of this work are as follows:
Related work. Chart understanding is a crucial research area encompassing both low-level tasks, such as data extraction Liu et al. (2023), and high-level tasks like question answering Masry et al. (2022) and summarization Kantharaj et al. (2022). Recent work has focused on training MLLMs on extensive, chart-specific datasets to enhance their understanding capabilities Xia et al. (2024); Zhang et al. (2024b); Xia et al. (2023), leading to superior performance across various chart-related tasks. For example, ChartMoE Xu et al. (2024) proposes a mixture-of-experts (MoE) structure for multi-task pretraining. More recently, leveraging reinforcement learning Chen et al. (2025a); Masry et al. (2025); Rodriguez et al. (2025b) to enhance reasoning capacities has garnered significant interest. Both Chart-R1 and BigCharts-R1 optimize MLLMs using Chain-of-Thought (CoT) Wei et al. (2022) reasoning data and reinforcement learning with verified rewards (RLVR) Shao et al. (2024).
The success of large reasoning models (LRMs) like DeepSeek-R1 Guo et al. (2025) spurs significant research into enhancing LLM reasoning through reinforcement learning with rule-based rewards Shao et al. (2024). This paradigm extends to the vision-language domain, where numerous works aim to improve the long-chain reasoning capabilities of MLLMs Shen et al. (2025); Wang et al. (2025b). Following this trend, initial efforts such as Vision-R1 Huang et al. (2025) and R1- OneVision Yang et al. (2025b) adapt the Group Relative Policy Optimization (GRPO) algorithm with multimodal reasoning data to enable long-form reasoning in VLMs. Subsequent works, including MMEureka Meng et al. (2025) and R1-Zero Liu et al. (2025), further advance this area by introducing improved reinforcement learning strategies for visual long-term reasoning. Recently, approaches like Point-RFT Ni et al. (2025) utilize task-specific thinking frameworks to enhance reasoning capabilities further.
In the rapidly advancing research area of multimodal code generation, foundational work has focused on establishing benchmarks to assess the capabilities of MLLMs. These benchmarks evaluate performance on tasks such as generating execution code for solving visual problems Li et al. (2024); Wang et al. (2025a); Rodriguez et al. (2025a; 2024); Yang et al. (2024b) and HTML code from webpage screenshots Si et al. (2024); Yun et al. (2024); Xiao et al. (2024); Awal et al. (2025). Among these emerging tasks, chart-to-code generation has attracted significant interest due to the complexity of its visual inputs. This task challenges an MLLM to generate plotting code that accurately reproduces the chart image. Recently, several benchmarks have been proposed to evaluate MLLMs in this context, assessing a range of capabilities.
Method. While several chart-to-code generation datasets have been proposed, they are generally constrained by a reliance on purely synthetic data and limited scale, resulting in charts that exhibit simplistic trends and lack diversity. To overcome these challenges, we construct our dataset by crawling realworld tables from arXiv papers and then leveraging LLMs to generate the corresponding plotting code. To ensure separation from the ChartMimic benchmark, we exclusively use papers published in 2023 and earlier as our corpus. We ensure data diversity and quality through several strategies, such as using high-quality seed code and filtering out non-executable code.
Through this process, we construct the largest training corpus to date, comprising 3 million chartcode pairs, to investigate the performance limits of SFT. However, previous research Chen et al.
(2025a); Huang et al. (2025) shows that separating the SFT and RL training corpora prevents overfitting to the SFT data format and enhances the exploration capacity of RL. To curate a high-quality dataset for RL, we begin with a candidate corpus of 130 thousand samples from the overall training corpus. These candidate data samples are then subjected to a two-stage filtering strategy. The first filtering stage focuses on the code content, filtering based on chart and data type to ensure code diversity and that the output code is suitable for data extraction. Specifically, the chart types are filtered according to plot functions. To handle complex charts containing multiple chart types, we employ a tree-structured parsing method to identify each type present progressively. The data values are filtered according to the data definition format, retaining only data structured as one-dimensional arrays and non-nested dictionaries to facilitate extraction during the RL stage. This step narrows the candidate corpus to 45 thousand samples. The second stage addresses visual quality, employing GPT-4.1-mini OpenAI (2025a) as a visual LLM judge to filter for high-fidelity chart images. To mitigate potential bias from the MLLM judger, we manually inspect 100 samples that are assigned a score of 0 by the model, and observe over 90% consistency with human judgment. This process yields the final RL training corpus of 33 thousand high-quality samples. The remaining samples are utilized for SFT. The comparisons of our dataset with relevant chart-to-code datasets are listed in Table 1. Our dataset features a completely realistic data source, more challenging multi-chart content, and richer visual diversity enabled by more API types.
Firstly, we perform SFT on Qwen2.5-VL as the base model using our generated chart-to-code dataset. To explore the effectiveness of data scaling and identify the SFT plateau, we fine-tune our model on six distinct training corpus sizes, created by partitioning our main dataset into subsets of 200k, 400k, 800k, 1.6M, 2M and 2.8M samples. The model is trained by minimizing the standard autoregressive objective, which is the negative log-likelihood of the target sequence. As Although SFT can significantly enhance the chart-to-code capabilities of MLLMs, our experiments reveal that this approach ultimately reaches a performance plateau, likely due to the limitation that SFT restricts the model’s capacity to restore detailed information. This limitation stems from the core drawback of the SFT objective that it treats every token in the target sequence with uniform importance. Therefore, SFT is ineffective in optimizing plotting code generation, as the plotting code comprises largely of boilerplate snippets such as plt.plot, with critical information like specific data values or styling parameters appearing infrequently. Consequently, employing RL with a reward function designed to prioritize the accuracy of such critical content presents a promising approach for enhancing code generation capacity. To this end, we propose a two-stage RL training strategy utilizing multi-granularity reward functions that combine both textual and visual feedback.
Conclusion. In this work, we investigate the performance plateau of Supervised Fine-Tuning (SFT) in chart-tocode generation and propose a Multimodal Structured Reinforcement Learning (MSRL) strategy to overcome it. We begin by constructing a 3M-pair training corpus from real-world tables to systematically demonstrate that merely increasing SFT data leads to diminishing returns. To address this, we introduce the MSRL, which optimizes the saturated SFT model using a two-stage training process guided by a multi-granularity reward function that assesses both textual and visual correctness. Our approach achieves new state-of-the-art performance on standard benchmarks, surpassing all open-source models and rivaling powerful proprietary ones. We make significant contributions to the field, including the curation of a large-scale dataset for a definitive empirical analysis of the SFT performance bottleneck, and the development of the MSRL framework.
Lines of inquiry this paper opens 24
Research framings built by reading the notes related to this paper — the questions it feeds into.
Can visual rendering-based rewards effectively improve code and layout quality?- How does rendering and measuring beat vision-language models for slide assessment?
- Can bounding-box signals replace image encoders for visual output evaluation?
- Why do vision-based rewards for web generation incur substantial computational overhead?
- Can matching UI elements by text similarity and position handle visually equivalent but structurally different layouts?
- What performance gains does ALISA achieve over prior WebUI-to-Code training methods?
- Does the rendering reward generalize beyond chart editing to other code generation tasks?
- How does the rendering reward weight code executability against visual fidelity failures?
- What layout and text metrics does ChartEditor use to measure visual fidelity?
- Can Chamfer Distance and code validity capture whether designs match an engineer's intent?
- Does format reward contribute independently to CAD-Coder's final performance?
- What signals matter more for UI evaluation: rendered visuals or symbolic descriptions?
- Do quality ceiling effects appear in other visual domains beyond game UI?
- Can render-and-judge mechanisms generalize beyond chart-to-code to other executable outputs?
- Can professional design workflows integrate vector generation from pretrained vision-language models?
- Which reward component matters most: pixel reconstruction, semantic similarity, or code efficiency?
- How does visual-similarity reward resolve semantic equivalence problems in code?
- Can visual rendering rewards work for tasks beyond code reconstruction?
- What makes code-matching training brittle compared to image-matching training?
- What limits SlideCoder to single-slide generation from reference images?
- How does render-and-compare training differ from expert-judged rewards in visual tasks?
- Do vision-language models learn design taste differently than structure recognition?
- Has the MLLM visual critic been validated against human judgments of front-end quality?
- How does color-gradient segmentation compare to learned visual decomposition for slides?