构建128GB科学代码数据集,评测大模型生成可靠科学代码的能力
SciCodePile: A 128GB Corpus and Executable Benchmark for Challenging Scientific Code Generation

- 从37737个开源仓库收集128GB科学代码,覆盖多学科领域
- 创建200个可执行测试任务,仅最强模型通过率12.30%
- 数据集支持持续预训练和指令微调,显著提升生成效果
大型语言模型在通用代码生成上表现优异,但在科学代码生成方面仍存未知。现有数据集与基准在规模、领域覆盖或可执行验证方面受限,难以准确评估当前模型与可靠科学代码生成器之间的差距。为此,我们提出SciCodePile,迄今最大的科学代码语料库,源自37,737个公共仓库,总计128GB,涵盖多个计算科学领域。基于此语料库,我们进一步构建了包含200个任务的可执行基准,每项任务配有沙盒执行环境和自动化测试工具。我们在三个任务上评估了15个来自开源与闭源家族的LLM:前缀到后缀补全、填空式重构和可执行代码生成。结果表明,科学代码生成仍极具挑战:最佳CodeBLEU仅为38.13和38.37,最强模型在可执行基准上的Pass@1仅为12.30%,凸显当前模型距离可靠科学代码生成仍有很大差距。为验证数据集的训练价值,我们进一步展示在该语料库上持续预训练可使科学代码补全的CodeBLEU提升2.84倍,指令微调则使可执行基准的Pass@1提升4.79倍。所有代码与数据已公开于https://huggingface.co/SciCodePile。
原文摘要 · Abstract (English)
Large language models (LLMs) excel at general-purpose code generation, yet how well they handle scientific code remains an open question. Existing datasets and benchmarks are limited in scale, domain coverage, or executable verification, leaving the true gap between current LLMs and reliable scientific code generators inadequately assessed. To address these limitations, we present SciCodePile, the largest scientific code corpus to date, constructed from 37,737 public repositories and collectively comprising 128GB of code that spans multiple computational science disciplines. From this corpus, we further curate an executable benchmark of 200 tasks, each equipped with a sandboxed execution environment and an automated test harness for functional verification. We evaluate 15 LLMs from both open-source and closed-source families on three tasks: prefix-to-suffix completion, fill-in-the-middle infilling, and executable code generation. Results show that scientific code generation remains highly challenging: The best CodeBLEU reaches only 38.13 and 38.37 on the two completion tasks, while the strongest model achieves just 12.30\% Pass@1 on the executable benchmark, underscoring how far current models remain from reliable scientific code generation. To demonstrate the training utility of SciCodePile, we further show that continued pretraining on our corpus improves CodeBLEU by $\times$2.84 on scientific code completion, and instruction tuning on our data improves Pass@1 by $\times$4.79 on the executable benchmark. All code and data are available at https://huggingface.co/SciCodePile.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。