← All entries
Dataset2025#1157

MegaMath

Summary

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

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
Language
en
Added
Aug 14, 2026
Verified
Aug 14, 2026

From the source

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

Fetched Oct 3, 2026 from Hugging Face. These numbers change; the curated fields above do not come from here.

Topics

math pre-training; Common Crawl math web; math-related code; synthetic math QA / text-code blocks

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

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

  • Datasetresearch profile2024added Aug 14, 202624,086 downloads/moshares a link

    TxT360

    IFM

    Largest high-quality open pretrain blend (card ~5T globally deduped tokens; 15T+ with the working mix recipe) with per-source weights and duplicate-count buckets

Similar entries