# MegaMath

- **ID:** 1157
- **Kind:** dataset
- **URL:** https://huggingface.co/datasets/IFM/MegaMath
- **Authors:** IFM
- **Published:** 2025
- **Source:** huggingface
- **Language:** en
- **Access:** Free
- **License:** ODC-By (HF card YAML odc-by). Also subject to Common Crawl Terms of Use. Code subset inherits Stack-V2 / per-file detected_licenses (preview MIT and no_license). Synthetic QA teacher terms (Llama-3.3 / Qwen-2.5) may still apply if used to train a distributed model.
- **License family:** Permissive (auto-classified)
- **Topics:** math pre-training; Common Crawl math web; math-related code; synthetic math QA / text-code blocks
- **Added:** 2026-08-14
- **Verified:** 2026-08-14
- **Page:** https://papers.projxon.ai/entries/1157

## Summary

Largest open English math pretrain corpus (paper: 371.6B tokens) for math-centric LLM pre-training

## From the source (fetched 2026-10-03)

- **Repository:** IFM/MegaMath (Hugging Face)
- **Created:** Mar 30, 2025 (Hugging Face)
- **Last updated:** Apr 9, 2025 (Hugging Face)
- **Downloads (last month):** 82,620 (Hugging Face)
- **Likes:** 134 (Hugging Face)
- **Size:** 100M to 1B rows (Hugging Face)
- **Modalities:** text (Hugging Face)
- **Tasks:** text-generation (Hugging Face)
- **Formats:** parquet (Hugging Face)

## Dataset profile

- **Scale:** Card table 215.1M samples / 371.6B tokens (mean 1,727.6 tok/sample). Breakdown (card, not extra overlapping n): Web Domain 121.5M / 279.0B (Web 106.5M / 263.9B; Web-Pro 15.0M / 15.1B); Code Domain 13.4M / 28.1B; Synthetic 80.2M / 64.5B (Translated Code 7.4M / 7.2B; Q&A 22.6M / 7.0B; Text&Code Block 50.2M / 50.3B). Hub/datasets-server default train 217,499,877 / usedStorage 1,118,247,802,657 bytes (~1.12 TB) / 5,314 parquet. YAML size_categories 1B<n<10B vs Hub tag 100M<n<1B — catalog card 215.1M / 371.6B tokens, not the 1B-row tag. LFS layout: megamath-web 4,950 parquet (99 CC dumps × 50); megamath-web-pro 100; megamath-code 16; megamath-qa 32 (16 llama-3.3 + 16 qwen-2.5); megamath-text-code-block 200; megamath-translated-code 16. Hub overview 72.8K downloads / 131 likes at check. gated=false.
- **Format:** parquet in six directories (megamath-web, megamath-web-pro, megamath-code, megamath-qa, megamath-text-code-block, megamath-translated-code). No YAML configs; Hub auto default concatenates 5,314 parquet. Code preview columns: file_info, repo_info. Web/QA schemas Unknown from the default first-rows (code schema).
- **Type:** Pretraining corpus / math web + math code + synthetic QA/text-code
- **License:** ODC-By (HF card YAML odc-by). Also subject to Common Crawl Terms of Use. Code subset inherits Stack-V2 / per-file detected_licenses (preview MIT and no_license). Synthetic QA teacher terms (Llama-3.3 / Qwen-2.5) may still apply if used to train a distributed model.
- **Cost:** Free
- **Languages:** English 100% (card language:en). Paper: fastText LID keep score ≥0.65 on CC WARCs. Code subset is source-code (preview Python) with English comments. No per-language percent table beyond the English filter. Per-language percents N/A.
- **Modality:** Text-only (English web/QA + source code). teasor.png is not extra n.
- **Domain:** math pre-training; Common Crawl math web; math-related code; synthetic math QA / text-code blocks
- **Time period:** Paper arXiv 2504.02807 (Hub publishedAt 2025-04-03T17:52:07Z; COLM 2025). HF createdAt 2025-03-30; lastModified 2025-04-09T13:17:50Z. Web from 99 Common Crawl snapshots CC-MAIN-2014-15 through CC-MAIN-2024-46. One-shot curation, not a live crawl.
- **Purpose:** Largest open English math pretrain corpus (paper: 371.6B tokens) for math-centric LLM pre-training
- **Used for:** Paper continued-pretrain of Llama-3.2-1B/3B (IFM/MegaMath-Llama-3.2-*). marin-community/marin-32b-base lists MegaMath among sources. Hub overview 72.8K downloads / 131 likes at check. Paper 35 upvotes / 6 linked models at paper-metadata check. GitHub LLM360/MegaMath 110 stars / 8 forks at check. Part of TxT360 (LLM360).
- **Authors:** LLM360 / IFM (Zhou, Wang, Ranjan, Cheng, Tang, He, Liu, Xing; arXiv 2504.02807). Web authors from Common Crawl math pages. Code recalled from Stack-V2 (public processed files here). Synthetic QA from Llama-3.3 and Qwen-2.5 (megamath-qa/llama-3.3 and qwen-2.5 shards). Not a human-annotated contest set.
- **Bias:** English CC math-web (fastText math classifier trained from Open-Web-Math positives + Llama-3.1-70B-Instruct silver labels) plus Stack-V2 math-code recall plus LLM-synthetic QA/code. Web-Pro is an LM-filtered/refined subset of Web — not extra n. Distinct from already-cataloged FineMath (HuggingFaceTB educational CC math, ~34B FineMath-3+ tokens) and OpenCoder FineWeb Math Corpus (5.2M FineWeb math recall). Code comes from Stack-V2 but this repo is a public processed dump — not Hub-gated bigcode/the-stack-v2 / HuggingFaceTB/stack-edu.
- **Text quality:** Paper: two-stage Resiliparse then trafilatura HTML math extraction (LaTeX preserved); MinHash-LSH dedup; second-stage fastText. Ablations claimed stronger downstream than OpenWebMath / InfiMM-WebMath-class baselines. Hub default first-rows are Stack-v2-style file_info/repo_info Python files (Navier-Stokes; Deep_Learning_With_Python) — code-subset schema, not web text. datasets-server rows endpoint 501 on default. Residual: CC boilerplate; synthetic QA teachers; code license mix including no_license; not independently re-extracted here. Skip open-web-math/open-web-math as a separate row (FineMath already cataloged as the stronger web successor); MegaMath is a larger web+code+synth mix.
- **Sample size:** Card 215.1M across six subsets (see Scale). Hub default train 217,499,877 is the auto-concat — catalog card 215.1M. Web-Pro is a quality subset of Web, not extra n. megamath-qa llama-3.3 vs qwen-2.5 are teacher shards inside Q&A 22.6M. No val/test. Do not add OctoThinker/MegaMath-Web-Pro-Max as extra n.
- **Long context:** Mixed (card avg 1,727.6 tok/sample; Web mean 2,478.7 / Code 2,102.7 / Q&A 308.3). Full web documents can be long. Exact token histogram Unknown without aggregating parquet.
- **Intermediate steps:** Yes (99 CC WARC re-extract with math HTML fixes; two-stage extractor + fastText math filter + MinHash; Web-Pro LM filter/refine; Stack-V2 math-code recall; synthetic QA / translated-code / interleaved text-code blocks). Code Apache-2.0 at github.com/LLM360/MegaMath.
- **Idea quality:** High
- **Novelty:** High (public 371.6B-token math pretrain vs already-cataloged FineMath / OpenCoder FineWeb Math)
- **Text conversion:** Ready parquet but Hub default concatenates mismatched schemas (~1.12 TB). Prefer load_dataset('IFM/MegaMath', data_dir='megamath-web-pro') or data_files per subset; streaming required. LLM360/MegaMath redirects to IFM/MegaMath — do not concat as extra n. datasets-server rows 501 on default.
- **Collection method:** Download
- **Static:** Unknown (HF lastModified 2025-04-09; CC window through 2024-46; one-shot).
- **Processed:** Unknown

