2025-06-05 · 专家 · 机器学习 · 计算机视觉

VisCoder: Fine-Tuning LLMs for Executable Python Visualization Code Generation

该论文提出了VisCode-200K,一个大规模的Python可视化代码生成指令微调数据集,并通过在PandasPlotBench上的实验证明了其生成的代码在执行和语义对齐方面的有效性。

更新于 2025-11-04。作者:Yuansheng Ni、Ping Nie、Kai Zou、Xiang Yue、Wenhu Chen。

中文摘要

大型语言模型(LLMs)在像绘制图表、图表这样的可视化任务上往往很挣扎,因为这些任务的成败不仅取决于代码的正确性,还取决于视觉语义。现有的指令微调数据集缺乏基于执行的监督,且对迭代代码修正的支持有限,导致生成的图形脆弱且不可靠。我们提出了VisCode-200K,这是一个用于基于Python的可视化和自我修正的大型指令微调数据集。它包含来自两个来源的超过200,000个示例:(1)来自开源仓库经过验证的绘图代码,与自然语言指令和渲染的图形配对;(2)来自Code-Feedback的45,000个多轮修正对话,使模型能够利用运行时反馈修正错误代码。我们在VisCode-200K上对Qwen2.5-Coder-Instruct进行微调,创建了VisCoder,并在PandasPlotBench上进行评估。VisCoder显著优于强大的开源基线,并接近GPT-4o-mini等专有模型的性能。我们进一步采用自我调试评估协议来评估迭代修复,证明了反馈驱动学习对于生成可执行、视觉准确的代码的益处。

英文摘要

Large language models (LLMs) often struggle with visualization tasks like plotting diagrams, charts, where success depends on both code correctness and visual semantics. Existing instruction-tuning datasets lack execution-grounded supervision and offer limited support for iterative code correction, resulting in fragile and unreliable plot generation. We present VisCode-200K, a large-scale instruction tuning dataset for Python-based visualization and self-correction. It contains over 200K examples from two sources: (1) validated plotting code from open-source repositories, paired with natural language instructions and rendered plots; and (2) 45K multi-turn correction dialogues from Code-Feedback, enabling models to revise faulty code using runtime feedback. We fine-tune Qwen2.5-Coder-Instruct on VisCode-200K to create VisCoder, and evaluate it on PandasPlotBench. VisCoder significantly outperforms strong open-source baselines and approaches the performance of proprietary models like GPT-4o-mini. We further adopt a self-debug evaluation protocol to assess iterative repair, demonstrating the benefits of feedback-driven learning for executable, visually accurate code generation.

解读

一句话总结

该论文提出了VisCode-200K,一个大规模的Python可视化代码生成指令微调数据集,并通过在PandasPlotBench上的实验证明了其生成的代码在执行和语义对齐方面的有效性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源