MegaMath: Pushing the Limits of Open Math Corpora

Fan Zhou, Zengzhi Wang, Nikhil Ranjan, Zhoujun Cheng, Liping Tang +3 more
4/3/2025
cs.CLcs.AIcs.LG

No official code found. Best implementation: LLM360/MegaMath (110 stars, Apache-2.0, last commit 2025-04-04).

Abstract

Mathematical reasoning is a cornerstone of human intelligence and a key benchmark for advanced capabilities in large language models (LLMs). However, the research community still lacks an open, large-scale, high-quality corpus tailored to the demands of math-centric LLM pre-training. We present MegaMath, an open dataset curated from diverse, math-focused sources through following practices: (1) Revisiting web data: We re-extracted mathematical documents from Common Crawl with math-oriented HTML optimizations, fasttext-based filtering and deduplication, all for acquiring higher-quality data on the Internet. (2) Recalling Math-related code data: We identified high quality math-related code from large code training corpus, Stack-V2, further enhancing data diversity. (3) Exploring Synthetic data: We synthesized QA-style text, math-related code, and interleaved text-code blocks from web data or code data. By integrating these strategies and validating their effectiveness through extensive ablations, MegaMath delivers 371B tokens with the largest quantity and top quality among existing open math pre-training datasets.

View on arXivView PDF

Code Implementations(1)

LLM360/MegaMathCommunity100%
Apache-2.0

[COLM 2025] An Open Math Pre-trainng Dataset with 370B Tokens.

1108XSLT, ShellApr 3, 20251 years agoApache-2.0

Similar Papers

Cite this paper

@article{zhou2025megamath,
  title  = {MegaMath: Pushing the Limits of Open Math Corpora},
  author = {Fan Zhou and Zengzhi Wang and Nikhil Ranjan and Zhoujun Cheng and Liping Tang and Guowei He and Zhengzhong Liu and Eric P. Xing},
  year   = {2025},
  eprint = {2504.02807},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.02807v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.02807.svg)](https://codeofpaper.com/paper/2504.02807)

Discussion