MARIO

May 8, 2024 ยท View on GitHub

This is the official repository for the paper MARIO: MAth Reasoning with code Interpreter Output -- A Reproducible Pipeline. We release our codes and data.

MARIO REACT Corpus coming soon. ๐Ÿค—๐Ÿค–Gaokao-2023-ME are released here

Base Model: LlemmaOutcome Value Model
7B๐Ÿค—๐Ÿค–MARIO-7B๐Ÿค—๐Ÿค–MARIO-OVM-7B
34B๐Ÿค—๐Ÿค–MARIO-34B

Performance

We demonstrate the results of our MARIO-7B and MARIO-34B as follows:

ModelDecodingGSMMATHOCWCourseGaokao-2023-ME
MARIO-OVM-7B + OVM@20Hybrid83.660.625.442.9
MARIO-7B + OVM@20Hybrid82.959.128.345.2
MARIO-OVM-7BHybrid74.547.719.132.5
MARIO-7BHybrid70.146.319.935.6
ToRA-Code-7BHybrid72.644.64.823.9
MAmmoTH-Coder-7BHybrid59.433.411.015.3
MathCoder-7BHybrid67.830.2--
MetaMath-7B-MistralCoT77.728.2--
OpenChat-3.5-7BCoT77.328.6--
ChatGLM-3-6BCoT72.325.7--
ModelDecodingGSMMATHOCWCourseGaokao-2023-ME
MARIO-34BHybrid78.753.125.441.3
ToRA-Code-34BHybrid80.750.85.531.7
MAmmoTH-Coder-34BHybrid72.743.614.025.2
MathCoder-34BHybrid81.745.2--
DeepSeek-Coder-33BPoT60.729.1--
QWen-72BCoT78.935.2--

Installation

Clone this repository and install the required packages:

git clone https://github.com/MARIO-Math-Reasoning/MARIO.git
cd MARIO
pip install -r requirements.txt

math_evaluaiton is deprecated. Please use https://github.com/MARIO-Math-Reasoning/MARIO_EVAL.git.

Data Generation

python gpt_react.py --verbose -g "gpt-4-1106-preview" -q "Given complex number $(a+i)(1-ai)=2,\;a \in \mathbb{R}$, find $a$."

Training and Inference

Our training is mostly performed on LLaMA-Factory code base. Please refer to that repo for more details.

Quick Start

Single question inference with screen output.

python react.py -c /path/to/checkpoint_dir -q "Compute tan(45)." --verbose

Batch inference with vllm

python batch_react.py -c /path/to/checkpoint_dir -q /path/to/question_file

Question file should be in jsonl format, where each line is a json string. The json string should at least include a key value pair for question.

Evaluation

python eval.py -q /path/to/question_file

Question file should be in jsonl format, where each line is a json string at least containing "pred" and "answer" keys for prediction and ground truth, respectively.

Acknowledgements

Citation

Please cite our paper if you use our data, model or code. Please also kindly cite the original dataset papers.

@misc{liao2024mario,
      title={MARIO: MAth Reasoning with code Interpreter Output -- A Reproducible Pipeline}, 
      author={Minpeng Liao and Wei Luo and Chengxi Li and Jing Wu and Kai Fan},
      year={2024},
      eprint={2401.08190},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}