SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2504.02807 · 2025

MegaMath: Pushing the Limits of Open Math Corpora

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2504.02807.json · badge: /api/ran/2504.02807.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
llm360/megamath canonical (classifier label)
classifier basis not recorded on the link
6 ran · 1 no recorded run
FunctionStatusWhere it lives
get_list Ran
ran on a synthesized input
llm360/megamath/web_pipeline/url_filtering/url_filter.py
code served (permissive licence) · get_code("fe4e4053c2acea4a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import re
import tempfile

normalizer = re.compile('[^a-zA-Z0-9]+')

def normalize(text, replace=''):
    return normalizer.sub(replace, text).lower()

def parse_list(line, do_normalize=True):
    return {normalize(x) if do_normalize else x.strip() for x in line if x[0] != '#'}

def get_list(abs_path: str, file_name: str, extra: set, do_normalize: bool=True):
    with open(os.path.join(abs_path, file_name)) as f:
        return parse_list(f, do_normalize).union(extra)

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_list.txt")

# Write test content to file
with open(test_file, 'w') as f:
    f.write("apple\n")
    f.write("banana-split\n")
    f.write("# this is a comment\n")
    f.write("cherry_pie\n")

# Define arguments for get_list
ARGS = {
    'abs_path': temp_dir,
    'file_name': 'test_list.txt',
    'extra': {'grape', 'orange'},
    'do_normalize': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
html_table_to_markdown Ran
ran on a synthesized input
llm360/megamath/web_pipeline/stage1_download_and_extract.py
code served (permissive licence) · get_code("2c9e6858b942d667")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

ARGS = {
    'headers': ['Name', 'Age', 'City'],
    'rows': [
        ['Alice', '30', 'New York'],
        ['Bob', '25', 'Los Angeles'],
        ['', '', ''],
        ['Charlie', '35', 'Chicago\nIllinois'],
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalization Ran
ran on a synthesized input
llm360/megamath/web_pipeline/utils/math_fasttext.py
code served (permissive licence) · get_code("94cea2fe405ab4af")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
from nltk.tokenize import wordpunct_tokenize

ARGS = {
    "text": "Hello world! This is a test. 123 test_case with some-dashes and special@characters#here. Numbers: 456 and text with very long token thatisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongandshouldnotbeincluded."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize Ran
ran on a synthesized input
llm360/megamath/web_pipeline/url_filtering/url_filter.py
code served (permissive licence) · get_code("a1a69da5e49cc696")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

normalizer = re.compile('[^a-zA-Z0-9]+')

def normalize(text, replace=''):
    return normalizer.sub(replace, text).lower()

# The function takes a text string and an optional replace parameter
# It removes non-alphanumeric characters and converts to lowercase

ARGS = {
    'text': 'Hello, World! 123 @#$%',
    'replace': ''
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_list Ran
ran on a synthesized input
llm360/megamath/web_pipeline/url_filtering/url_filter.py
code served (permissive licence) · get_code("32e16941520dc46f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

normalizer = re.compile('[^a-zA-Z0-9]+')

def normalize(text, replace=''):
    return normalizer.sub(replace, text).lower()

def parse_list(line, do_normalize=True):
    return {normalize(x) if do_normalize else x.strip() for x in line if x[0] != '#'}

# Setup code
line = ['hello world', 'foo#bar', 'test-123', '#comment', 'another_item']
do_normalize = True

ARGS = {
    'line': line,
    'do_normalize': do_normalize
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
preprocess_for_fasttext Ran
ran on a synthesized input
llm360/megamath/web_pipeline/utils/math_fasttext.py
code served (permissive licence) · get_code("9d1f40638d5bc810")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import unicodedata
from nltk.tokenize import wordpunct_tokenize

def normalization(text):
    tokens = wordpunct_tokenize(text)
    processed_tokens = []
    for token in tokens:
        token = token.lower()
        if token.isdigit():
            processed_tokens.append('<NUM>')
        elif len(token) <= 100:
            processed_tokens.append(token)
    preprocessed_text = ' '.join(processed_tokens)
    preprocessed_text = re.sub('[\\n\\r]+', ' ', preprocessed_text)
    preprocessed_text = re.sub('[-_]+', ' ', preprocessed_text)
    preprocessed_text = re.sub('[^a-zA-Z0-9\\s<NUM>]', '', preprocessed_text)
    preprocessed_text = re.sub('\\s+', ' ', preprocessed_text).strip()
    return preprocessed_text

def preprocess_for_fasttext(text):
    if isinstance(text, bytes):
        text = text.decode('utf-8')
    text = unicodedata.normalize('NFKC', text)
    text = re.sub('\\s', ' ', text)
    text = text.replace('\n', ' <EOS> ')
    text = re.sub('\\s+', ' ', text)
    text = normalization(text)
    MAX_LINE_SIZE = 1024
    lines = text.split('<EOS>')
    processed_lines = []
    for line in lines:
        tokens = line.split()
        if len(tokens) > MAX_LINE_SIZE:
            processed_lines.extend([' '.join(tokens[i:i + MAX_LINE_SIZE]) for i in range(0, len(tokens), MAX_LINE_SIZE)])
        else:
            processed_lines.append(line)
    text = ' <EOS> '.join(processed_lines)
    return text.strip()

ARGS = {
    "text": "Hello world 123 test\nMultiple lines here with some punctuation! And numbers 456."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
download_from_cc Not yet run
unverified (harvested, no recorded run)
llm360/megamath/web_pipeline/utils/file_utils.py
code served (permissive licence) · get_code("9acbf779ceefa16c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2504.02807")
get_code_for_paper("2504.02807")
have("2504.02807")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2504.02807.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2504.02807.svg)](https://syntology.ai/paper/2504.02807)

Connect an agent — have() is free.