HKU and Meituan Boost AI Math Skills with CodePlot-CoT
HKU and Meituan Breakthrough: AI Solves Math Problems Through Code Visualization
Large language models have historically struggled with mathematical geometry problems, despite excelling in text-based tasks. A new collaborative study from the University of Hong Kong (HKU) and Meituan presents CodePlot-CoT, an innovative solution that bridges this gap through code-driven visual reasoning.
The Core Challenge
Traditional AI models like GPT-4.1 and Gemini-2.5-Pro falter when faced with problems requiring geometric visualization or function graphing. While proficient in textual reasoning chains, these models lack the precision needed for mathematical graphics where angles, ratios, and positions must adhere to strict geometric constraints.

The CodePlot-CoT Solution
The research team developed a paradigm shift:
- Code Generation: Instead of attempting direct image creation, the model writes executable plotting code (e.g., Python's Matplotlib)
- Precise Rendering: The code executes in a Python environment to generate accurate diagrams
- Integrated Reasoning: The model incorporates these code-generated visuals back into its problem-solving chain
This approach leverages AI's existing programming strengths while avoiding unreliable pixel-level image generation.
Key Technical Components
The project introduced two critical innovations:
- Math-VR Dataset: A comprehensive collection of 178,000 bilingual math problems (81% geometry-focused) requiring active drawing alongside reasoning
- MatplotCode Converter: A specialized tool converting mathematical figures into precise plotting code, outperforming commercial models in fidelity tests

Performance Breakthroughs
The results demonstrate significant improvements:
- 21% performance boost on Math-VR benchmark compared to base models
- Even advanced closed-source models like Gemini-2.5-Pro still fail on one-third of test problems without this approach The findings suggest that scaling model size alone cannot solve visual math reasoning - precise code-driven methods are essential.
Implications for AI Development
The success of CodePlot-CoT suggests:
- Future multimodal systems should prioritize programmatic precision over human-like visualization
- Applications extend beyond mathematics to engineering design and scientific computing where accuracy is paramount The team has open-sourced all datasets, code, and pre-trained models to accelerate further research.
Key Points:
- Traditional AI struggles with geometric precision in math problems
- CodePlot-CoT replaces unreliable image generation with executable plotting code
- New Math-VR dataset requires active drawing alongside problem-solving
- Method delivers 21% performance improvement over conventional approaches
- Open-source release enables broader adoption across AI community

