Ongoing research project for code&math LLMs
31
stars
78
commits
Python
primary language
Jul 4, 2025
updated
SwallowCode and SwallowMath are two high-quality, openly licensed datasets designed to enhance the performance of large language models (LLMs) in program synthesis and mathematical reasoning. Derived from public data under the Llama 3.3 Community License, these datasets address the limitations of existing pre-training corpora by applying rigorous filtering and LLM-driven rewriting to eliminate noise and improve educational value.
Datasets:
Paper: Rewriting Pre-Training Data Boosts LLM Performance in Math and Code
The performance of LLMs in specialized domains, such as coding and mathematics, is constrained by the quality of the pre-training data. SwallowCode and SwallowMath address this by transforming raw corpora into high-quality, curated datasets through advanced filtering and rewriting techniques. Our experiments demonstrate significant performance gains:
SwallowCode refines Python code from The-Stack-v2 through a four-stage pipeline, reducing the dataset from 41M to 24.1M samples while enhancing quality:
compile() function to remove invalid code, reducing samples by 9.7% (from 41M to 37M).
Caption: "Four-stage pipeline for SwallowCode: language filtering, syntax validation, linter filtering, and two-stage LLM rewriting (SGCR and SCOR)."
The job scripts for the SwallowCode pipeline are located in the scripts/code/ directory.
scripts/code/filter.sh:
compile()scripts/code/sgcr_python.sh:
scripts/code/scor_python.sh:
SwallowMath enhances FineMath-4+ through a tailored LLM rewriting pipeline using Llama-3.3-70B-Instruct:
Pipeline details, including prompts and scripts, are available in this repository.
The FineMath-4+ rewriting job script is located in the scripts/math/finemath-4+-rewrite-v1.sh file.
scripts/math/finemath-4+-rewrite-v1.sh:
We conducted extensive ablation experiments to evaluate each pipeline stage, detailed in the paper.
ablation/ directory of the SwallowCode dataset. Experiment 11 (SCOR) achieves the highest performance (HumanEval: 0.5396, HumanEval+: 0.5445 at 50B tokens).
Caption: "FineMath-4+ rewriting: boilerplate removal, context restoration, and explanation reformatting."
Evaluation results and model checkpoints are available in the SwallowCode and SwallowMath collections.
Both datasets are released under the Llama 3.3 Community License. Usage is subject to:
@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},
}
Python
82.9%
Shell
17.1%
Ongoing research project for code&math LLMs
31
stars
78
commits
Python
primary language
Jul 4, 2025
updated
SwallowCode and SwallowMath are two high-quality, openly licensed datasets designed to enhance the performance of large language models (LLMs) in program synthesis and mathematical reasoning. Derived from public data under the Llama 3.3 Community License, these datasets address the limitations of existing pre-training corpora by applying rigorous filtering and LLM-driven rewriting to eliminate noise and improve educational value.
Datasets:
Paper: Rewriting Pre-Training Data Boosts LLM Performance in Math and Code
The performance of LLMs in specialized domains, such as coding and mathematics, is constrained by the quality of the pre-training data. SwallowCode and SwallowMath address this by transforming raw corpora into high-quality, curated datasets through advanced filtering and rewriting techniques. Our experiments demonstrate significant performance gains:
SwallowCode refines Python code from The-Stack-v2 through a four-stage pipeline, reducing the dataset from 41M to 24.1M samples while enhancing quality:
compile() function to remove invalid code, reducing samples by 9.7% (from 41M to 37M).
Caption: "Four-stage pipeline for SwallowCode: language filtering, syntax validation, linter filtering, and two-stage LLM rewriting (SGCR and SCOR)."
The job scripts for the SwallowCode pipeline are located in the scripts/code/ directory.
scripts/code/filter.sh:
compile()scripts/code/sgcr_python.sh:
scripts/code/scor_python.sh:
SwallowMath enhances FineMath-4+ through a tailored LLM rewriting pipeline using Llama-3.3-70B-Instruct:
Pipeline details, including prompts and scripts, are available in this repository.
The FineMath-4+ rewriting job script is located in the scripts/math/finemath-4+-rewrite-v1.sh file.
scripts/math/finemath-4+-rewrite-v1.sh:
We conducted extensive ablation experiments to evaluate each pipeline stage, detailed in the paper.
ablation/ directory of the SwallowCode dataset. Experiment 11 (SCOR) achieves the highest performance (HumanEval: 0.5396, HumanEval+: 0.5445 at 50B tokens).
Caption: "FineMath-4+ rewriting: boilerplate removal, context restoration, and explanation reformatting."
Evaluation results and model checkpoints are available in the SwallowCode and SwallowMath collections.
Both datasets are released under the Llama 3.3 Community License. Usage is subject to:
@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},
}
Python
82.9%
Shell
17.1%