File size: 4,149 Bytes
f3ad3f1
 
 
4fd00b9
f3ad3f1
4fd00b9
b5d38d9
bee2dfa
4fd00b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b5d38d9
 
4fd00b9
 
 
f3ad3f1
56b59a4
f3ad3f1
 
 
4e3c5a2
f3ad3f1
 
56b59a4
f3ad3f1
56b59a4
f3ad3f1
56b59a4
 
3e70c2b
f3ad3f1
 
 
56b59a4
 
f3ad3f1
3e70c2b
 
a664097
 
3e70c2b
 
 
a664097
 
 
 
3e70c2b
 
 
 
 
 
 
 
 
 
 
f3ad3f1
56b59a4
a46fb4d
56b59a4
 
 
 
 
f3ad3f1
 
56b59a4
f3ad3f1
 
56b59a4
f3ad3f1
56b59a4
 
 
f3ad3f1
56b59a4
 
 
 
 
f3ad3f1
 
 
56b59a4
f3ad3f1
 
 
56b59a4
 
 
 
 
 
f3ad3f1
 
 
 
8f34b8d
56b59a4
 
 
 
 
 
 
 
 
 
 
 
f3ad3f1
 
56b59a4
f3ad3f1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
license: apache-2.0
language:
- en
metrics:
- accuracy
pipeline_tag: image-text-to-text
tags:
- mathematics
- reasoning
- multi-modal-qa
- math-qa
- figure-qa
- geometry-qa
- math-word-problem
- textbook-qa
- vqa
- geometry-diagram
- synthetic-scene
- chart
- plot
- scientific-figure
- table
- function-plot
- abstract-scene
- puzzle-test
- document-image
- science
library_name: transformers
base_model:
- OpenGVLab/Mini-InternVL-Chat-2B-V1-5
datasets:
- MathLLMs/MM-MathInstruct
---
# MathCoder-VL: Bridging Vision and Code for Enhanced Multimodal Mathematical Reasoning

Repo: [https://github.com/mathllm/MathCoder](https://github.com/mathllm/MathCoder)

Paper: [https://huggingface.co/papers/2505.10557](https://huggingface.co/papers/2505.10557)

## Introduction
We introduce MathCoder-VL, a series of open-source large multimodal models (LMMs) specifically tailored for general math problem-solving. We also introduce [FigCodifier-8B](https://huggingface.co/MathLLMs/FigCodifier), an image-to-code model.

| Base Model                                          	|Ours                                               |
|-------------------------------------------------------------------|-----------------------------------------------------------------------|
|  [Mini-InternVL-Chat-2B-V1-5](https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-2B-V1-5)  |  [MathCoder-VL-2B](https://huggingface.co/MathLLMs/MathCoder-VL-2B)   	|
|  [InternVL2-8B](https://huggingface.co/OpenGVLab/InternVL2-8B)  |     	[MathCoder-VL-8B](https://huggingface.co/MathLLMs/MathCoder-VL-8B)|
|  [InternVL2-8B](https://huggingface.co/OpenGVLab/InternVL2-8B)  |     	[FigCodifier-8B](https://huggingface.co/MathLLMs/FigCodifier)|



## Usage
For training and inference code, please refer to [InternVL](https://github.com/OpenGVLab/InternVL).

```
from datasets import load_dataset
from PIL import Image
from io import BytesIO

mm_mathinstruct = load_dataset("MathLLMs/MM-MathInstruct")
print(mm_mathinstruct)

# show the last image
img = Image.open(BytesIO(mm_mathinstruct['train'][-1]['image']))
img.show()
```

It should print:
```
DatasetDict({
    train: Dataset({
        features: ['id', 'image', 'question', 'solution', 'image_path'],
        num_rows: 2871988
    })
})
```

## Motivation

<div align="center">
  <img src="./examples/fig1.png" width="100%" title="Result Figure">
</div>

## Construction of FigCodifier

<div align="center">
  <img src="./examples/fig2.png" width="100%" title="Result Figure">
</div>

## Construction of MathCoder-VL

<div align="center">
  <img src="./examples/fig4.png" width="100%" title="Result Figure">
</div>

## Performance

<div align="center">
  <img src="./examples/tab1.png" width="100%" title="Result Figure">
</div>

## **Citation**

Please cite the paper if you use our data, model or code.

```
@inproceedings{
wang2025mathcodervl,
title={MathCoder-{VL}: Bridging Vision and Code for Enhanced Multimodal Mathematical Reasoning},
author={Ke Wang and Junting Pan and Linda Wei and Aojun Zhou and Weikang Shi and Zimu Lu and Han Xiao and Yunqiao Yang and Houxing Ren and Mingjie Zhan and Hongsheng Li},
booktitle={The 63rd Annual Meeting of the Association for Computational Linguistics},
year={2025},
url={https://openreview.net/forum?id=nuvtX1imAb}
}
```
```
@inproceedings{
lu2025mathcoder2,
title={MathCoder2: Better Math Reasoning from Continued Pretraining on Model-translated Mathematical Code},
author={Zimu Lu and Aojun Zhou and Ke Wang and Houxing Ren and Weikang Shi and Junting Pan and Mingjie Zhan and Hongsheng Li},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=1Iuw1jcIrf}
}
```
```
@inproceedings{
wang2024mathcoder,
title={MathCoder: Seamless Code Integration in {LLM}s for Enhanced Mathematical Reasoning},
author={Ke Wang and Houxing Ren and Aojun Zhou and Zimu Lu and Sichun Luo and Weikang Shi and Renrui Zhang and Linqi Song and Mingjie Zhan and Hongsheng Li},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=z8TW0ttBPp}
}
```