SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.17120 · NeurIPS · 2023

MATHPILE : A Billion-Token-Scale Pre-training Corpus for Math

Pengfei Liu, Zengzhi Wang, Xuefeng Li, Rui Xia

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2312.17120.json · badge: /api/ran/2312.17120.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
GAIR-NLP/MathPile canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
gair-nlp/mathpile canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
contains_lorem_ipsum Ran
ran, violated the contract we drafted
GAIR-NLP/MathPile/src/global_data_processing/filtering/filtering.py
code served (permissive licence) · get_code("7f4b7b76cf10ce84")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

def contains_lorem_ipsum(content):
    normalized_content = content.lower()
    return 'lorem ipsum' in normalized_content

# The function takes a single parameter 'content' which should be a string
# It converts it to lowercase and checks if 'lorem ipsum' is present

ARGS = {
    'content': 'Lorem Ipsum dolor sit amet'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
convert_file_type_to_extension Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/preprocessing/arXiv/copy_to_merge_math_tex_data.py
code served (permissive licence) · get_code("629a0c060c52153c")
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

# This function takes a file_type string parameter and returns a file extension
# based on patterns in the file_type string.

# Looking at the function body:
# - It checks if 'gzip compressed data' is in file_type
# - It checks if '.tex' is in file_type
# - It checks if '.tar' is in file_type
# - It checks if 'PDF document' is in file_type
# - It checks if 'latex' is in file_type.lower()
# - It returns strings or None

# The parameter is a string, so we need to provide valid file_type strings

ARGS = {
    'file_type': 'gzip compressed data, from file: archive.tar.gz'
}
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
count_char Ran
ran, honoured the contract we drafted
gair-nlp/mathpile/src/preprocessing/arXiv/processing_tex_at_scale.py
code served (permissive licence) · get_code("b15edd651b375141")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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.

ARGS = {
    "string": "hello world",
    "char": "o"
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
count_sentences Ran
ran, honoured the contract we drafted
GAIR-NLP/MathPile/src/global_data_processing/filtering/filtering.py
code served (permissive licence) · get_code("f1a635ded00c11d8")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

def count_sentences(content):
    sentences = re.findall('\\b[^.!?]+[.!?]*', content)
    return len(sentences)

# Setup code
content = "Hello world. This is a test! How are you? I am fine."

ARGS = {
    "content": content
}
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 int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
filter_lorem_ipsum Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/global_data_processing/filtering/filtering.py
code served (permissive licence) · get_code("338e8f82ff616aa5")
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

# Analyze the function filter_lorem_ipsum
# It takes one parameter: content (a string)
# The function:
# - calls content.lower()
# - calls content.split('\n')
# - iterates through lines
# - checks if 'lorem ipsum' is in lines
# - does string operations like replace, len, join
# So content must be a string

# Create test content that contains 'lorem ipsum'
content = """This is a test document.
Lorem ipsum dolor sit amet.
Some other content here.
lorem ipsum is here too.
x
Another line without the phrase."""

ARGS = {
    "content": content
}
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
load_data_from_jsonl Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/global_data_processing/utils.py
code served (permissive licence) · get_code("e2fc4d7da17d9ff4")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 json
import tempfile
import os

# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
jsonl_file_path = os.path.join(temp_dir, "test_data.jsonl")

# Write test data to the JSONL file
test_data = [
    {"id": 1, "text": "hello world", "value": 42},
    {"id": 2, "text": "foo bar", "value": 99},
    {"id": 3, "text": "test data", "value": 7}
]

with open(jsonl_file_path, 'w') as f:
    for item in test_data:
        f.write(json.dumps(item) + '\n')

ARGS = {
    "jsonl_file_name": jsonl_file_path
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
obtain_language_detection_probs Ran
ran, honoured the contract we drafted
GAIR-NLP/MathPile/src/global_data_processing/language-identification/fasttext_id.py
code served (permissive licence) · get_code("f360e77521c0e511")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn as nn


class MockLanguageDetectionModel(nn.Module):
    """Mock model that mimics fastText language detection behavior"""
    
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 10)
    
    def predict(self, text, k=10):
        """
        Mimics fastText predict method.
        Returns lang_labels and lang_probs
        """
        # Simulate returning language labels with __label__ prefix and probabilities
        lang_labels = [
            '__label__eng_Latn',
            '__label__fra_Latn',
            '__label__deu_Latn',
            '__label__spa_Latn',
            '__label__por_Latn',
            '__label__ita_Latn',
            '__label__nld_Latn',
            '__label__pol_Latn',
            '__label__rus_Cyrl',
            '__label__jpn_Jpan'
        ][:k]
        
        # Simulate probabilities that sum to approximately 1
        lang_probs = [0.95, 0.03, 0.01, 0.005, 0.003, 0.002, 0.001, 0.0005, 0.0003, 0.0002][:k]
        
        return lang_labels, lang_probs


# Create mock model
model = MockLanguageDetectionModel()

# Sample text with newlines
text = "This is a sample English text.\nIt has multiple lines."

ARGS = {
    'model': model,
    'text': text,
    'return_only_english': True,
    'model_path': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
read_file Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/global_data_processing/utils.py
code served (permissive licence) · get_code("b40e45d2f17838f2")
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 tempfile
import os

# Create a temporary file with some content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("Hello, this is test content for the read_file function.")
temp_file.close()

# Define arguments for read_file
ARGS = {
    'path': temp_file.name
}
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
read_pickle_file Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/global_data_processing/utils.py
code served (permissive licence) · get_code("8f55e3ae760c0bfc")
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 dict. 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 pickle
import tempfile
import os

# Create a temporary file and write some pickle data to it
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.pkl")

# Create sample data to pickle
sample_data = {
    "key1": [1, 2, 3],
    "key2": "test_string",
    "key3": {"nested": True}
}

# Write the data to the pickle file
with open(temp_file, 'wb') as f:
    pickle.dump(sample_data, f)

# Define ARGS with the file path
ARGS = {
    "file_path": temp_file
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
split_large_file Ran
ran; our contract draft was wrong, not the code
GAIR-NLP/MathPile/src/global_data_processing/filtering/utils.py
code served (permissive licence) · get_code("bf5aeddf512b9720")
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 list. 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 json
import tempfile
import os

# Create a temporary JSONL file for testing
temp_dir = tempfile.mkdtemp()
jsonl_file_path = os.path.join(temp_dir, "test_data.jsonl")

# Write sample JSONL data
sample_data = [
    {"id": 1, "text": "hello world"},
    {"id": 2, "text": "foo bar"},
    {"id": 3, "text": "baz qux"},
    {"id": 4, "text": "example data"},
    {"id": 5, "text": "more examples"},
]

with open(jsonl_file_path, 'w') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

# Define ARGS
ARGS = {
    "file_path": jsonl_file_path,
    "chunk_size": 2
}
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 list — a list output has no array shape of its own; none is 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
obtain_file_type Not yet run
unverified (harvested, no recorded run)
GAIR-NLP/MathPile/src/preprocessing/arXiv/copy_to_merge_math_tex_data.py
code served (permissive licence) · get_code("c711156b147a6c28")
How it ran

no invocation recorded.

obtain_file_type Not yet run
unverified (harvested, no recorded run)
GAIR-NLP/MathPile/src/preprocessing/arXiv/file_type_rename_and_move.py
code served (permissive licence) · get_code("fda91082fd4c0134")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 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 12 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-24.

Repositories linked to this paper

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

Abstract

High-quality, large-scale corpora are the cornerstone of building foundation models. In this work, we introduce MATHPILE , a diverse and high-quality math-centric corpus comprising about 9.5 billion tokens. Throughout its creation, we adhered to the principle of "less is more", firmly believing in the supremacy of data quality over quantity, even in the pre-training phase. Our meticulous data collection and processing efforts included a complex suite of preprocessing, prefiltering, language identification, cleaning, filtering, and deduplication, ensuring the high quality of our corpus. Furthermore, we performed data contamination detection on downstream benchmark test sets to eliminate duplicates and conducted continual pre-training experiments, booting the performance on common mathematical reasoning benchmarks. We aim for our MATHPILE to boost language models' mathematical reasoning abilities and open-source its different versions and processing scripts to advance the field (available at https://github.com/GAIR-NLP/MathPile/).

For agents

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

get_harvested_code_for_paper("2312.17120")
get_code_for_paper("2312.17120")
have("2312.17120")

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

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

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

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

Connect an agent — have() is free.