NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

VisCoder2: Building Multi-Language Visualization Coding Agents

Yuansheng Ni, Songcheng Cai, Xiangchao Chen, Jiarong Liang, Zhiheng Lyu, Jiaqi Deng, Kai Zou, Ping Nie, Fei Yuan, Xiang Yue, Wenhu Chen

TL;DR

VisCoder2 introduces a massive, validated dataset of 679,000 visualization samples and a new multi-language benchmark to transform Large Language Models (LLMs) into capable "visualization agents." By combining large-scale instruction tuning with an iterative self-debugging loop, the 32B model achieves an 82.4% execution pass rate. This performance rivals proprietary models like GPT-4.1 across 12 different programming languages, marking a significant leap in automated data visualization.

Overview of the VisCoder2 framework, dataset, and benchmark

What Problem Does This Paper Address?

While LLMs are increasingly proficient at writing general code, data visualization remains a "boss level" challenge. Creating a plot isn't just about syntax; it requires cross-domain reasoning between data structures, plotting logic, and visual design conventions.

Existing models face three major hurdles in this domain:

  1. Language Myopia: Most resources focus almost exclusively on Python (Matplotlib/Seaborn) or Vega-Lite. This leaves "symbolic" or compiler-dependent languages like LaTeX (PGF/TikZ), Asymptote, or LilyPond (for music notation) severely underrepresented.
  2. Execution Blindness: Many training datasets contain "hallucinated" code snippets that look plausible but fail to run in practice.
  3. One-Shot Failure: In the real world, human experts rarely get a complex visualization perfect on the first try—they iterate based on errors. However, most current benchmarks only evaluate a single, zero-shot attempt.

Methods: The Visualization Coding Agent

The authors propose a paradigm shift from static "code generators" to dynamic Visualization Coding Agents. The core of VisCoder2 is an iterative agentic loop: Execution → Rendering → Self-Debug.

The VisCoder2 iterative self-debugging loop

To build this system, the researchers developed a rigorous three-stage pipeline:

  • Data Filtering & Extraction: Code was pulled from massive open-source repositories (like The Stack v2), and GPT-4.1-mini was used to extract standalone, executable plotting blocks.
  • Runtime Validation: Every single code snippet in the training set was executed in isolated Jupyter environments. Only snippets that produced a valid, non-trivial image were retained.
  • Instruction Generation: A structured five-part schema (Setup, Data Description, Output Description, etc.) was used to ensure the model learns the semantics of the visualization, rather than just memorizing syntax.

The resulting models, built on the Qwen2.5-Coder architecture, were fine-tuned to not only generate code but also to interpret error logs and revise their own outputs when a render fails.

Datasets and Benchmarks

The paper introduces two major open-source resources to drive future research:

  1. VisCode-Multi-679K: A gargantuan supervised fine-tuning (SFT) dataset containing 679,000 validated samples across 12 languages (Python, JavaScript, C++, R, HTML, LaTeX, SVG, Asymptote, Mermaid, LilyPond, Vega-Lite, and TypeScript). Crucially, it includes 66,000 multi-turn dialogues specifically designed to teach the model how to debug.
  2. VisPlotBench: A new evaluation benchmark consisting of 888 diverse tasks across 8 languages and 13 visual categories, ranging from standard bar charts to complex music scores and circuit diagrams.

Key Insights and Results

  • State-of-the-Art Performance: The VisCoder2-32B model reached an overall execution pass rate of 82.4% on VisPlotBench when utilizing its self-debugging capabilities.
  • Beating the Giants: VisCoder2-32B outperformed GPT-4.1-mini and approached the performance of the full GPT-4.1 model.
  • Massive Gains over Base Models: At the 7B parameter scale, the base Qwen2.5-Coder model only solved 5.5% of LilyPond tasks. After training on the new dataset, the VisCoder2-7B version solved 69.1%.
  • Symbolic Languages are the Bottleneck: While models are "saturated" on Python and HTML, they struggle immensely with symbolic grammars like LilyPond or Asymptote, where a single missing bracket causes total compilation failure.
  • The Power of Iteration: Self-debugging provides the biggest gains in these fragile, hard-to-compile languages. For example, GPT-4.1’s pass rate on LaTeX jumped from 31.3% to 66.1% simply by allowing it to see its own error logs and try again. The first round of self-debugging consistently yielded the largest improvement by correcting shallow syntax and interface errors.

Limitations and Future Work

Despite this progress, the authors note several remaining challenges:

  • Deep Semantic Issues: While the agent excels at fixing syntax (e.g., a missing comma), it still struggles with deep logic errors—such as mismatched variable meanings or incorrect data relationships—that don't trigger an explicit error log.
  • Dataset Imbalance: High-resource ecosystems like Python still dominate the training corpus compared to niche, domain-specific languages.
  • Visual Logic: Future work is needed to incorporate "visual feedback" via Vision-Language Models (VLMs). This would allow the agent to see that a plot ran but looks wrong (e.g., overlapping labels or poor color contrast), moving beyond purely text-based error logs.

Summary updated

BibTeX
@inproceedings{ni2026viscoder,
  author = {Yuansheng Ni and Songcheng Cai and Xiangchao Chen and Jiarong Liang and Zhiheng Lyu and Jiaqi Deng and Kai Zou and Ping Nie and Fei Yuan and Xiang Yue and Wenhu Chen},
  title = {{VisCoder2: Building Multi-Language Visualization Coding Agents}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=4zoMnmZzh4},
}
Figure