Simple Test-Time Refinement for Plot-to-Code Generation via Visual-Code Diagnostics
Peiming Guo, Jinpeng Huang, Yangbin Sun, GaoXiong Cao, Ensheng Shi, Yuchi Ma, Yu Zhang, Meishan Zhang, Baotian Hu, Min Zhang
NeurIPS 2026
Abstract. Plot-to-code generation has been greatly advanced by recent multimodal large language models (MLLMs). However, existing studies mainly focus on one-pass generation or iterative sampling guided by verifier-based filtering, which does not align with the typical human programming workflow of generate first, then iteratively error-location and fix. This naturally motivates a test-time refinement paradigm for plot-to-code generation.In this work, we present the first study on plot-to-code generation via iterative test-time refinement. We propose a Visual-Code Diagnostics framework that enables refinement through visual feedback from source code. Specifically, we first categorize generation errors into four coarse-grained types, and then train lightweight discriminators to recognize and localize these errors based on the rendered visual outputs and corresponding code. Unlike traditional compiler- or debugger-based verification, our approach performs iterative refinement guided by one diagnostics system, enabling more effective semantic and visual correction during test time. Extensive experiments demonstrate that our method consistently improves generation quality across diverse generators and significantly outperforms strong test-time scaling baselines.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 4 reviews · OpenReview
Updated 25 Nov 2026, 03:49 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
This paper focuses on plot-to-code generation via iterative test-time refinement. The authors train lightweight discriminators (2B visual-code diagnostic verifier) that classifies visual discrepancies into four error types, localizes suspicious code regions via TODO comments, and guides iterative patch-based refinement.
All reviewers agree the problem is practical and the approach is well-motivated. Reviewer RmuF finds the idea of using a verifier to identify regions "similar to how humans debug code"; Reviewer xL4t calls the motivation "clear and well-grounded"; Reviewer qdWh notes the method "targets a concrete weakness of current plot-to-code systems." The Table 5 ablation showing the trained 2B verifier outperforms untrained 32B models is highlighted by multiple reviewers as convincing evidence that gains come from training rather than scale.
However, the four reviewers raise the following concerns:
Generalization failure on specialized generators. All reviewers flag that the method degrades ChartMaster-7B performance. Reviewer xL4t raises the deeper question of whether "as generators become more capable...the diagnostic signal may become less reliable or even harmful." Reviewer qdWh asks whether the issue is "inaccurate diagnostics, bad patch merging, or insufficient code-editing ability." A failure analysis with error-type breakdown would clarify applicability boundaries and, if convincing, would shift assessment significantly.
Synthetic training vs. real errors. Reviewers qdWh and RmuF both note the verifier is trained entirely on clean single-type GPT-4o mutations. Reviewer qdWh observes the paper "does not show whether these synthetic errors match real generation errors well enough, especially when multiple error types occur together." An evaluation of diagnostic accuracy on actual model outputs would substantially strengthen the empirical case.
Fairness of comparisons. Reviewer RmuF notes that baselines are zero-shot while the proposed method benefits from 12K in-domain examples, making it "hard to know whether the gains come from the proposed diagnostic refinement idea, or simply from giving the method extra in-domain training." This asymmetry makes it difficult to attribute gains specifically to the diagnostic formulation rather than to in-domain supervision.
Incomplete experimental details. Reviewer qdWh asks for exact inference budgets for all methods. The token-efficiency claim also needs clarification as per Reviewer RmuF.
Overall, I find this submission to be a technically solid paper on a practical problem with clear efficiency gains on general-purpose generators. The rebuttal closes the main empirical gaps raised above through additional experiments and addressed the concerns. I recommend acceptance as this provides a useful direction for efficient test-time refinement in multimodal code generation.
Final justification
Final justification is reflected in the updated meta review.
- Final justification
- Final justification is reflected in the updated meta review.
Read meta-review
Meta-review
This paper focuses on plot-to-code generation via iterative test-time refinement. The authors train lightweight discriminators (2B visual-code diagnostic verifier) that classifies visual discrepancies into four error types, localizes suspicious code regions via TODO comments, and guides iterative patch-based refinement.
All reviewers agree the problem is practical and the approach is well-motivated. Reviewer RmuF finds the idea of using a verifier to identify regions "similar to how humans debug code"; Reviewer xL4t calls the motivation "clear and well-grounded"; Reviewer qdWh notes the method "targets a concrete weakness of current plot-to-code systems." The Table 5 ablation showing the trained 2B verifier outperforms untrained 32B models is highlighted by multiple reviewers as convincing evidence that gains come from training rather than scale.
However, the four reviewers raise the following concerns:
Generalization failure on specialized generators. All reviewers flag that the method degrades ChartMaster-7B performance. Reviewer xL4t raises the deeper question of whether "as generators become more capable...the diagnostic signal may become less reliable or even harmful." Reviewer qdWh asks whether the issue is "inaccurate diagnostics, bad patch merging, or insufficient code-editing ability." A failure analysis with error-type breakdown would clarify applicability boundaries and, if convincing, would shift assessment significantly.
Synthetic training vs. real errors. Reviewers qdWh and RmuF both note the verifier is trained entirely on clean single-type GPT-4o mutations. Reviewer qdWh observes the paper "does not show whether these synthetic errors match real generation errors well enough, especially when multiple error types occur together." An evaluation of diagnostic accuracy on actual model outputs would substantially strengthen the empirical case.
Fairness of comparisons. Reviewer RmuF notes that baselines are zero-shot while the proposed method benefits from 12K in-domain examples, making it "hard to know whether the gains come from the proposed diagnostic refinement idea, or simply from giving the method extra in-domain training." This asymmetry makes it difficult to attribute gains specifically to the diagnostic formulation rather than to in-domain supervision.
Incomplete experimental details. Reviewer qdWh asks for exact inference budgets for all methods. The token-efficiency claim also needs clarification as per Reviewer RmuF.
Overall, I find this submission to be a technically solid paper on a practical problem with clear efficiency gains on general-purpose generators. The rebuttal closes the main empirical gaps raised above through additional experiments and addressed the concerns. I recommend acceptance as this provides a useful direction for efficient test-time refinement in multimodal code generation.
1 comment
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper introduces a test-time scaling approach for the plot-to-code generation task. The goal is to create accurate code that can render a given plot. Most existing approaches either rely on one-pass generation or use multiple iterations with complex agentic pipelines, which can be inefficient and inaccurate. The paper introduces an approach in which a verifier is trained to diagnose errors in generated chart code.
The verifier takes the generated code, the rendered plot, and the original reference plot as input, and identifies the issues. The errors can be categorized into four types: compiler errors, data errors, local style errors, and global style errors. The verifier predicts the error type and inserts TODO comments into the code, indicating which parts should be changed to make the rendered plot closer to the reference plot. As a result, in the next step, the generator does not need to regenerate the entire code. Instead, it only modifies the regions identified by the verifier. This reduces the number of tokens generated by the generated overall.
The paper proposes an SFT and RL pipeline to train the verifier. The authors also create a diagnostic dataset for verifier training. Experiments are performed on two benchmarks and show that the proposed method performs better than Best-of-N sampling and multi-agent refinement while using fewer tokens. However, when used with a specialized plot-to-code model, the refinement method does not improve performance. The qualitative results show that performance improves as the number of refinement iterations increases, although the final graphs still remain noticeably different from the ground truth.
Strengths and weaknesses
The following are the strengths of the paper.
-
The paper focuses on a very practical and useful problem. Plot-to-code generation can be valuable in many real applications, especially when users want to recreate or edit charts from available research papers, where the plotting codes are not available.
-
The idea of using a verifier to identify the regions that need to be modified is interesting. It is similar to how humans debug code, where we first check the output, identify the problem, and then only modify the relevant part of the code. This also reduces some burden on the generator.
-
The experiments are quite comprehensive. The authors evaluate the method on two benchmarks and compare it with many baselines, including Best-of-N, self-debugging, and multi-agent. They also provide ablations and analysis experiments, which help in understanding which parts of the method are useful.
The following are the weaknesses of the paper.
-
The comparison with baselines may not be fully fair. The proposed verifier is trained on 12k diagnostic examples from Chart2Code-160K, while baselines like Best-of-N, self-debugging, and multi-agent refinement seem to be mostly zero-shot or prompt-based methods. Because of this, it is hard to know whether the gains come from the proposed diagnostic refinement idea, or simply from giving the method extra in-domain training.
-
The qualitative examples are not fully convincing. In Figure 4 and 10, the final outputs after refinement still look visually far from the ground truth. This is concerning as the automatic metrics may not fully capture fine-grained visual differences, or that the shown examples may not strongly support the reported quantitative gains.
-
The token-efficiency claim is useful, but the token accounting is not very clear. The verifier takes images and code as input, and the generator also receives code context and produces patches over multiple iterations. It is not clear whether the reported token numbers include verifier input and output tokens as well?
-
The diagnostic categories are quite coarse. The verifier predicts errors such as data, local style, and global style, but high-fidelity plot repair may need more detailed feedback. For example, the model may need to know the exact wrong color, marker, tick label, axis range, legend position, font size, or data value.
Questions
The following are suggestions/questions for the rebuttal.
-
About fairness, will it be possible to compare against baselines that are also trained or adapted using the same diagnostic data budget? Since the verifier receives additional in-domain training, it is not fully clear whether the improvement comes from the proposed visual-code diagnostic mechanism or from the extra training data. It would be good to include an ablation that separates the effect of the diagnostic design from the effect of in-domain SFT/RL training.
-
All qualitative examples look visually far from the ground truth even after refinement, but the quantitative numbers are high. A comment on whether the current metrics are sensitive enough to fine-grained plot errors such as wrong tick labels, colors, marker shapes, font sizes, legends, and exact data values will be helpful.
-
The paper reports that the proposed method uses fewer tokens than multi-agent refinement, but it is not fully clear what tokens are counted. Do the reported numbers include verifier input and output tokens as well? If not, including them would be helpful and fair.
Also, please refer to the weaknesses section above.
Limitations
Yes
Final justification
The rebuttal addresses several of my concerns and strengthens my assessment of the paper, and I would like to retain my rating of Borderline Accept.
Formatting concerns
No paper formatting concerns.
3 comments
Comment Reply 1
We sincerely thank the reviewer for recognizing the practical value, human-like debugging motivation, and breadth of our experiments. We address each question below and will incorporate the corresponding clarifications and corrections into the revised paper.
Question 1
The comparison with baselines may not be fully fair. The proposed verifier is trained on 12k diagnostic examples from Chart2Code-160K, while baselines like Best-of-N, self-debugging, and multi-agent refinement seem to be mostly zero-shot or prompt-based methods. Because of this, it is hard to know whether the gains come from the proposed diagnostic refinement idea, or simply from giving the method extra in-domain training.
About fairness, will it be possible to compare against baselines that are also trained or adapted using the same diagnostic data budget? Since the verifier receives additional in-domain training, it is not fully clear whether the improvement comes from the proposed visual-code diagnostic mechanism or from the extra training data. It would be good to include an ablation that separates the effect of the diagnostic design from the effect of in-domain SFT/RL training.
The untrained Qwen3-VL-2B and Qwen3-VL-32B verifiers in Table 1 can be viewed as zero-shot versions of our diagnostic refinement framework. They use the same diagnostic-and-patch pipeline without any training on our diagnostic dataset. With Qwen3-VL-8B as the generator, the zero-shot 32B verifier achieves L=70.9 on ChartMimic and L=58.5 on Plot2Code, outperforming vanilla generation, Best-of-N, and self-debug on both datasets. Even the zero-shot 2B verifier remains competitive with multi-agent refinement (70.0 vs. 70.3 on ChartMimic and 57.2 vs. 57.7 on Plot2Code), although multi-agent refinement relies on stronger generator-scale agents for critique and modification. These results demonstrate that the visual-code diagnostic refinement strategy is effective even without additional training.
Beyond strong performance and lower output-token consumption (Table 2), our visual-code diagnostic refinement strategy enables simple and scalable data synthesis. Controlled mutations create visual discrepancies, while line-level alignment automatically derives code-region labels without human repair annotation or multi-agent interaction trajectories. Training on these synthesized diagnostics further improves both verifier quality and final refinement performance, as shown in Tables 1 and 5.
Finally, the diagnostic data and evaluation benchmarks are not the same in-domain dataset. The diagnostic supervision is constructed from Chart2Code-160K, whereas all final results are evaluated on the separate ChartMimic and Plot2Code benchmarks. Thus, the verifier receives task-relevant supervision but is not adapted to either test benchmark. We will clarify this distinction and the role of the zero-shot verifier settings in the revision.
Question 2
The qualitative examples are not fully convincing. In Figure 4 and 10, the final outputs after refinement still look visually far from the ground truth. This is concerning as the automatic metrics may not fully capture fine-grained visual differences, or that the shown examples may not strongly support the reported quantitative gains.
All qualitative examples look visually far from the ground truth even after refinement, but the quantitative numbers are high. A comment on whether the current metrics are sensitive enough to fine-grained plot errors such as wrong tick labels, colors, marker shapes, font sizes, legends, and exact data values will be helpful.
The case studies in Figures 4 and 10 use Qwen3-VL-8B, whose overall generation quality is relatively low. We will identify the generator explicitly in the revised captions.
From the holistic visual metric H, the quantitative results are consistent with the qualitative impression. For Qwen3-VL-8B on ChartMimic, H increases from 64.4 for vanilla generation to 71.8 after refinement. These moderate scores reflect the visible remaining differences in the case studies. Individual metrics measure narrower properties and are not equivalent to overall human visual judgment. For example, E only measures whether code executes, while TT focuses on text elements; a chart may score well on either metric while still containing noticeable layout, style, or data discrepancies. LO, TP, and CL similarly evaluate specific aspects, whereas H is intended to capture the overall visual impression.
Comment Reply 2
Question 3
The token-efficiency claim is useful, but the token accounting is not very clear. The verifier takes images and code as input, and the generator also receives code context and produces patches over multiple iterations. It is not clear whether the reported token numbers include verifier input and output tokens as well?
The paper reports that the proposed method uses fewer tokens than multi-agent refinement, but it is not fully clear what tokens are counted. Do the reported numbers include verifier input and output tokens as well? If not, including them would be helpful and fair.
The reported values are output tokens summed over all model calls. For our method, this includes the verifier's diagnostic outputs and the generator's patch outputs across all refinement rounds. For Best-of-N, it includes all five generated candidates; for multi-agent refinement, it includes the outputs of all participating agents across iterations. Input text tokens and image tokens are not included. We focus on output tokens because autoregressive generation is typically the more expensive and latency-intensive part of inference: API providers generally charge more for output tokens than input tokens, and generating each output token takes additional decoding time. Output-token consumption therefore directly captures the efficiency benefit of localized patch generation over repeatedly generating complete programs. We will rename the table column from “Tokens” to “Output Tokens” and state this accounting scope in both the caption and main text.
Question 4
The diagnostic categories are quite coarse. The verifier predicts errors such as data, local style, and global style, but high-fidelity plot repair may need more detailed feedback. For example, the model may need to know the exact wrong color, marker, tick label, axis range, legend position, font size, or data value.
Our diagnostic categories are extensible, and the four categories used in this paper are one practical instantiation for validating the general strategy of using visual-code Diagnostics to guide test-time refinement. In fact, our preliminary experiments showed that providing the generator with a larger and more fine-grained set of feedback categories yielded no significant additional gains.
Reply to Reviewer RmuF
Thank you again for your detailed review. We have provided a response addressing your main concerns. As the author–reviewer discussion period is approaching its end, we would appreciate it if you could let us know whether our response has clarified your concerns. If you have any remaining questions or concerns, we would be happy to provide further clarification.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 2/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes a test-time refinement framework for plot-to-code generation. The method trains a lightweight 2B-parameter visual-code diagnostic verifier that compares a reference chart with the rendered output of generated code, classifies the discrepancy into one of four error types (compiler, data, local style, global style), and localizes the suspicious code region using TODO comments. Training data is built automatically by having GPT-4o apply controlled, single-type mutations to correct chart-code pairs, with code-region labels derived via a line-level Levenshtein alignment algorithm. The verifier is trained with SFT followed by GRPO reinforcement learning. At inference time, the pipeline iterates: generate, render, diagnose, and apply a localized patch, rather than regenerating the full program. On ChartMimic and Plot2Code, this approach improves over one-pass generation, Best-of-N, self-debug, and multi-agent baselines when using Qwen3-VL-8B/32B or GPT-4o as generators, with much lower token cost. However, it degrades performance when applied to the specialized generator ChartMaster-7B.
Strengths and weaknesses
Strength:
-
The motivation is clear and well-grounded: aligning refinement with the human workflow of localized error diagnosis rather than full regeneration is intuitive, and the paper backs it with a concrete error taxonomy and efficiency analysis.
-
The ablation isolating verifier quality (Table 5) is convincing — the trained 2B verifier clearly outperforms untrained models at both 2B and 32B scale, supporting the claim that the gains come from training rather than model size.
Weakness:
-
The degradation on ChartMaster-7B (Table 3), especially on ChartMimic, raises concerns about generalization. Since the verifier improves performance on Qwen3-VL-8B/32B and GPT-4o but fails on ChartMaster-7B, it's unclear whether the diagnostic signal generalizes to generators with different code styles/training paradigms, or whether it has picked up on bug patterns specific to general-purpose MLLM outputs. Further analysis of this discrepancy would strengthen the generalization claim.
-
The number of baselines compared in Table 1 differs across the three generator settings — 8 rows for Qwen3-VL-8B-Instruct, but only 6 for Qwen3-VL-32B-Instruct and 5 for GPT-4o, with methods like Ours-SFT-2B and the untrained verifier baselines missing in the latter two blocks. Moreover, the Multi-agent baseline under GPT-4o has incomplete evaluation metrics (several columns are left blank). This inconsistency across generator settings makes the comparison less rigorous.
-
The practical value of this approach may be limited given current trends in plot-to-code generation. As Table 3 shows, the refinement framework degrades performance when applied to ChartMaster-7B, a model with strong task-specific coding ability. This suggests that as generators become more capable — whether through specialized fine-tuning or simply larger/stronger models (e.g., Qwen3.5 above 27B, or closed-source models like GPT-5.5 and beyond) — there may be fewer bugs left for the verifier to meaningfully detect and correct, and the diagnostic signal may become less reliable or even harmful. Since most practical plot-to-code generation pipelines already rely on SOTA open-source or closed-source models with strong coding capability, a method that mainly benefits weaker or moderately capable generators may have limited applicability going forward.
Questions
-
Could the authors provide an error-type breakdown or failure analysis for ChartMaster-7B to clarify whether the performance degradation stems from a different error distribution/code style rather than just weaker revision capability, especially since even untrained verifiers fail on this generator?
-
Can the method generalize to truly SOTA generators (e.g., Claude Opus, GPT-5.5), whose bugs are likely rarer, subtler, and distributed differently from the GPT-4o-mutated training data? Since practitioners mostly use frontier models for plot-to-code generation, this seems critical for the method's practical relevance.
-
Why does Qwen3-VL-32B show a lower execution success rate than the 8B model on ChartMimic (75.5 vs. 77.8 for vanilla generation in Table 1)? This is counterintuitive given the larger model's stronger general capability. Could this be an artifact of the evaluation protocol or the experimental setup?
Limitations
The authors report the negative result on ChartMaster-7B (Section 4.3), which is appreciated. However, the generalization limitation is not sufficiently discussed. It remains unclear under what conditions the method fails.
Final justification
The additional experiments address my main concerns. In particular, the gold-diagnostic analysis clarifies the failure on ChartMaster-7B, while the GPT-5.5 results support the method’s relevance to frontier models. I have therefore raised my score.
Formatting concerns
None
3 comments
Comment Reply
We sincerely thank the reviewer for recognizing the motivation, efficiency, and verifier-quality ablation of our work. We address each question below and will incorporate the corresponding clarifications and corrections into the revised paper.
Question 1
The degradation on ChartMaster-7B (Table 3), especially on ChartMimic, raises concerns about generalization. Since the verifier improves performance on Qwen3-VL-8B/32B and GPT-4o but fails on ChartMaster-7B, it's unclear whether the diagnostic signal generalizes to generators with different code styles/training paradigms, or whether it has picked up on bug patterns specific to general-purpose MLLM outputs. Further analysis of this discrepancy would strengthen the generalization claim.
Could the authors provide an error-type breakdown or failure analysis for ChartMaster-7B to clarify whether the performance degradation stems from a different error distribution/code style rather than just weaker revision capability, especially since even untrained verifiers fail on this generator?
When deriving the error taxonomy in Appendix A, we manually inspected and analyzed the generated code of four representative models, including ChartMaster-7B. Despite its task-specific training paradigm, ChartMaster-7B does not exhibit a qualitatively different code style or set of error types: its failures remain covered by the same compiler, data, local-style, and global-style categories observed for the general-purpose generators.
The paper also shows that all evaluated refinement strategies fail to improve ChartMaster-7B consistently. These include our trained verifier, self-debug, multi-agent refinement, and untrained verifiers. However, all of these refinement strategies improve the results of general-purpose models. ChartMaster-7B is specialized for direct plot-to-code generation but is not explicitly trained for instruction-following code revision. In contrast, although general-purpose MLLMs are not specifically trained for plot-to-code generation, their stronger general instruction comprehension and following capabilities enable them to revise code more effectively according to diagnostic feedback. These observations indicate that the generator's ability to revise code is an important factor, and that the degradation is unlikely to be explained solely by bug patterns or code style.
To further isolate the cause, we conducted a manual analysis in which ChartMaster-7B was given human-annotated gold visual-code diagnostics. Even with the correct error types and code regions, it still failed to repair the identified errors. This rules out inaccurate diagnostics as the primary cause and supports the explanation already given in Lines 296–300: unlike general-purpose MLLMs with strong instruction-following ability, ChartMaster-7B is specialized for direct generation but not trained to revise code according to feedback. In the revised version, we will further expand this discussion by incorporating the new gold-diagnostic analysis and more clearly explaining the dependence of test-time refinement on the generator's code-revision capability.
Question 2
The practical value of this approach may be limited given current trends in plot-to-code generation. As Table 3 shows, the refinement framework degrades performance when applied to ChartMaster-7B, a model with strong task-specific coding ability. This suggests that as generators become more capable — whether through specialized fine-tuning or simply larger/stronger models (e.g., Qwen3.5 above 27B, or closed-source models like GPT-5.5 and beyond) — there may be fewer bugs left for the verifier to meaningfully detect and correct, and the diagnostic signal may become less reliable or even harmful. Since most practical plot-to-code generation pipelines already rely on SOTA open-source or closed-source models with strong coding capability, a method that mainly benefits weaker or moderately capable generators may have limited applicability going forward.
Can the method generalize to truly SOTA generators (e.g., Claude Opus, GPT-5.5), whose bugs are likely rarer, subtler, and distributed differently from the GPT-4o-mutated training data? Since practitioners mostly use frontier models for plot-to-code generation, this seems critical for the method's practical relevance.
To directly examine whether our method remains effective for a stronger frontier generator, we additionally evaluate GPT-5.5 on ChartMimic using the same generation and refinement pipeline.
| Method | E |
L |
H |
|---|---|---|---|
| GPT-5.5 | 95.1 | 85.4 | 87.3 |
| GPT-5.5 + Ours | 95.8 | 88.1 | 89.4 |
Although GPT-5.5 already achieves strong one-pass performance, our method further improves E from 95.1 to 95.8, L from 85.4 to 88.1, and H from 87.3 to 89.4. This result directly shows that the benefit persists for a frontier generator and is consistent with the improvements already observed for GPT-4o and Qwen3-VL-32B in Table 1. More capable generators leave fewer errors, but their remaining discrepancies can still be localized and corrected; targeted patches are particularly suitable because they preserve already-correct code.
Question 3
The number of baselines compared in Table 1 differs across the three generator settings — 8 rows for Qwen3-VL-8B-Instruct, but only 6 for Qwen3-VL-32B-Instruct and 5 for GPT-4o, with methods like Ours-SFT-2B and the untrained verifier baselines missing in the latter two blocks. Moreover, the Multi-agent baseline under GPT-4o has incomplete evaluation metrics (several columns are left blank). This inconsistency across generator settings makes the comparison less rigorous.
For the Multi-agent baseline, the GPT-4o results are directly taken from the original paper, which reports only the available ChartMimic metrics shown in Table 1. The Multi-agent results under Qwen3-VL-8B and Qwen3-VL-32B are reproduced by us using the corresponding generator.
The untrained 2B/32B verifiers and Ours-SFT-2B are verifier-training ablations rather than test-time generation baselines. In the submitted version, we reported the full verifier ablation with Qwen3-VL-8B and directly evaluated verifier quality in Table 5, so we did not repeat every ablation under the more expensive Qwen3-VL-32B and GPT-4o generators. To remove this inconsistency, we further complete all verifier settings for these two generators. The results below report execution (E), the four fine-grained visual metrics (TT/LO/TP/CL), their average (L), and high-level visual similarity (H) on both benchmarks.
| Generator | Verifier | Dataset | E |
TT |
LO |
TP |
CL |
L |
H |
|---|---|---|---|---|---|---|---|---|---|
| Qwen3-VL-32B | Qwen3-VL-2B | ChartMimic | 82.5 | 72.8 | 81.0 | 76.9 | 55.7 | 71.6 | 70.6 |
| Qwen3-VL-32B | Qwen3-VL-2B | Plot2Code | 83.3 | 52.5 | 72.4 | 62.6 | 49.3 | 59.2 | 59.8 |
| Qwen3-VL-32B | Ours-SFT-2B | ChartMimic | 84.8 | 74.5 | 83.3 | 77.8 | 57.6 | 73.3 | 73.6 |
| Qwen3-VL-32B | Ours-SFT-2B | Plot2Code | 87.9 | 55.4 | 76.0 | 64.7 | 52.3 | 62.1 | 61.7 |
| GPT-4o | Qwen3-VL-2B | ChartMimic | 92.7 | 82.3 | 93.8 | 82.5 | 77.0 | 83.9 | 83.8 |
| GPT-4o | Qwen3-VL-2B | Plot2Code | 91.7 | 59.3 | 79.7 | 72.9 | 60.1 | 68.0 | 68.3 |
| GPT-4o | Qwen3-VL-32B | ChartMimic | 92.9 | 84.6 | 94.5 | 83.2 | 78.1 | 85.1 | 84.7 |
| GPT-4o | Qwen3-VL-32B | Plot2Code | 92.4 | 60.8 | 81.0 | 74.2 | 61.6 | 69.4 | 69.5 |
| GPT-4o | Ours-SFT-2B | ChartMimic | 93.1 | 87.1 | 95.0 | 84.3 | 79.6 | 86.5 | 85.8 |
| GPT-4o | Ours-SFT-2B | Plot2Code | 92.4 | 61.9 | 82.2 | 75.6 | 62.7 | 70.6 | 71.1 |
These additional results preserve the same trend as the Qwen3-VL-8B block: trained visual-code diagnostics consistently outperform untrained verifiers, and RL further improves over SFT. We will add the complete rows to Table 1 so that verifier settings are consistent across generators.
Question 4
Why does Qwen3-VL-32B show a lower execution success rate than the 8B model on ChartMimic (75.5 vs. 77.8 for vanilla generation in Table 1)? This is counterintuitive given the larger model's stronger general capability. Could this be an artifact of the evaluation protocol or the experimental setup?
Both models use the same prompt, decoding configuration, execution environment, and evaluation protocol. We repeated the generation and evaluation multiple times and observed the same small difference on ChartMimic.
Importantly, Qwen3-VL-32B still achieves better visual quality on ChartMimic than the 8B model (L: 67.3 vs. 66.2; H: 65.9 vs. 64.4), consistent with its stronger overall generation capability. The execution rate also follows the expected trend on Plot2Code, where Qwen3-VL-32B outperforms Qwen3-VL-8B (78.6 vs. 76.5). Therefore, the isolated 2.3-point execution difference on ChartMimic should be interpreted together with the other metrics and datasets, and may simply reflect a small fluctuation in model performance on this particular data distribution.
Question 5
The authors report the negative result on ChartMaster-7B (Section 4.3), which is appreciated. However, the generalization limitation is not sufficiently discussed. It remains unclear under what conditions the method fails.
We will expand the limitations section to state the applicability boundary explicitly. The framework is effective when the generator can reliably follow diagnostic instructions. It may fail when the generator lacks sufficient code-revision ability, as observed with ChartMaster-7B. This scope is consistent with the positive results on general-purpose generators and the negative result on the specialized generator.
Thank you for the detailed response. The additional experiments address my main concerns. I have raised my score accordingly.
Reply to Reviewer xL4t
Thank you very much for reconsidering our work and increasing the score. We truly appreciate your thoughtful feedback and recognition of our additional experiments.
- Rating
- 5/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 2/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes Visual-Code Diagnostics (VCD), a test-time refinement framework for plot-to-code generation. Given a reference chart and generated Matplotlib code, a compact 2B verifier is trained to diagnose visual discrepancies and localize them to specific code regions via inserted TODO comments, enabling targeted patch-based correction rather than full program regeneration.
Training: Synthetically mutated chart-code pairs via SFT, followed by GRPO using a dual reward (visual error prediction + code localization quality). Inference: the pipeline iterates: generate → render → diagnose → patch, for up to 5 rounds Results: outperforms multi-agent baselines on ChartMimic and Plot2Code while using 6.1× fewer inference tokens.
Strengths and weaknesses
Strengths
- Mirrors human debugging by separating what is visually wrong from where to fix it in the code.
- The specialized 2B verifier reduces token overhead significantly and outperforms untrained 32B models.
- Demonstrates that test-time refinement fails if the base generator inherently lacks code-editing capabilities (tested on ChartMaster-7B).
- Code, datasets, models, hyperparameters, and prompts are fully open-sourced.
Weakness
- The framework is primarily an engineering combination of existing concepts (test-time refinement, localized patching, and R1-style SFT+GRPO) applied to a specific task
- The dual reward function is not ablated. It is unclear how the individual terms, their uniform weighting, or the chosen Jaccard similarity metric affect training performance.
- The four-category taxonomy is derived from Matplotlib internal API structure rather than visual perception, causing it to miss common layout, scale, and rendering errors.
Questions
- How sensitive are results to the Jaccard-based reward formulation? Have you compared against F1 over line ranges or exact match for code localization?
- Have you tested the framework on any non-Matplotlib plotting library? If not, what is the primary barrier — benchmark availability or taxonomy transferability?
Limitations
yes
Final justification
The authors have addressed my comments and questions. Hence, I have updated the rating to accept.
Formatting concerns
.
2 comments
Comment Reply
We sincerely thank the reviewer for recognizing the practical motivation, efficiency, and diagnostic-guided debugging paradigm of our work. We address each question below and will incorporate the corresponding clarifications and corrections into the revised paper.
Question 1
The framework is primarily an engineering combination of existing concepts (test-time refinement, localized patching, and R1-style SFT+GRPO) applied to a specific task.
We respectfully clarify that our contribution is not the isolated use of refinement, patching, or GRPO, but the formulation and learning of visual-code diagnostics for plot-to-code generation. Existing methods either regenerate complete programs or use free-form critique without grounding visual discrepancies in code. In contrast, our verifier jointly predicts what is visually wrong and where the responsible code is, represents localization as generation-friendly TODO actions, and enables targeted patching with a compact model. Supporting this formulation requires a real-error-derived taxonomy, scalable paired visual-code supervision, code-aware line alignment, and a task-specific dual training objective. Empirically, the trained 2B verifier outperforms an untrained 32B verifier and heavyweight multi-agent refinement while using substantially fewer output tokens. We will revise the introduction to distinguish these task-specific technical contributions more explicitly from the standard optimization components used to train them.
Question 2
The dual reward function is not ablated. It is unclear how the individual terms, their uniform weighting, or the chosen Jaccard similarity metric affect training performance.
How sensitive are results to the Jaccard-based reward formulation? Have you compared against F1 over line ranges or exact match for code localization?
The effects of the two reward targets are already examined through their corresponding diagnostic signals in “Ablation Study on Visual-Code Diagnostic Signals” (Lines 305–320). Visual-only and code-only diagnostics achieve L=70.7 and L=72.2, respectively, while their combination achieves the best result of L=73.4. This shows that both targets contribute complementary information.
We chose Jaccard similarity because both error types and localization actions are variable-size sets. It gives partial credit for partially correct diagnostics, normalizes for set size, and penalizes both missing and spurious predictions. Exact match is substantially sparser: one shifted or omitted code region makes the entire localization reward zero. Set F1 captures nearly the same overlap information as Jaccard and is a monotonic transformation of it for each prediction/reference pair.
To directly test sensitivity to the similarity function, we additionally trained models from the same SFT checkpoint while changing the similarity metric used by both the visual and code rewards. We report downstream execution (E) and visual similarity (L) using Qwen3-VL-8B on ChartMimic.
| Reward similarity | E |
L |
|---|---|---|
| Exact match | 87.2 | 71.9 |
| F1 | 89.8 | 73.4 |
| Jaccard | 90.0 | 73.4 |
Jaccard and F1 produce nearly identical results, confirming that the method is not sensitive to the specific overlap formulation. Exact match performs substantially worse because its sparse reward discards useful partial matches for both error-type prediction and code localization, which reduces downstream refinement quality. We will add this comparison to the revision.
Question 3
The four-category taxonomy is derived from Matplotlib internal API structure rather than visual perception, causing it to miss common layout, scale, and rendering errors.
We clarify that the taxonomy is not derived solely from Matplotlib's internal API structure. During our analysis of genuine errors produced by four representative generators, we jointly considered their visual manifestations and the corresponding code structure. The visual evidence distinguishes failed rendering, incorrect plotted content, element-level appearance errors, and plot-level layout or styling errors, while the code structure makes these discrepancies actionable for localization and repair. Consequently, the cited cases are covered: axis ranges, linear/log scales, ticks, subplot spacing, titles, and legends are handled as global- or local-style errors according to their visual scope, while failures that prevent rendering are compiler errors.
More importantly, these four categories are not intended as a fixed or exhaustive taxonomy. Visual-code diagnostic categories can be refined or extended for different plotting scenarios, visual conventions, and libraries. The central contribution of this work is to validate the strategy of using structured visual-code diagnostics—identifying both what is visually wrong and where it originates in code—to guide test-time refinement. The current four-category taxonomy is one practical instantiation for the Matplotlib benchmarks, while code localization provides the fine-grained repair information.
Question 4
Have you tested the framework on any non-Matplotlib plotting library? If not, what is the primary barrier — benchmark availability or taxonomy transferability?
Our goal in this work is to establish whether structured visual-code diagnostics can effectively guide test-time refinement, and we use the established Matplotlib-based benchmarks as a controlled testbed for this question.
The high-level diagnostic concepts—data errors, element-level visual errors, and plot-level layout or scale errors—can be extended or adapted to other libraries. Likewise, line-level localization and TODO-based feedback do not depend on Matplotlib. Therefore, the Visual-Code Diagnostics framework can be extended to other plotting libraries by adapting the diagnostic categories to their visual conventions and code structures.
Reply to Reviewer LRFY
Thank you again for your detailed review. We have provided a response addressing your main concerns. As the author–reviewer discussion period is approaching its end, we would appreciate it if you could let us know whether our response has clarified your concerns. If you have any remaining questions or concerns, we would be happy to provide further clarification.
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper studies test-time refinement for plot-to-code generation. The proposed framework first generates a plotting program, renders it, and then uses a visual-code diagnostic verifier to compare the reference chart, generated chart, and code. The verifier predicts coarse error types such as data, local style, and global style errors, and inserts TODO-style localization comments near suspicious code regions. The generator then produces localized code patches instead of regenerating the whole program. The verifier is trained from 12K synthetic diagnostic examples built from 1K Chart2Code-160K programs using GPT-4o mutations and line-level code alignment. The method is evaluated on ChartMimic and Plot2Code with Qwen3-VL and GPT-4o generators.
Strengths and weaknesses
##Strengths
-
The paper targets a concrete weakness of current plot-to-code systems: generated code often has localized visual or semantic errors that full-program regeneration may change unnecessarily.
-
The visual-code diagnostic formulation is well motivated for Matplotlib-style code, where data arrays, plot calls, and global style settings often correspond to different visual error types. The method is relatively simple and efficient.
-
The experiments are reasonably broad for this task: ChartMimic and Plot2Code are used, and the method is tested with Qwen3-VL-8B, Qwen3-VL-32B, GPT-4o, and ChartMaster-7B.
Weaknesses:
-
The main limitation is that the method does not consistently help all generators. In Table 3, refinement substantially hurts ChartMaster-7B on ChartMimic and mostly fails to improve Plot2Code. Since ChartMaster-7B is a specialized plot-to-code model, this is an important boundary case rather than a minor exception.
-
The diagnostic verifier is trained on synthetic GPT-4o mutations. The paper does not show whether these synthetic errors match real generation errors well enough, especially when multiple error types occur together or when discrepancies are subtle. Some reported numbers need clarification. The paper defines L as the average of TT, LO, TP, and CL, but several L values in Table 1 appear inconsistent with that definition.
-
The baseline comparisons would be stronger with clearer equal-budget settings, including the value of N for Best-of-N, the number of self-debug iterations, and whether all methods use the same visual inputs and stopping rules. The checklist says LLM usage is N/A, but GPT-4o is used for diagnostic data construction and high-level evaluation, so this should be corrected.
Questions
-
Can the authors explain why several Table 1 L scores do not match the stated average of TT/LO/TP/CL?
-
Can the authors evaluate diagnostic accuracy on real model errors with manual labels, in addition to the synthetic mutation dataset?
-
What are the exact inference budgets for Best-of-N, self-debug, multi-agent refinement, and the proposed method?
-
Why does the method degrade ChartMaster-7B? Is the issue inaccurate diagnostics, bad patch merging, or insufficient code-editing ability of the generator?
Limitations
The paper discusses the ChartMaster-7B failure case, which is helpful. The limitations section should also discuss the synthetic nature of the diagnostic data, dependence on generator code-editing ability, lack of real-error diagnostic evaluation, and the role of GPT-4o in both constructing data and evaluating outputs.
Formatting concerns
NO
3 comments
Comment Reply 1
We sincerely thank the reviewer for the careful reading, constructive questions, and positive assessment of our motivation, method, and experimental coverage. We address each question below and will incorporate the corresponding clarifications and corrections into the revised paper.
Question 1
Some reported numbers need clarification. The paper defines L as the average of TT, LO, TP, and CL, but several L values in Table 1 appear inconsistent with that definition.
Can the authors explain why several Table 1 L scores do not match the stated average of TT/LO/TP/CL?
Thank you for identifying this calculation error. When computing several L values in the Qwen3-VL-8B baseline block, we mistakenly averaged columns 1–4 (E, TT, LO, and TP) instead of the intended columns 2–5 (TT, LO, TP, and CL). The component scores themselves are correct. Recomputing L from the intended four visual metrics gives:
| Method | ChartMimic L |
Plot2Code L |
|---|---|---|
| Best-of-N | 66.9 | 50.3 |
| Self-debug | 67.6 | 51.0 |
| Multi-agent | 70.3 | 57.7 |
We will correct these six cells and recheck all derived values in the revision. This correction does not change the conclusion: Ours-RL-2B achieves 73.4/60.0 on ChartMimic/Plot2Code and remains the strongest method in this block.
Question 2
The diagnostic verifier is trained on synthetic GPT-4o mutations. The paper does not show whether these synthetic errors match real generation errors well enough, especially when multiple error types occur together or when discrepancies are subtle.
Can the authors evaluate diagnostic accuracy on real model errors with manual labels, in addition to the synthetic mutation dataset?
We appreciate this suggestion. In Appendix A, to analyze the taxonomy and distribution of real generation errors, we annotated the error types of genuine outputs produced by the evaluated plot-to-code generators on ChartMimic. Building on these existing error-type annotations, we further annotated the corresponding erroneous code regions. We evaluated Ours-RL-2B on this real-error set using the same metrics as Table 5: error-type F1 (PEF) and code-localization precision, recall, and F1 (CEP/CER/CEF).
| Verifier | PEF | CEP | CER | CEF |
|---|---|---|---|---|
| Ours-RL-2B | 85.9 | 71.8 | 78.9 | 75.2 |
These results are only slightly lower than those on the synthetic diagnostic test set in Table 5 (87.2/73.2/80.7/76.8), showing that the verifier remains effective on naturally occurring model errors. We will add this direct real-error evaluation to the revision.
Regarding cases where multiple errors occur simultaneously, our synthetic diagnostic data include samples with multiple error types and erroneous code regions, and the verifier predicts them jointly.
Besides, the error types used to construct the synthetic data are derived from our analysis of real generation errors in Appendix A rather than being arbitrarily defined. And the verifier is ultimately applied to genuine generator outputs rather than synthetic mutations; the consistent improvements across general-purpose generators in Table 1 provide complementary end-to-end evidence of its effectiveness on real errors.
Question 3
The baseline comparisons would be stronger with clearer equal-budget settings, including the value of N for Best-of-N, the number of self-debug iterations, and whether all methods use the same visual inputs and stopping rules.
What are the exact inference budgets for Best-of-N, self-debug, multi-agent refinement, and the proposed method?
All methods use a budget of five generation or refinement attempts:
- Best-of-N samples five complete candidates and selects the best one.
- Self-debug performs at most five code-revision iterations.
- Multi-agent performs at most five iterations and follows the stopping condition defined in the original multi-agent paper.
- Our method performs at most five diagnostic-guided code-revision iterations.
All refinement methods receive the same reference image and the rendered output of the current code. Multi-agent uses the stopping rule from the original paper. Self-debug and our method are run for five iterations. We will add these exact budgets, visual inputs, and stopping conditions to the experimental section.
Comment Reply 2
Question 4
The main limitation is that the method does not consistently help all generators. In Table 3, refinement substantially hurts ChartMaster-7B on ChartMimic and mostly fails to improve Plot2Code. Since ChartMaster-7B is a specialized plot-to-code model, this is an important boundary case rather than a minor exception.
Why does the method degrade ChartMaster-7B? Is the issue inaccurate diagnostics, bad patch merging, or insufficient code-editing ability of the generator?
The evidence points to insufficient code-editing ability rather than an issue specific to our diagnostic verifier. ChartMaster-7B is specialized for direct plot-to-code generation but is not explicitly trained for instruction-following code revision. In contrast, although general-purpose MLLMs are not specifically trained for plot-to-code generation, their stronger general instruction comprehension and following capabilities enable them to revise code more effectively according to diagnostic feedback. Moreover, none of the alternative test-time methods consistently improves ChartMaster-7B: self-debug and multi-agent refinement both degrade its performance, while Best-of-N provides almost no visual improvement. This shared failure across different refinement strategies strongly supports our explanation that the bottleneck lies in the generator's revision capability rather than in our diagnostic mechanism.
To further verify this explanation, we conducted a new manual case analysis in which ChartMaster-7B was given human-annotated gold visual-code diagnostics. Even with accurate error types and code-localization feedback, it still failed to correct the identified errors. This additional evidence rules out inaccurate diagnostics as the primary cause and further demonstrates that ChartMaster-7B cannot reliably translate diagnostic feedback into correct code edits.
We have already discussed this issue in Lines 296–300 of the submitted paper: “This observation suggests that the limitation lies in the generator rather than the refinement strategy. Test-time refinement relies on the model's ability to revise code based on feedback signals. While general-purpose MLLMs can effectively follow diagnostic instructions, specialized plot-to-code models like ChartMaster-7B appear less capable of performing reliable code edits, even when provided with stronger or more structured feedback.” In the revised version, we will further expand this discussion by incorporating the new gold-diagnostic analysis and more clearly explaining the dependence of test-time refinement on the generator's code-revision capability.
Question 5
The checklist says LLM usage is N/A, but GPT-4o is used for diagnostic data construction and high-level evaluation, so this should be corrected.
We agree. GPT-4o is used for synthetic diagnostic mutation generation and high-level output evaluation. We will change the checklist answer from N/A to Yes and document both uses explicitly.
The paper discusses the ChartMaster-7B failure case, which is helpful. The limitations section should also discuss the synthetic nature of the diagnostic data, dependence on generator code-editing ability, lack of real-error diagnostic evaluation, and the role of GPT-4o in both constructing data and evaluating outputs.
We agree and will expand the limitations section to cover all four points: synthetic supervision, dependence on generator revision ability, the absence of real-error diagnostic evaluation in the submitted version, and potential bias introduced by using GPT-4o for both data construction and high-level evaluation.
Reply to Reviewer qdWh
Thank you again for your detailed review. We have provided a response addressing your main concerns. As the author–reviewer discussion period is approaching its end, we would appreciate it if you could let us know whether our response has clarified your concerns. If you have any remaining questions or concerns, we would be happy to provide further clarification.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Reply to Meta Review
We sincerely thank the Area Chair for the careful synthesis and for recognizing the practical motivation, technical solidity, and efficiency of our work. We conducted additional analyses and experiments that directly address the four concerns in the metareview.
1. ChartMaster-7B and the Applicability Boundary
The taxonomy in Appendix A was derived by examining outputs and generated code from four models, including ChartMaster-7B. Its failures remain covered by the same error categories and do not exhibit a qualitatively distinct code style or taxonomy.
All evaluated refinement methods fail to improve ChartMaster-7B consistently while improving general-purpose generators. ChartMaster-7B is specialized for direct generation but not explicitly trained for instruction-following code revision. When supplied with human-annotated gold error types and code regions, it still failed to correct the errors. This indicates that generator revision ability is an important factor, rather than inaccurate diagnostics or a distinct bug distribution (Reviewer qdWh, Question 4; Reviewer xL4t, Question 1).
We also evaluated GPT-5.5 on ChartMimic. Our method improves
Efrom95.1to95.8,Lfrom85.4to88.1, andHfrom87.3to89.4(full table in Reviewer xL4t, Question 2). Thus, the applicability condition is the ability to follow diagnostic instructions and revise code, not whether the generator is weak or strong. We will make this boundary explicit.2. Synthetic Training and Real Errors
The diagnostic categories and mutation design are grounded in the real-error analysis in Appendix A. The synthetic dataset also contains multiple-error cases, for which the verifier jointly predicts multiple types and code regions.
We further annotated code-error regions for genuine model outputs and directly evaluated Ours-RL-2B. It achieves
85.9error-type F1 and71.8/78.9/75.2code-localization precision/recall/F1, only slightly below the synthetic-test results of87.2/73.2/80.7/76.8(full table in Reviewer qdWh, Question 2). This confirms transfer from controlled mutations to naturally occurring errors.3. Diagnostic Design Versus Training Data
The untrained Qwen3-VL-2B/32B verifiers in Table 1 are zero-shot versions of the same framework. Without diagnostic training, the 32B verifier reaches
L=70.9/58.5on ChartMimic/Plot2Code, outperforming vanilla, Best-of-N, and self-debug and remaining competitive with multi-agent refinement. Even the zero-shot 2B verifier is close to multi-agent. This establishes the effectiveness of the diagnostic refinement design without additional supervision.Training further improves both diagnostics and downstream refinement: the trained 2B verifier outperforms the zero-shot 32B verifier, and Table 5 shows large gains over the untrained 2B model. Moreover, supervision comes from Chart2Code-160K, while evaluation uses the separate ChartMimic and Plot2Code benchmarks; this is task-relevant supervision, not adaptation to either test set.
4. Budgets and Token Accounting
All methods use five attempts or refinement rounds. Best-of-N samples five candidates; self-debug and our method run for five revisions; multi-agent runs for at most five rounds with its original stopping rule. Refinement methods receive the same reference image and current rendered output.
Table 2 reports output tokens over all calls, including our verifier diagnostics and generator patches, all Best-of-N candidates, and all multi-agent outputs. Input text and image tokens are excluded. Because autoregressive output is typically more expensive and latency-intensive, we focus on output-token consumption and will rename the column accordingly.
Revision Summary
We will incorporate these analyses, complete inference settings, corrected token terminology, and expanded limitations. Additional supplementary tables report reward-function sensitivity (Reviewer LRFY, Question 2) and the previously missing verifier settings for Qwen3-VL-32B and GPT-4o (Reviewer xL4t, Question 3).