## Links

- Dataset: https://huggingface.co/datasets/IFM/MegaMath
- Related: https://arxiv.org/abs/2504.02807
- Related: https://huggingface.co/papers/2504.02807
- Related: https://huggingface.co/datasets/IFM/MegaMath
- Related: https://huggingface.co/datasets/LLM360/MegaMath
- Related: https://github.com/LLM360/MegaMath
- Related: https://huggingface.co/IFM/MegaMath-Llama-3.2-1B
- Related: https://huggingface.co/IFM/MegaMath-Llama-3.2-3B

## Research notes

- Dump-adjacent public corpus (not in data-source-dump.jsonl). gated=false; public; CuratorBote listed README plus 5,314 LFS parquet (~1.12 TB usedStorage). LLM360/MegaMath redirects to IFM/MegaMath. Catalog card 215.1M / 371.6B tokens, not YAML size_categories 1B<n<10B. Cite Zhou et al. 2025 arXiv 2504.02807 (COLM 2025). Not in papers_local.csv. Not on the Aug 13 live Datasets sheet export. Substituted ahead of Hub-gated nvidia/Nemotron-CC-Math-v1 / HuggingFaceTB/stack-edu; skipped open-web-math/open-web-math (FineMath already cataloged) and DataMuncher-Labs/UltiMath (card vs YAML mismatch). Code subset is a public processed Stack-V2 recall, not a request for gated the-stack-v2.

## Related entries

- Related: [TxT360](https://papers.projxon.ai/entries/1164) (dataset, #1164)

## Similar entries

- [How Much Is an AI Token Worth? Scaling Laws for Wild AI-Generated Web Text](https://papers.projxon.ai/entries/835) (paper, #835)
- [UltraData-Code (OpenBMB L0–L3 tiered code pretrain: L2 algorithmic + L3 synthesis)](https://papers.projxon.ai/entries/1035) (dataset, #1035)
- [Open Markdown](https://papers.projxon.ai/entries/263) (dataset, #263)
- [OpenCoder FineWeb Math Corpus](https://papers.projxon.ai/entries/1152) (dataset, #1152)
- [Generalization Dynamics of LM Pre-training ("Discovering Mode-Hopping")](https://papers.projxon.ai/entries/820) (paper, #820)
- [DiffusionBlocks: Block-wise Neural Network Training via Diffusion Interpretation](https://papers.projxon.ai/entries/506) (paper, #506)
