arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.13472cs.CL
收藏

代码的缩放定律:每种编程语言都至关重要

Scaling Laws for Code: Every Programming Language Matters

Beihang University(北京航空航天大学);Ubiquant

Jian Yang, Shawn Guo, Lin Jing, Wei Zhang, Aishan Liu, Chuan Hao, Zhoujun Li, Wayne Xin Zhao, Xianglong Liu, Weifeng Lv, Bryan Dai

AI总结:

本文首次系统研究了多语言代码预训练的缩放定律,通过大规模实验揭示不同编程语言在模型大小和数据量上的差异影响,并提出比例依赖的多语言缩放定律以优化训练资源分配。

摘要:

代码大语言模型(Code LLMs)具有强大能力,但训练成本高昂,其性能可通过模型大小、数据和计算资源进行预测。然而,不同编程语言(PLs)在预训练过程中产生的影响差异显著,这会显著影响基础模型性能,导致性能预测不准确。此外,现有研究集中在语言无关的设置中,忽略了现代软件开发本质上是多语言的特性。因此,首先需要研究不同PLs的缩放定律,然后考虑它们之间的相互影响,以得出最终的多语言缩放定律。在本文中,我们首次系统地探讨了多语言代码预训练的缩放定律,进行了超过1000次实验(相当于336000次H800小时)的多PLs、模型大小(0.2B到14B参数)和数据集大小(1T tokens)的测试。我们建立了跨多种PLs的Code LLMs的全面缩放定律,揭示了解释性语言(如Python)比编译性语言(如Rust)更受益于模型大小和数据的增加。研究证明,多语言预训练提供了协同效益,特别是语法相似的PLs之间。此外,平行配对的预训练策略(将代码片段与其翻译拼接)显著增强了跨语言能力,具有有利的缩放特性。最后,提出了一种比例依赖的多语言缩放定律,以最优分配训练令牌,优先考虑高效用的PLs(如Python),平衡高协同对的PLs(如JavaScript-TypeScript),并减少对快速饱和语言(如Rust)的分配,从而在相同计算预算下,相较于均匀分配,所有PLs的平均性能均更优。

英文摘要:

Code large language models (Code LLMs) are powerful but costly to train, with scaling laws predicting performance from model size, data, and compute. However, different programming languages (PLs) have varying impacts during pre-training that significantly affect base model performance, leading to inaccurate performance prediction. Besides, existing works focus on language-agnostic settings, neglecting the inherently multilingual nature of modern software development. Therefore, it is first necessary to investigate the scaling laws of different PLs, and then consider their mutual influences to arrive at the final multilingual scaling law. In this paper, we present the first systematic exploration of scaling laws for multilingual code pre-training, conducting over 1000+ experiments (Equivalent to 336,000+ H800 hours) across multiple PLs, model sizes (0.2B to 14B parameters), and dataset sizes (1T tokens). We establish comprehensive scaling laws for code LLMs across multiple PLs, revealing that interpreted languages (e.g., Python) benefit more from increased model size and data than compiled languages (e.g., Rust). The study demonstrates that multilingual pre-training provides synergistic benefits, particularly between syntactically similar PLs. Further, the pre-training strategy of the parallel pairing (concatenating code snippets with their translations) significantly enhances cross-lingual abilities with favorable scaling properties. Finally, a proportion-dependent multilingual scaling law is proposed to optimally allocate training tokens by prioritizing high-utility PLs (e.g., Python), balancing high-synergy pairs (e.g., JavaScript-TypeScript), and reducing allocation to fast-saturating languages (Rust), achieving superior average performance across all PLs compared to uniform distribution under the same compute budget.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