--- license: mit datasets: - TIGER-Lab/MathInstruct language: - en --- # 🦣 MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuning Project Page: [https://tiger-ai-lab.github.io/MAmmoTH/](https://tiger-ai-lab.github.io/MAmmoTH/) Paper: [https://arxiv.org/pdf/2309.05653.pdf](https://arxiv.org/pdf/2309.05653.pdf) Code: [https://github.com/TIGER-AI-Lab/MAmmoTH](https://github.com/TIGER-AI-Lab/MAmmoTH) ## Introduction We introduce 🦣 MAmmoTH, a series of open-source large language models (LLMs) specifically tailored for general math problem-solving. The MAmmoTH models are trained on 🤗 [MathInstruct Dataset](https://huggingface.co/datasets/TIGER-Lab/MathInstruct), a meticulously curated instruction tuning dataset that is lightweight yet generalizable. MathInstruct is compiled from 13 math rationale datasets, six of which are newly curated by this work. It uniquely focuses on the hybrid use of chain-of-thought (CoT) and program-of-thought (PoT) rationales, and ensures extensive coverage of diverse mathematical fields. | | **Base Model: Llama-2** | **Base Model: Code Llama** | **Base Model: Mistral** | |-----|---------------------------------------------------------------|--------------------------------------------------------------------------|--------------------------| | 7B | 🦣 [MAmmoTH-7B](https://huggingface.co/TIGER-Lab/MAmmoTH-7B) | 🦣 [MAmmoTH-Coder-7B](https://huggingface.co/TIGER-Lab/MAmmoTH-Coder-7B) | 🦣 [MAmmoTH-7B-Mistral](https://huggingface.co/TIGER-Lab/MAmmoTH-7B-Mistral) | | 13B | 🦣 [MAmmoTH-13B](https://huggingface.co/TIGER-Lab/MAmmoTH-13B) | 🦣 [MAmmoTH-Coder-13B](https://huggingface.co/TIGER-Lab/MAmmoTH-Coder-13B)| - | | 34B | - | 🦣 [MAmmoTH-Coder-34B](https://huggingface.co/TIGER-Lab/MAmmoTH-Coder-34B)| - | | 70B | 🦣 [MAmmoTH-70B](https://huggingface.co/TIGER-Lab/MAmmoTH-70B) | - | - | ## Training Data The models are trained on the 🤗 [MathInstruct Dataset](https://huggingface.co/datasets/TIGER-Lab/MathInstruct), which is compiled from 13 different math rationale datasets. Check out the dataset card for more details. ## Training Procedure The models are fine-tuned with the MathInstruct dataset using the original Llama-2 and Code Llama models as base models. The training procedure varies for different models based on their sizes. Check out our paper for more details. ## Evaluation The models are evaluated using open-ended and multiple-choice math problems from several datasets. Here are the results: | **Model** | **Decoding** | **GSM** | **MATH** | **MMLU-Math** | |---------------------------|---------------|-----------|-----------|-----------| | MAmmoTH-7B | **Hybrid** | 53.6 | 31.5 | 44.5 | | MAmmoTH-Coder-7B | **Hybrid** | 59.4 | 33.4 | 47.2 | | MetaMath-7B-Mistral | **CoT** | 77.7 | 28.2 | 49.3 | | OpenChat-3.5-7B | **CoT** | 77.3 | 28.6 | 49.6 | | ChatGLM-3-6B | **CoT** | 72.3 | 25.7 | 45.6 | | DeepSeek-Coder-34B | **PoT** | 58.2 | 35.3 | 46.5 | | Grok-1 | **CoT** | 62.9 | 15.7 | - | | QWen-72B | **CoT** | 78.9 | 35.2 | - | | DeepSeek-67B-Chat | **CoT** | **84.1** | 32.6 | - | | MAmmoTH-7B-Mistral | **Hybrid** | 75.0 | **40.0** | **52.5** | ## Usage You can use the models through Huggingface's Transformers library. Use the pipeline function to create a text-generation pipeline with the model of your choice, then feed in a math problem to get the solution. Check our Github repo for more advanced use: [https://github.com/TIGER-AI-Lab/MAmmoTH](https://github.com/TIGER-AI-Lab/MAmmoTH) ## Prompt Format If you want to do CoT: ``` Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: {instruction} ### Response: ``` If you want to do PoT: ``` Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: {instruction} Let's write a program. ### Response: ``` ## Intended Uses These models are trained for research purposes. They are designed to solve general math problems. They can be used in educational software, tutoring systems, or any application where a solution to a math problem is needed. The models can generate both a chain of thought (CoT) rationale and a program of thought (PoT) rationale, providing a comprehensive solution to a given math problem. ## Limitations We've tried our best to build math generalist models. However, we acknowledge that the models' performance may vary based on the complexity and specifics of the math problem. Still not all mathematical fields can be covered comprehensively. ## Citation If you use the models, data, or code from this project, please cite the original paper: ``` @article{yue2023mammoth, title={MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuning}, author={Xiang Yue, Xingwei Qu, Ge Zhang, Yao Fu, Wenhao Huang, Huan Sun, Yu Su, Wenhu Chen}, journal={arXiv preprint arXiv:2309.05653}, year={2023} } ```