ViCo: Visual-oriented Coding with Self-Reflection for Chart Replication
Organizations: China Electronics Cloud Technology Co., Ltd.
Abstract
This paper addresses the challenge of generating high-quality academic charts that match the visual standards of human-authored papers. While existing AI agents can produce well-structured text and code, their generated visualizations often lack the stylistic and semantic fidelity of human designs. Advanced coding agents that employ self-reflection mechanisms exhibit poor visual reasoning and limited reflection following, resulting in sparse reward signals that severely undermine their reinforcement learning (RL). We propose ViCo, a training framework for visual-oriented coding that employs iterative reflections to align generated chart images progressively with the reference. We first introduce a self-supervised warm-up stage, which augments Monte Carlo Tree Search with consistency-based pruning to synthesize high-quality reflection trajectories, ensuring that each coding step strictly follows the outcomes of prior reflections. A multi-step RL algorithm is then developed, using counterfactual baselines to estimate advantage for reflection and action steps within each refinement cycle, thereby addressing the reward sparsity. To enable efficient reward in massive training, we propose an automatic, multifaceted evaluation framework that assesses charts' style, layout, and semantic consistency via a hierarchical heterogeneous layout graph structure. Experiments on three public benchmarks demonstrate that ViCo, trained on an 8B model, achieves performance close to proprietary LLMs with adequate reflection capabilities.
Figures & tables
| Model | Size | RealChart2Code ∗ | ChartMimic | Plot2Code | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Pass (%) | Score | Direct P.(%) | Direct S. | Cust. P † .(%) | Cust. S † . | Pass (%) | Text | Rating | ||
| Closed-source LLMs | ||||||||||
| Claude-4.5-Sonnet Anthropic (2025) | - | 85.8 | 7.1 | 100.0 | 90.1 | 99.5 | 91.5 | 93.9 | 73.3 | 8.8 |
| Claude-4.5-Opus Anthropic (2025) | - | 87.7 | 7.8 | 98.5 | 92.3 | 100.0 | 95.1 | 99.6 | 75.4 | 9.0 |
| Gemini-2.5-Flash Google DeepMind (2026) | - | 63.2 | 5.2 | 88.5 | 69.8 | 89.1 | 74.4 | 87.9 | 72.8 | 8.6 |
| Gemini-3-Pro-Preview Google DeepMind (2026) | - | 82.1 | 9.0 | 97.3 | 96.0 | 100.0 | 96.8 | 90.9 | 79.5 | 9.6 |
| Configuration | RealChart2Code | ChartMimic | ||
|---|---|---|---|---|
| Pass (%) | Score | Pass (%) | Score | |
| ViCo (8B) ( Full Framework ) | 98.8 | 3.4 | 99.2 | 81.5 |
| w/o RL (Warmup-only) | 96.5 | 3.2 | 94.2 | 77.1 |
| w/o SFT (Cold-start RL) | 50.5 | 2.7 | 69.9 | 69.7 |
| Rewarding Strategy (Sec. 4.3 , Group 1) | ||||
| HHLG LLM-As-A-Judge | 94.1 | 2.8 | 95.0 | 72.3 |
| Evaluation Metric | Spearman ( ) | Pearson ( ) | Kendall ( ) | |||
|---|---|---|---|---|---|---|
| Sim. | Com. | Sim. | Com. | Sim. | Com. | |
| Baselines (LLM-as-a-Judge) | ||||||
| Qwen3-VL (8B) | 0.425 | 0.184 | 0.451 | 0.203 | 0.318 | 0.125 |
| GPT-4o | 0.712 | 0.321 | 0.738 | 0.355 | 0.546 | 0.241 |
| HHLG-Based (Ours) | 0.724 | 0.458 | 0.701 | 0.412 | 0.503 | 0.317 |
| Model | Simple ( ) | Medium ( – ) | Complex ( subplots) | |||
|---|---|---|---|---|---|---|
| Pass (%) | Score | Pass (%) | Score | Pass (%) | Score | |
| Qwen3-VL-8B | 90.8 | 5.8 | 78.8 | 2.8 | 20.3 | 0.5 |
| ChartCoder | 89.5 | 5.6 | 72.3 | 3.5 | 28.0 | 0.7 |
| ViCo (8B) | 100.0 | 8.7 | 99.0 | 6.7 | 99.0 | 1.2 |
| + Divide-and-Conquer | – | – | 100.0 | 8.2 | 100.0 | 7.6 |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Benchmark | Exact Match | pHash | CLIP Threshold | Filtered from Train (%) |
|---|---|---|---|---|
| RealChart2Code Zhang et al. (2026) | 0 (0.00%) | Hamming | Cosine sim. | 0 (0.00%) |
| ChartMimic Yang et al. (2025) | 0 (0.00%) | Hamming | Cosine sim. | 154 (0.26%) |
| Plot2Code Wu et al. (2025) | 0 (0.00%) | Hamming | Cosine sim. | 50 (0.08%) |
| Hyperparameter | Phase 1 (SSFT) | Phase 2 (MSRL) |
|---|---|---|
| Backbone Model | Qwen3-VL Bai et al. (2025) | |
| Optimizer | AdamW Loshchilov and Hutter (2019) | |
| Learning Rate | ||
| Learning Rate Schedule | Cosine decay | Cosine decay |
| Warmup Ratio | 0.03 | 0.05 |
| Batch Size | 128 | 64 |
| Hyperparameter | Symbol | Value | Explanation |
| Stage 1: MCTS-Based Trajectory Synthesis & Warm-Up | |||
| Max reflection steps | 3 | Maximum iteration depth of the multi-turn coding loop | |
| Branching factor | 8 | Number of candidate code expansions generated per node | |
| Exploration constant | 1.25 | Standard PUCT exploration weight | |
| Maximum patience | 2 | Sequence tolerance for consecutive non-improving steps | |
| Penalty coefficient | 0.8 | Scaling factor for differential history penalty | |
| Training Configuration | RealChart2Code | ChartMimic | ||
|---|---|---|---|---|
| Pass (%) | Score | Pass (%) | Score | |
| Vanilla SFT (Teacher Pseudo-labels) | 85.2 | 2.4 | 90.5 | 68.4 |
| Single-Stage Control Baselines | ||||
| MCTS Warm-up (w/o RL) | 89.4 | 2.6 | 92.1 | 72.8 |
| Cold-start RL (w/o Warm-up) | 62.5 | 1.8 | 71.3 | 45.2 |
| Full ViCo (Warm-up + RL) | 98.8 | 3.4 | 99.2 | 81.5 |
| Training Configuration | Pass (%) | Score | ||||
|---|---|---|---|---|---|---|
| Phase 1: SFT Warm-Up Stage | ||||||
| ViCo-4B (Warmup-only) | 89.1 | 69.4 | 75.4 | 69.5 | 63.8 | 65.2 |
| w/o Semantic | 88.2 | 44.8 | 32.2 | 70.8 | 64.3 | 65.6 |
| w/o Layout | 88.3 | 46.5 | 74.8 | 38.6 | 58.1 | 60.2 |
| w/o Style | 88.5 | 58.2 | 75.6 | 69.2 | 36.4 | 64.9 |
| w/o Color | 88.7 | 57.3 | 75.1 | 69.4 | 63.4 | 34.8 |
| Parsing Perturbation | Extent | Sub-metric Impact ( ) | |
|---|---|---|---|
| OCR token corruption | 10% | ( , , , ) | |
| Visual-node dropout | 10% | ( , , , ) | |
| Mask erosion/dilation | 10% | ( , , , ) | |
| Text-box jitter | 5% | ( , , , ) | |
| Subplot-boundary jitter | 5% | ( , , , ) |
| Model | Pass@1 (Single-shot) | Reflect 1 | Reflect 2 |
|---|---|---|---|
| Qwen3-VL-8B | 65.6 | 63.4 | 65.2 |
| Qwen3-VL-30B | 89.5 | 90.5 | 90.8 |
| Qwen3-VL-235B | 95.5 | 98.3 | 99.5 |
| ChartCoder | 90.9 | 83.2 | 79.5 |
| ViCo-8B | 88.5 | 96.7 | 99.2 |
| RL Method | RealChart2Code | ChartMimic | ||
|---|---|---|---|---|
| Pass (%) | Score | Pass (%) | Score | |
| Warmup + GRPO (Terminal reward) | 49.7 | 3.0 | 89.2 | 69.7 |
| Warmup + PPO (Terminal reward) | 57.1 | 3.0 | 89.4 | 77.1 |
| ViCo (Warmup + MSRL) | 98.8 | 3.4 | 99.2 | 81.5 |
| Method | GPU Setup | GPU Hours (h) | Peak Mem. (GiB) | Throughput (/s) |
|---|---|---|---|---|
| Warmup SFT | 8 A800 | 17.5 | 554.6 | 5.94 samples |
| Multi-turn GRPO | 8 A800 | 14.2 | 527.4 | 10.80 rollouts |
| Multi-turn PPO | 8 A800 | 17.2 | 551.2 | 1.42 samples |
| ViCo MSRL | 8 A800 | 24.4 | 523.4 | 0.84 samples |
| Method | GPU Setup | GPU Hours (h) | Peak Mem. (GiB) | Throughput (/s) |
|---|---|---|---|---|
| Warmup SFT | 8 A800 | 18.0 | 571.6 | 5.80 samples |
| Multi-turn GRPO | 8 A800 | 18.3 | 525.5 | 6.92 rollouts |
| Multi-turn PPO | 8 A800 | 18.8 | 573.5 | 1.39 samples |
| ViCo MSRL | 8 A800 | 25.6 | 535.7 | 0.79 samples |
AI Coding Agents
AI coding agents use language models and software tools to plan, edit, test, and maintain code with varying levels of autonomy.
See all 329 papers