license: odc-by
dataset_info:
- config_name: finemath-3plus
features:
- name: url
dtype: string
- name: fetch_time
dtype: int64
- name: content_mime_type
dtype: string
- name: warc_filename
dtype: string
- name: warc_record_offset
dtype: int32
- name: warc_record_length
dtype: int32
- name: text
dtype: string
- name: token_count
dtype: int32
- name: char_count
dtype: int32
- name: metadata
dtype: string
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: crawl
dtype: string
- name: snapshot_type
dtype: string
- name: language
dtype: string
- name: language_score
dtype: float64
splits:
- name: train
num_bytes: 137764105388.93857
num_examples: 21405610
download_size: 65039196945
dataset_size: 137764105388.93857
- config_name: finemath-4plus
features:
- name: url
dtype: string
- name: fetch_time
dtype: int64
- name: content_mime_type
dtype: string
- name: warc_filename
dtype: string
- name: warc_record_offset
dtype: int32
- name: warc_record_length
dtype: int32
- name: text
dtype: string
- name: token_count
dtype: int32
- name: char_count
dtype: int32
- name: metadata
dtype: string
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: crawl
dtype: string
- name: snapshot_type
dtype: string
- name: language
dtype: string
- name: language_score
dtype: float64
splits:
- name: train
num_bytes: 39101488149.09091
num_examples: 6699493
download_size: 18365184633
dataset_size: 39101488149.09091
- config_name: infiwebmath-3plus
features:
- name: url
dtype: string
- name: metadata
dtype: string
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: token_count
dtype: int64
- name: char_count
dtype: int64
- name: text
dtype: string
splits:
- name: train
num_bytes: 96485696853.10182
num_examples: 13882669
download_size: 46808660851
dataset_size: 96485696853.10182
- config_name: infiwebmath-4plus
features:
- name: url
dtype: string
- name: metadata
dtype: string
- name: score
dtype: float64
- name: int_score
dtype: int64
- name: token_count
dtype: int64
- name: char_count
dtype: int64
- name: text
dtype: string
splits:
- name: train
num_bytes: 40002719500.1551
num_examples: 6296212
download_size: 19234328998
dataset_size: 40002719500.1551
configs:
- config_name: finemath-3plus
data_files:
- split: train
path: finemath-3plus/train-*
- config_name: finemath-4plus
data_files:
- split: train
path: finemath-4plus/train-*
- config_name: infiwebmath-3plus
data_files:
- split: train
path: infiwebmath-3plus/train-*
- config_name: infiwebmath-4plus
data_files:
- split: train
path: infiwebmath-4plus/train-*
π FineMath
What is it?
π FineMath consists of 34B tokens (FineMath-3+) and 54B tokens (FineMath-3+ with InfiMM-WebMath-3+) of mathematical educational content filtered from CommonCrawl. To curate this dataset, we trained a mathematical content classifier using annotations generated by LLama-3.1-70B-Instruct. We used the classifier to retain only the most educational mathematics content, focusing on clear explanations and step-by-step problem solving rather than advanced academic papers.
The Dataset Curation section details the process for creating the dataset.
What is being released?
The dataset is released in two versions:
- FineMath-3+: 34B tokens, 21.4M documents containing mathematical reasoning and problem solving, formatted with Markdown and LaTeX.
- FineMath-4+ (a subset of FineMath-3+): 9.6B tokens, 6.7M documents of higher quality with detailed explanations. Models trained on this dataset perform better on GSM8k and MATH.
We also release a filtered English text-only portion of the InfiMM-WebMath-40B dataset, classified using the same approach as FineMath:
- InfiMM-WebMath-3+: 20.5B tokens, 13.9M documents.
- InfiMM-WebMath-4+ (a subset of InfiMM-WebMath-3+): 8.5B tokens, 6.3M documents.
How to load the dataset
Use one of the available configs: finemath-3plus
, finemath-4plus
, infiwebmath-3plus
, or infiwebmath-4plus
.
from datasets import load_dataset
# Load the high-quality subset
data = load_dataset("HuggingFaceTB/finemath", "finemath-4plus", split="train", num_proc=8)
# Or load the larger subset
data = load_dataset("HuggingFaceTB/finemath", "finemath-3plus", split="train", num_proc=8)
Dataset curation
Recent language models like DeepSeekMath and MathStral have demonstrated strong mathematical capabilities, trained on specialized datasets that aren't publicly available. We developed a pipeline to identify and extract high-quality mathematical content from CommonCrawl, with several iterations of refinement to improve quality.
Phase 1: Initial content extraction and classification
We began by re-extracting pages from CommonCrawl WARCs using URLs from the FineWeb dataset, collecting both the latest and largest versions of each page to capture the evolution of pages across the years. Unlike FineWeb which uses Trafilatura, we employed Resiliparse for text extraction as it better preserves forum discussions and QA answers that often contain crucial reasoning steps and solutions.
For initial quality assessment, we used Llama-3.1-70B-Instruct to generate annotations on a 3-point scale:
- Contains general mathematical content
- Shows logical reasoning in mathematical context
- Contains clear step-by-step solutions at appropriate level
A multilingual-e5-small
-based classifier finetuned on these annotations was used to score the initial corpus.
However, this first version performed below the OpenWebMath baseline, leading to several important refinements.
Phase 2: Recalling more candidate pages
Analysis revealed that FineWeb's C4 filter removes pages containing '{' characters, inadvertently filtering out content with LaTeX notation. To address this and expand coverage, we:
- Identified promising website domains by selecting those where at least 10% of pages received a classifier score β₯ 2
- Added URLs from OpenWebMath and InfiMM-WebMath datasets
- Recovered URLs of pages filtered by FineWeb's '{' rule from its rejection logs
- Re-extracted all content from scratch using the OpenWebMath pipeline, which properly handles mathematical notation across various HTML markup formats and standardizes them to LaTeX
Phase 3: Refined quality assessment
The expanded corpus underwent a more fine-grained quality evaluation:
Once again, we used LLama-3.1-70B-Instruct to score a sample of newly extracted pages on a 5-point scale (full prompt available in here): We finetuned a new classifier [TODO: link] on these annotations and scored the entire corpus. After leaving only pages with a score of 3 or higher, and deduplicating the samples using simple single-band MinHash-LSH, we obtained FineMath-3+ with 34B tokens.
The same classifier was applied to InfiMM-WebMath's text content, focusing more on reasoning rather than advanced mathematics.
Both datasets were additionally filtered using FineWeb's language classification pipeline to remove non-English content.
Decontamination
Following Qwen2.5-Math's approach, we removed samples with 13-gram overlaps against test sets from GSM8k, MATH, MMLU and ARC. Decontamination logs are available at HuggingFaceTB/finemath_contamination_report.
Results and Performance
Our evaluations show several key findings:
- FineMath-3+ outperforms the base InfiWebMath on GSM8k and MATH benchmarks
- FineMath-4+ demonstrates superior performance compared to both FineMath-3+ and InfiWebMath-4+ on GSM8k and MATH
- Combining the datasets (50% FineMath-3+ with 50% InfiWebMath-3+) yields approximately 50B tokens while matching the performance of InfiWebMath-3+
- Deduplicating the pages repeated between FineMath and InfiWebMath reduces performance compared to a non-deduplicated combination
Dataset Schema
{
'url': string, # Source page URL
'fetch_time': int64, # Crawler timestamp
'content_mime_type': string, # MIME type
'warc_filename': string, # Common Crawl WARC source file
'warc_record_offset': int32, # WARC record offset, in bytes
'warc_record_length': int32, # WARC record size, in bytes
'text': string, # Page content
'token_count': int32, # Number of Llama tokens
'char_count': int32, # Character count
'metadata': string, # Additional OpenWebMath metadata
'score': float64, # Raw quality score
'int_score': int64, # Integer quality score
'crawl': string, # Common Crawl crawl identifier
'snapshot_type': string, # Whether the page is the latest or the largest for this URL
'language': string, # Document language
'language_score': float64 # LangID probability
}
Considerations for Using the Data
Social Impact of Dataset
With the release of this dataset, we aim to make high-quality mathematical educational content more accessible to the machine learning community. While multiple language models have demonstrated strong mathematical capabilities, the datasets used to train these capabilities are often not publicly available. By releasing FineMath, we hope to:
- Make the dataset creation process more transparent
- Reduce the barrier to entry for training models with strong mathematical capabilities
- Provide a benchmark for mathematical content quality filtering
Discussion of Biases
The dataset may have certain inherent biases:
- Focus on English language content
- Emphasis on popular educational approaches to mathematics
- Bias towards certain types of mathematical notation and formatting
Other Known Limitations
- The dataset is limited to English language content
- The filtering criteria may not capture advanced mathematical content (e.g. advanced research subjects)
- Some mathematical notation (e.g. image-based) may not be preserved
- Long-form content may have varying quality even within high-scoring documents
Licensing Information
The dataset is released under the Open Data Commons Attribution License (ODC-By) v1.0 license. The use of this dataset is also subject to CommonCrawl's Terms of Use.
Future work
There are several avenues for future work:
- Expand language coverage beyond English
- Improve mathematical notation extraction and preservation
- Develop more sophisticated quality metrics
- Create specialized subsets for different educational levels