SwallowMath is a high-quality mathematical dataset comprising approximately 2.3 billion tokens derived from the FineMath-4+ dataset through an LLM-driven rewriting pipeline. Using Llama-3.3-70B-Instruct, we transform the original dataset by removing boilerplate, restoring missing context, and reformatting solutions into concise, step-by-step explanations. The pipeline prioritizes educational clarity and mathematical reasoning, making SwallowMath ideal for training large language models (LLMs) for mathematical tasks.
More details are available in our paper: https://arxiv.org/abs/2505.02881.
The dataset is released as:
SwallowMath: Approximately 2.3 billion tokens, derived from FineMath-4+ (9.6 billion tokens, 6.7M documents), containing rewritten mathematical content with concise, step-by-step explanations formatted in Markdown and LaTeX. All data is publicly available under the Llama 3.3 Community License.
SwallowMath builds on FineMath-4+, a high-quality subset of mathematical content filtered from CommonCrawl. We enhance this dataset through an LLM-driven rewriting pipeline tailored for mathematical reasoning, addressing limitations such as boilerplate, missing context, and verbose explanations.
Using Llama-3.3-70B-Instruct, the pipeline performs the following steps:
The full rewriting prompt is available at https://github.com/rioyokotalab/swallow-code-math.
Continual pre-training of Llama-3.1-8B for approximately 50 billion tokens, substituting FineMath-4+ with SwallowMath in the math subset (4.79% of the mixture), yields significant improvements:
SwallowMath aims to democratize access to high-quality mathematical training data, fostering advancements in LLM mathematical reasoning. By releasing an openly licensed dataset, we:
The dataset may inherit biases from FineMath-4+, including:
SwallowMath is released under the Llama 3.3 Community License. Usage is also subject to CommonCrawl's Terms of Use.
Potential directions include:
@misc{fujii2025rewritingpretrainingdataboosts,
title={Rewriting Pre-Training Data Boosts LLM Performance in Math and Code},
author={Kazuki Fujii and Yukito Tajima and Sakae Mizuki and Hinari Shimada and Taihei Shiotani and Koshiro Saito and Masanari Ohi and Masaki Kawamura and Taishi Nakamura and Takumi Okamoto and Shigeki Ishida and Kakeru Hattori and Youmi Ma and Hiroya Takamura and Rio Yokota and Naoaki Okazaki},
year={2025},
eprint={2505.02881},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2505.02881},
}
19 commits
SwallowMath is a high-quality mathematical dataset comprising approximately 2.3 billion tokens derived from the FineMath-4+ dataset through an LLM-driven rewriting pipeline. Using Llama-3.3-70B-Instruct, we transform the original dataset by removing boilerplate, restoring missing context, and reformatting solutions into concise, step-by-step explanations. The pipeline prioritizes educational clarity and mathematical reasoning, making SwallowMath ideal for training large language models (LLMs) for mathematical tasks.
More details are available in our paper: https://arxiv.org/abs/2505.02881.
The dataset is released as:
SwallowMath: Approximately 2.3 billion tokens, derived from FineMath-4+ (9.6 billion tokens, 6.7M documents), containing rewritten mathematical content with concise, step-by-step explanations formatted in Markdown and LaTeX. All data is publicly available under the Llama 3.3 Community License.
SwallowMath builds on FineMath-4+, a high-quality subset of mathematical content filtered from CommonCrawl. We enhance this dataset through an LLM-driven rewriting pipeline tailored for mathematical reasoning, addressing limitations such as boilerplate, missing context, and verbose explanations.
Using Llama-3.3-70B-Instruct, the pipeline performs the following steps:
The full rewriting prompt is available at https://github.com/rioyokotalab/swallow-code-math.
Continual pre-training of Llama-3.1-8B for approximately 50 billion tokens, substituting FineMath-4+ with SwallowMath in the math subset (4.79% of the mixture), yields significant improvements:
SwallowMath aims to democratize access to high-quality mathematical training data, fostering advancements in LLM mathematical reasoning. By releasing an openly licensed dataset, we:
The dataset may inherit biases from FineMath-4+, including:
SwallowMath is released under the Llama 3.3 Community License. Usage is also subject to CommonCrawl's Terms of Use.
Potential directions include:
@misc{fujii2025rewritingpretrainingdataboosts,
title={Rewriting Pre-Training Data Boosts LLM Performance in Math and Code},
author={Kazuki Fujii and Yukito Tajima and Sakae Mizuki and Hinari Shimada and Taihei Shiotani and Koshiro Saito and Masanari Ohi and Masaki Kawamura and Taishi Nakamura and Takumi Okamoto and Shigeki Ishida and Kakeru Hattori and Youmi Ma and Hiroya Takamura and Rio Yokota and Naoaki Okazaki},
year={2025},
eprint={2505.02881},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2505.02881},
}
19 commits