{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/metamath-bootstrap-your-own-mathematical","title":"MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models","arxiv_id":"2309.12284","date":"2023-09-21","proceeding":null,"authors":["Longhui Yu","Weisen Jiang","Han Shi","Jincheng Yu","Zhengying Liu","Yu Zhang","James T. Kwok","Zhenguo Li","Adrian Weller","Weiyang Liu"],"abstract":"Large language models (LLMs) have pushed the limits of natural language understanding and exhibited excellent problem-solving ability. Despite the great success, most existing open-source LLMs (e.g., LLaMA-2) are still far away from satisfactory for solving mathematical problem due to the complex reasoning procedures. To bridge this gap, we propose MetaMath, a fine-tuned language model that specializes in mathematical reasoning. Specifically, we start by bootstrapping mathematical questions by rewriting the question from multiple perspectives without extra knowledge, which results in a new dataset called MetaMathQA. Then we fine-tune the LLaMA-2 models on MetaMathQA. Experimental results on two popular benchmarks (i.e., GSM8K and MATH) for mathematical reasoning demonstrate that MetaMath outperforms a suite of open-source LLMs by a significant margin. Our MetaMath-7B model achieves 66.4% on GSM8K and 19.4% on MATH, exceeding the state-of-the-art models of the same size by 11.5% and 8.7%. Particularly, MetaMath-70B achieves an accuracy of 82.3% on GSM8K, slightly better than GPT-3.5-Turbo. We release all the MetaMathQA dataset, the MetaMath models with different model sizes and the training code for public use.","url_abs":"https://arxiv.org/abs/2309.12284v4","url_pdf":"https://arxiv.org/pdf/2309.12284v4.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"metamath-bootstrap-your-own-mathematical","repo_url":"https://github.com/meta-math/MetaMath","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"arithmetic-reasoning","task_name":"Arithmetic Reasoning"},{"task_slug":"gsm8k","task_name":"GSM8K"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"math","task_name":"Math"},{"task_slug":"math-word-problem-solving","task_name":"Math Word Problem Solving"},{"task_slug":"mathematical-reasoning","task_name":"Mathematical Reasoning"},{"task_slug":"natural-language-understanding","task_name":"Natural Language Understanding"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-3","method_name":"GPT-3"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/arithmetic-reasoning-on-gsm8k","task":"Arithmetic Reasoning","dataset":"GSM8K","model":"MetaMath 70B","rank_in_archive_order":60,"of":164,"metrics":{"Accuracy":"82.3","Parameters (Billion)":"70"},"uses_additional_data":true},{"leaderboard":"/sota/arithmetic-reasoning-on-gsm8k","task":"Arithmetic Reasoning","dataset":"GSM8K","model":"MetaMath-Mistral-7B","rank_in_archive_order":80,"of":164,"metrics":{"Accuracy":"77.7","Parameters (Billion)":"7"},"uses_additional_data":true},{"leaderboard":"/sota/arithmetic-reasoning-on-gsm8k","task":"Arithmetic Reasoning","dataset":"GSM8K","model":"MetaMath 13B","rank_in_archive_order":102,"of":164,"metrics":{"Accuracy":"71.0","Parameters (Billion)":"13"},"uses_additional_data":true},{"leaderboard":"/sota/arithmetic-reasoning-on-gsm8k","task":"Arithmetic Reasoning","dataset":"GSM8K","model":"MetaMath 7B","rank_in_archive_order":109,"of":164,"metrics":{"Accuracy":"66.4","Parameters (Billion)":"7"},"uses_additional_data":true},{"leaderboard":"/sota/math-word-problem-solving-on-math","task":"Math Word Problem Solving","dataset":"MATH","model":"MetaMath 70B","rank_in_archive_order":95,"of":135,"metrics":{"Accuracy":"26.0","Parameters (Billions)":"70"},"uses_additional_data":true},{"leaderboard":"/sota/math-word-problem-solving-on-math","task":"Math Word Problem Solving","dataset":"MATH","model":"MetaMath 13B","rank_in_archive_order":101,"of":135,"metrics":{"Accuracy":"22.5","Parameters (Billions)":"13"},"uses_additional_data":true},{"leaderboard":"/sota/math-word-problem-solving-on-math","task":"Math Word Problem Solving","dataset":"MATH","model":"MetaMath 7B","rank_in_archive_order":104,"of":135,"metrics":{"Accuracy":"19.4","Parameters (Billions)":"7"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.12284","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.12284"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/meta-math/MetaMath","reach":null}],"summary":{"ran_violates":1,"ran_draft_wrong":14,"unverified":7},"by_repo_kind":{"official":{"samples":22,"ran":15,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"0fe9cf6c00ef56ea","entry":"is_number","repo":"meta-math/MetaMath","repo_kind":"official","path":"eval_gsm8k.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/eval_gsm8k.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":2,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0fe9cf6c00ef56ea"}},{"code_sha256_prefix":"5e9ee828a2e2425b","entry":"_fix_a_slash_b","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5e9ee828a2e2425b"}},{"code_sha256_prefix":"3e4ba8b51b005d2b","entry":"_fix_fracs","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3e4ba8b51b005d2b"}},{"code_sha256_prefix":"4621fed7d175cce7","entry":"_fix_sqrt","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4621fed7d175cce7"}},{"code_sha256_prefix":"65bd3c41accc64eb","entry":"_remove_right_units","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"65bd3c41accc64eb"}},{"code_sha256_prefix":"c6aa3b84fc7a24e9","entry":"_strip_string","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c6aa3b84fc7a24e9"}},{"code_sha256_prefix":"66b3b5450182da3a","entry":"batch_data","repo":"meta-math/MetaMath","repo_kind":"official","path":"eval_gsm8k.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/eval_gsm8k.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"66b3b5450182da3a"}},{"code_sha256_prefix":"cdd294b5fa8c76de","entry":"create_response","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cdd294b5fa8c76de"}},{"code_sha256_prefix":"e56a1c38554053a2","entry":"create_response_chat","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e56a1c38554053a2"}},{"code_sha256_prefix":"b5bd259672545188","entry":"delete_extra_zero","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b5bd259672545188"}},{"code_sha256_prefix":"9429b9301289a950","entry":"extract_math_answer","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9429b9301289a950"}},{"code_sha256_prefix":"2e11d65849756456","entry":"get_answer_from_chat_model","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2e11d65849756456"}},{"code_sha256_prefix":"d07d04439cd1d44f","entry":"jload","repo":"meta-math/MetaMath","repo_kind":"official","path":"train_math.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/train_math.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d07d04439cd1d44f"}},{"code_sha256_prefix":"f3bbe264b05aadd3","entry":"remove_boxed","repo":"meta-math/MetaMath","repo_kind":"official","path":"eval_math.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/eval_math.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f3bbe264b05aadd3"}},{"code_sha256_prefix":"abda8b0048d01129","entry":"wrapper","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"abda8b0048d01129"}},{"code_sha256_prefix":"a596c25460663eb8","entry":"BackwardReasoning","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a596c25460663eb8"}},{"code_sha256_prefix":"71361dae629cb546","entry":"LogUtils","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"71361dae629cb546"}},{"code_sha256_prefix":"800ac3b48f19f794","entry":"PathUtils","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"800ac3b48f19f794"}},{"code_sha256_prefix":"c22739942cdfc7de","entry":"answer_cleansing","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c22739942cdfc7de"}},{"code_sha256_prefix":"1fde7ca5a428d3fc","entry":"batch_get_api","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1fde7ca5a428d3fc"}},{"code_sha256_prefix":"462b6fd895d0b3e3","entry":"batch_get_api_merge","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"462b6fd895d0b3e3"}},{"code_sha256_prefix":"220568f45521e253","entry":"batch_get_chat_api","repo":"meta-math/MetaMath","repo_kind":"official","path":"code_for_generating_data/code/main_backward_reasoning.py","file_url":"https://github.com/meta-math/MetaMath/blob/HEAD/code_for_generating_data/code/main_backward_reasoning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"220568f45521e253"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}