SciCodePile: A 128GB Corpus and Executable Benchmark for Challenging Scientific Code Generation

📄 arXiv: 2607.19104v1 📥 PDF

作者: Weifeng Sun, Ye Fan, Yuchen Chen, Gou Tan, Jieke Shi, Yuan Yidi, Swee Liang Wong, Jonathan Pan, David Lo

分类: cs.SE, cs.AI

发布日期: 2026-07-21

🔗 代码/项目: HUGGINGFACE


💡 一句话要点

提出SciCodePile以解决科学代码生成的挑战问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 科学代码生成 大型语言模型 数据集构建 基准测试 可执行验证 模型评估

📋 核心要点

  1. 现有的科学代码生成数据集和基准测试在规模和验证方面存在不足,未能准确评估LLMs的能力。
  2. 提出SciCodePile,构建了一个128GB的科学代码语料库,并设计了200个可执行任务的基准测试。
  3. 实验表明,继续在SciCodePile上进行预训练可将CodeBLEU提升至2.84倍,指令调优可将Pass@1提升至4.79倍。

📝 摘要(中文)

大型语言模型(LLMs)在通用代码生成方面表现优异,但它们在科学代码生成方面的能力仍然未知。现有的数据集和基准测试在规模、领域覆盖或可执行验证方面存在局限,未能充分评估当前LLMs与可靠科学代码生成器之间的真实差距。为了解决这些问题,本文提出了SciCodePile,这是迄今为止最大的科学代码语料库,来自37,737个公共代码库,包含128GB的跨多个计算科学学科的代码。此外,我们还从该语料库中策划了一个包含200个任务的可执行基准,每个任务配备了沙箱执行环境和自动化测试工具。实验结果显示,科学代码生成仍然非常具有挑战性,最佳的CodeBLEU仅达到38.13和38.37,而在可执行基准上,最强模型的Pass@1仅为12.30%。

🔬 方法详解

问题定义:本文旨在解决大型语言模型在科学代码生成中的不足,现有方法在数据集规模和可执行性验证方面存在显著缺陷。

核心思路:通过构建SciCodePile这一大规模科学代码语料库,提供丰富的训练数据,并设计可执行基准测试来评估模型性能。

技术框架:整体架构包括数据收集、语料库构建、基准测试设计和模型评估四个主要模块。首先,从公共代码库中收集代码,然后构建128GB的语料库,接着设计200个任务的基准测试,最后评估多种LLMs的性能。

关键创新:SciCodePile是首个大规模的科学代码语料库,结合了丰富的领域覆盖和可执行性验证,显著提升了科学代码生成的评估标准。

关键设计:在基准测试中,采用了沙箱执行环境和自动化测试工具,确保每个任务的功能验证,此外,模型评估采用了CodeBLEU和Pass@1等指标,提供了全面的性能评估。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,最佳模型在科学代码生成任务中的CodeBLEU仅为38.13和38.37,而在可执行基准测试中的Pass@1仅为12.30%。通过在SciCodePile上继续预训练,CodeBLEU提升了2.84倍,指令调优使Pass@1提升了4.79倍,显示出显著的性能改进。

🎯 应用场景

SciCodePile的构建为科学代码生成提供了重要的基础,潜在应用于科学研究、工程开发和教育等领域。通过提升LLMs在科学代码生成中的能力,能够加速科研进程和技术创新,具有重要的实际价值和未来影响。

📄 摘要(原文)

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.