CodePlot-CoT: Mathematical Visual Reasoning by Thinking with Code-Driven Images
该论文提出了一种基于代码驱动的思维链(CodePlot-CoT)范式,通过生成可执行的绘图代码来辅助数学问题的视觉推理,显著提高了视觉数学推理的准确性。
更新于 2025-10-14。作者:Chengqi Duan、Kaiyue Sun、Rongyao Fang、Manyuan Zhang、Yan Feng、Ying Luo、Yufang Liu、Ke Wang、Peng Pei、Xunliang Cai、Hongsheng Li、Yi Ma、Xihui Liu。
中文摘要
近期,大型语言模型(LLMs)和视觉语言模型(VLMs)在数学推理方面取得了显著进展,但它们在需要视觉辅助的问题上,如绘制辅助线或绘制函数来解决问题,仍面临一个关键的瓶颈。大多数LLMs和VLMs都局限于纯文本推理链,而能够生成交织文本和图像的多模态统一模型缺乏这类任务所需的精度和可控性。为此,我们提出了CodePlot-CoT,这是一种用于数学中“用图像思考”的代码驱动思维链范式。我们的方法利用VLM生成文本推理以及可执行的绘图代码,然后将这些代码渲染成图像作为“视觉思维”,以解决数学问题。为此,我们首先构建了Math-VR,这是第一个大规模、双语的数据集和基准,用于具有视觉推理的数学问题,包含178K个样本。其次,为了创建高质量的训练数据,我们开发了一种先进的图像到代码转换器,专门用于解析复杂的数学图形到代码。最后,使用这些训练数据,我们训练了CodePlot-CoT模型来解决数学问题。实验结果表明,我们的模型在新的基准测试中相对于基础模型实现了高达21%的提升,充分验证了我们提出的代码驱动推理范式的有效性。我们的工作为多模态数学推理开辟了新的方向,并为社区提供了第一个大规模数据集、全面的基准和强大的解决方案。为了促进未来的研究,我们将我们的数据集、代码和预训练模型公开发布在https://github.com/HKU-MMLab/Math-VR-CodePlot-CoT上。
英文摘要
Recent advances in Large Language Models (LLMs) and Vision Language Models (VLMs) have shown significant progress in mathematical reasoning, yet they still face a critical bottleneck with problems requiring visual assistance, such as drawing auxiliary lines or plotting functions to solve the problems. Most LLMs and VLMs are constrained to text-only reasoning chains, while multimodal unified models that can generate interleaved text and images lack the necessary precision and controllability for such tasks. To address this, we propose CodePlot-CoT, a code-driven Chain-of-Thought paradigm for "thinking with images" in mathematics. Our approach leverages the VLM to generate text reasoning as well as executable plotting code, which is then rendered into images as "visual thought", to solve mathematical problems. To achieve this, we first construct Math-VR, the first large-scale, bilingual dataset and benchmark for Mathematics problems with Visual Reasoning, comprising 178K samples. Second, to create high-quality training data, we develop a state-of-the-art image-to-code converter specialized for parsing complex mathematical figures into codes. Finally, using these training data, we train the CodePlot-CoT model for solving mathematical problems. Experimental results show that our model achieves up to 21% increase over base model on our new benchmark, fully validating the efficacy of our proposed code-driven reasoning paradigm. Our work opens a new direction for multimodal mathematical reasoning and provides the community with the first large-scale dataset, comprehensive benchmark, and strong approach for such problems. To facilitate future research, we make our datasets, code, and pretrained models publicly available at https://github.com/HKU-MMLab/Math-VR-CodePlot-CoT.
解读
一句话总结
该论文提出了一种基于代码驱动的思维链(CodePlot-CoT)范式,通过生成可执行的绘图代码来辅助数学问题的视觉推理,显著提高了视觉数学推理的准确性。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:尽管LLMs和VLMs在数学推理方面取得了进展,但它们在需要视觉辅助的问题上仍存在瓶颈,例如绘制辅助线或绘制函数图来解决数学问题。
- 现有方案不足:大多数LLMs和VLMs仅限于文本推理链,而多模态统一模型虽然可以生成交织的文本和图像,但缺乏必要的精度和控制能力来完成这些任务。
- 研究目标:提出CodePlot-CoT,一种代码驱动的思维链范式,通过VLM生成文本推理和可执行绘图代码,然后将其渲染成图像作为“视觉思维”,以解决数学问题。
问题2:论文的核心创新点是什么?
- 技术创新:提出了一种新的代码驱动的思维链范式,通过生成可执行的绘图代码来辅助数学问题的视觉推理。
- 方法改进:构建了Math-VR,一个大规模的双语数据集和基准,并开发了MatplotCode,一个专用于将复杂数学图形解析为代码的高保真图像到代码转换器。
- 优势:与现有方法相比,CodePlot-CoT在Math-VR基准上实现了高达21%的性能提升,证明了代码驱动推理范式的有效性。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在Math-VR基准上对CodePlot-CoT进行了评估,与基线模型进行了比较。
- 性能提升:CodePlot-CoT在Math-VR基准上实现了高达21%的性能提升。
- 对比结果:与基线模型相比,CodePlot-CoT在答案正确性和过程评分方面都有显著提升。
问题4:这个研究的实际应用价值是什么?
- 应用场景:教育、辅助工具、智能问答系统等。
- 实施建议:在数学教育、数学辅助工具开发等领域进行应用。
- 局限与展望:未来可以进一步提高图像到代码的转换精度,并探索更多应用场景。
来源
机器可读索引:llms.txt