VisPath: Automated Visualization Code Synthesis via Multi-Path Reasoning and Feedback-Driven Optimization

Wonduk Seo, Seungyong Lee, Daye Kang, Zonghao Yuan, Seunghyun LeearXiv 2025 · DOI

Abstract

Automated data visualization often suffers from underspecified user queries, where crucial details regarding data processing and visual aesthetics are omitted. Traditional Large Language Model (LLM) approaches typically rely on single-path code generation, which lacks the robustness to handle ambiguity and the visual awareness to verify output correctness. We present VisPath, a novel framework that employs multi-path reasoning and vision-language model (VLM) feedback to synthesize optimized visualization code. By exploring diverse interpretation paths and iteratively refining outputs based on visual critiques, VisPath significantly improves both code executability and semantic alignment. Our evaluation on MatPlotBench and the Qwen-Agent benchmark demonstrates that VisPath outperforms existing state-of-the-art methods, particularly highlighting the "Goldilocks zone" of reasoning diversity.

Introduction

The rise of LLMs has revolutionized code generation, yet "Text-to-Visualization" remains a challenging frontier. Human requests for charts are frequently ambiguous—users might ask to "show trends" without specifying which variables to plot or how to handle outliers. Existing systems often follow a linear, single-path approach: they generate one script based on an initial set of assumptions. If these assumptions are flawed, the resulting visualization fails to meet user needs. Furthermore, most systems evaluate success based on whether the code runs (executability) rather than whether the image is correct (visual correctness).

The VisPath Framework

VisPath addresses these limitations by introducing a multi-agent architecture that prioritizes diversity and visual verification. The process is divided into four distinct stages:

  1. Multi-Path Generation: Instead of a single output, a Multi-Path Agent utilizes Chain-of-Thought (CoT) prompting to generate $K$ distinct logical blueprints. Each path represents a unique, plausible interpretation of the user's query.
  2. Code Synthesis and Execution: These blueprints are converted into executable Python scripts using standard libraries like Matplotlib and Seaborn.
  3. Visual Feedback: A Vision-Language Model (VLM), such as GPT-4o, acts as a critic. It inspects the rendered images for semantic alignment, data accuracy, and legibility (e.g., overlapping labels or inappropriate scales).
  4. Synthesis: A final agent aggregates the candidate scripts and the corresponding visual feedback to distill a single, optimized visualization program.
The VisPath framework architecture, illustrating the flow from user query through multi-path reasoning and visual feedback to the final synthesis.

Experimental Evaluation

We evaluated VisPath using two rigorous benchmarks: MatPlotBench, which focuses on nuanced and underspecified queries, and the Qwen-Agent Code Interpreter Benchmark, which tests general Python code execution in data tasks.

Key Results and Insights

VisPath consistently outperformed baselines like Chat2VIS and MatPlotAgent. On MatPlotBench, VisPath achieved a Plot Score of 66.12, surpassing the next best baseline (63.90). Notably, the framework improved the executable rate to 60%, compared to 53% for zero-shot methods.

A critical finding of our study is the relationship between reasoning diversity ($K$) and performance. We observed a "Goldilocks Zone" where performance peaks at $K=3$ or $K=4$. Beyond this point, the introduction of redundant or lower-quality reasoning paths tends to degrade the final synthesis, as shown in the performance curves across different models and benchmarks.

Performance metrics across MatPlotBench and Qwen-Agent benchmarks for different values of K, showing the peak performance at K=3.

The inclusion of visual feedback proved essential. Ablation studies showed that using a VLM to critique the plots added approximately 2.4 points to the Plot Score compared to systems that only checked for code execution. This confirms that "seeing" the output is vital for resolving semantic ambiguity.

Conclusion and Future Work

VisPath demonstrates that treating ambiguity as a search space and incorporating visual feedback can significantly enhance automated visualization. While the current framework is computationally more intensive than single-path models, future work could explore "early exit" strategies to optimize latency. Additionally, incorporating more fine-grained aesthetic feedback and human-in-the-loop evaluations will further bridge the gap between automated tools and professional data science requirements.

Summary updated

BibTeX
@misc{seo2025vispath,
  author = {Wonduk Seo and Seungyong Lee and Daye Kang and Zonghao Yuan and Seunghyun Lee},
  title = {{VisPath: Automated Visualization Code Synthesis via Multi-Path Reasoning and Feedback-Driven Optimization}},
  year = {2025},
  eprint = {2502.11140},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.11140},
}
Figure