Source-linked AI summary

Scaling Laws for Code: Every Programming Language Matters

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

arXiv:2512.13472v1cs.CL

TL;DR

Scaling laws for code pre-training have not addressed the multilingual nature of software development, despite the high cost of training and studying code LLMs. The paper conducts a systematic empirical study of multilingual scaling and finds that allocating tokens according to language utility and synergy improves average performance over uniform allocation under the same compute budget.

  • Problem

    Code LLM training is costly, and existing scaling-law work focuses on monolingual or language-agnostic settings despite multilingual software development.

    Source: §1 · pp. 1–2
  • Method

    The authors conduct a systematic study of multilingual code pre-training through over 1000 experiments across languages, model sizes, and dataset configurations.

    Source: §1 · p. 2, §2.2 · p. 4
  • Results

    Optimized token allocation achieves higher average performance across programming languages than uniform allocation under identical compute budgets, without significant degradation in any single language.

    Source: §1 · p. 3
  • Takeaways & Limitations

    The reported allocation favors high-utility languages, balances high-synergy pairs, and reduces tokens for fast-saturating languages.

    Source: §1 · p. 3

    The experiments cover seven programming languages and models up to 14B parameters, so findings at extreme scales and for low-resource or domain-specific languages remain unvalidated.

    Source: Limitations · p. 14

Abstract

from arXiv · show

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.

1. Introduction

Code LLM training is costly, while programming-language diversity and cross-lingual effects remain insufficiently represented in scaling-law research. The paper studies multilingual code pre-training and reports language-specific scaling behavior, pairing benefits, and a multilingual scaling law that outperforms an equal-weighted baseline.

1. Introduction

  • Training top-tier code LLMs consumes substantial compute, making large-scale ablations of language proportions and pre-training strategies prohibitively expensive.This cost barrier limits systematic understanding of factors driving code LLM performance and efficient training methods.Source: §1 · p. 1
  • The multilingual scaling law achieves consistently lower evaluation loss than the equal-weighted baseline across model sizes and token budgets.The study comprises over 1000 experiments across multiple programming languages, models from 0.2B to 14B parameters, and dataset sizes up to 1T tokens.Source: Figure 1 · p. 2, §1 · p. 2
  • Existing scaling-law research focuses on monolingual or language-agnostic settings, although modern software development and code repositories are multilingual.The passage identifies cross-lingual transfer and differences in syntax, semantics, and data availability as reasons to study multilingual scaling.Source: §1 · p. 2
  • The study examines language-specific scaling, multilingual transfer, code-translation scaling, and language-proportion allocation as factors in multilingual pre-training.Its contributions include language-specific scaling laws and a proportion-dependent multilingual law that allocates tokens according to language utility and pairwise synergy.Source: §1 · pp. 2–3

2. Scaling Laws for Code Pre-training

The section introduces scaling laws as a way to relate code-model loss to model size, training data, and compute, then frames multilingual pre-training as an empirical problem. It asks how languages scale individually and how language mixtures and data organization affect cross-lingual transfer.

2.1. ChinChilla Scaling Law for Code

  • A scaling law characterizes validation loss as a function of model parameters, dataset tokens, and compute, using power-law exponents and an irreducible-loss term.The passage defines N as parameter count, D as dataset token count, C as FLOPs, and L∞ as the irreducible loss.Source: §2.1 · p. 3

2.2. Motivation and Formulation

  • The section asks whether programming languages differ in scaling exponents and irreducible losses, challenging uniform treatment of languages during pre-training.The motivation highlights a clear intrinsic-predictability ordering across languages: C# < Java ≈Rust < Go < TypeScript < JavaScript < Python.Source: §2.2 · p. 3, Figure 2 · p. 4
  • It also asks whether bilingual mixtures yield positive transfer or interference, and whether supervised language-pair training supports transfer to unseen pairs.The latter question contrasts randomized data organization with supervised pair training and asks about zero-shot transfer without direct parallel data.Source: §2.2 · p. 4
  • The authors use over 1000 training runs across model scales from 0.2B to 14B parameters and data volumes up to 1T tokens to investigate these questions.The experiments aim to isolate variables while controlling for confounds and derive empirical scaling laws for multilingual code pre-training.Source: §2.2 · p. 4

3. Language-specific Scaling Law

The section establishes language-specific scaling laws and reports substantial differences in how programming languages respond to model size and training data. It also compares their convergence and intrinsic predictability, using experiments that vary model sizes and token budgets across seven languages.

3. Language-specific Scaling Law

  • Across programming languages, increasing data size yields greater performance gains than increasing model size, while languages differ in convergence rates and training difficulty.These are the section's stated takeaways about language-specific scaling behavior.Source: §3 · p. 4

3.1. Experimental Setting

  • The study trains 420 models across seven languages, varying ten model sizes and six token budgets to estimate language-specific scaling laws.The selected languages are Python, Java, JavaScript, TypeScript, C#, Go, and Rust; models share the same architecture for cross-language comparison.Source: §3.1 · p. 5, §3.2 · p. 5

3.2. Language-Specific Scaling Laws

  • Interpreted languages such as Python have larger scaling exponents than compiled languages such as Rust, benefiting more from increases in model size and training data.Python has the highest reported αN and αD values, while Rust has notably smaller exponents; optimal N:D ratios also vary by language.Source: §3.2 · p. 5
  • Intrinsic predictability follows C# < Java ≈Rust < Go < TypeScript < JavaScript < Python, based on irreducible loss L∞.The passage relates lower irreducible loss to greater predictability and identifies C# as the lowest and Python as the highest in this ordering.Source: §3.2 · p. 5

4. Language Mixture for Data Scarcity

This section measures bilingual transfer by comparing mixed-language pretraining with target-language self-repetition under a fixed token budget. It finds language-specific gains and interference, so the best mixture depends on the target and language pair.

4. Language Mixture for Data Scarcity

  • Across programming languages, increasing data size yields greater performance gains than increasing model size, and languages differ in convergence rates and training difficulty.These takeaways summarize the section’s language-specific scaling findings.Source: §4 · p. 6

4.1. Experimental Setting

  • The experiment compares 128B-token target-language self-repetition with a 64B-target plus 64B-auxiliary mixture, evaluating validation loss in the target language.Synergy gain is defined as the difference between the mixed-training and self-repetition validation losses; positive values indicate improvement from mixing.Source: §4.1 · p. 6

4.2. Bilingual Mixture Effects

  • Six of seven languages show positive synergy across auxiliary-language combinations, with Java-C# yielding the largest gain (Δ = 0.186).Table 1 reports the synergy gain matrix.Source: §4.2 · p. 6, Table 1 · p. 7
  • Java-C# reaches validation loss 0.718 versus 0.903 for Java self-repetition, a 20.5% improvement.JavaScript-TypeScript mixing also beats self-repetition: 0.517 vs 0.542; the reverse target-language pairing gives 0.517 vs 0.535.Source: §4.2 · p. 7
  • Python as a target has small negative synergy with most auxiliary languages, while Python as an auxiliary language benefits targets such as Java (Δ = 0.054).The negative effects include JavaScript (Δ = −0.009) and Rust (Δ = −0.021); Java is the exception, with Python-target synergy Δ = 0.010.Source: §4.2 · p. 7
  • With limited tokens, the authors recommend mixing syntactically related languages rather than simply upsampling one language; the optimal mixing ratio remains open.The experiments use 50:50 mixtures, while asymmetric ratios are left for investigation.Source: §4.2 · p. 7

5. Cross-Lingual Scaling Laws

This section tests how pre-training strategies affect translation across seen and unseen language directions, and fits scaling laws for translation loss. It finds benefits from parallel pairing for translation and multilingual code generation.

5.1. Experimental Setting

  • The study trains on 900B algorithmically equivalent code tokens across seven PLs plus 100B FineWeb-Edu tokens, then evaluates 2,100 instances over 42 translation directions.Python is the pivot language, with direct non-Python pairs absent from training.Source: §5.1 · p. 8

5.2. Pre-training on Unsupervised Multilingual Data

  • Unsupervised multilingual pre-training yields emergent cross-lingual capability as model size increases, despite no direct alignment between language pairs.The reported zero-shot scaling parameters are A_z=0.1574, B_z=9.553, α_z=0.3470, β_z=0.8829, and L∞,z=0.1236.Source: §5.2 · p. 9

5.3. Pre-training on Supervised Multilingual Data

  • For explicitly aligned Python–other pairs, concatenating code with its translation provides document-level alignment and supports efficient use of model capacity.The authors attribute this efficiency to the high scaling exponent α_a.Source: §5.3 · p. 9
  • Document-level pairing also improves zero-shot translation between non-Python PLs, with the authors suggesting Python acts as an implicit bridge.Examples include Java↔Go and Rust↔JavaScript, although those pairs have no direct training alignments.Source: §5.3 · p. 9
  • Parallel pairing yields superior fitted scaling on seen and unseen translation directions and better MultiPL-E generation than the baseline.Table 2 summarizes the scaling comparison; Table 3 evaluates multilingual code generation.Source: §5.3 · p. 10, Table 3 · p. 10, §5.4 · p. 10

5.4. Cross-Lingual Translation Strategies

  • Parallel pairing improves translation on seen directions; on 30 unseen non-Python pairs, parallel-PL training also beats the baseline.The section fits power laws to seen and unseen validation loss; higher α indicates greater benefit from added model capacity, while lower L∞ indicates better asymptotic performance.Source: §5.4 · pp. 10–11, Figure 3 · p. 11
  • Both prompt-based and direct concatenation outperform the baseline across model sizes, while translations from other PLs to Python score lower than other directions.Figure 4 aggregates translation scores across languages and directions into three categories.Source: Figure 4 · p. 11

6. Guideline for Code Pre-training

The section uses proportion-dependent multilingual scaling laws and synergy analysis to guide token allocation, then evaluates that strategy against uniform allocation. Under identical compute budgets, guided allocation achieves higher average generation and translation performance without significant degradation for any language.

6.1. Experimental Setup

  • The comparison trains two 1.5B-parameter models on 400B tokens each, including 350B code tokens and 50B natural-language tokens.The baseline assigns 50B code tokens to each programming language; the optimized strategy reallocates the same code-token budget using fitted scaling laws and synergy analysis.Source: §6.1 · p. 12, Figure 5 · p. 12

6. Guideline for Code Pre-training

  • The allocation guidance prioritizes high-utility languages, balances high-synergy pairs, and reduces tokens for fast-saturating languages.The recommendations also state that uniform allocation is suboptimal and that language synergy should guide corpus design.Source: §6 · p. 11, §6.1 · p. 12

6.2. Proportion-dependent Multilingual Scaling Law

  • The proportion-dependent scaling law explicitly incorporates language proportions, with an effective data term capturing cross-lingual transfer.Its transfer coefficients are derived from the language-pair synergy analysis.Source: §6.2 · p. 12

6.3. Scaling Law under Optimal Allocation

  • Under optimal allocation, the fitted exponents are α_D = 0.6859 and α_N = 0.2186, with L∞ = 0.2025.The coefficients come from weighted fitting of multilingual code-generation and translation loss.Source: §6.3 · p. 13

6.4. Evaluation on Multilingual Code Generation and Translation

  • Guided allocation achieves higher average performance than uniform allocation under identical compute budgets, with no language suffering significant degradation.Evaluation covers MultiPL-E Pass@1 across seven programming languages and translation BLEU.Source: Figure 6 · p. 13, §6.4 · p. 13

7. Related Work

Related work traces scaling-law research from general language models to code and surveys successive approaches to code pre-training. It notes that prior code-scaling analysis was limited to one programming language.

Scaling Laws

  • Prior code-scaling work [19] found code more data-hungry than natural language but analyzed only a single programming language.Source: §7 · p. 13
  • Scaling-law research established predictable performance relationships with model size, data, and compute [16], while Chinchilla work [11] argued for compute-optimal scaling of parameters and training tokens.Source: §7 · p. 13

Code Pre-training

  • Code pre-training progressed from CodeBERT [6] and GraphCodeBERT [7] to encoder-decoder models such as CodeT5 [26] and CodeGen [20], then multilingual foundation models.Source: §7 · p. 14

8. Conclusion

The paper investigates multilingual code scaling through experiments spanning languages, model sizes, and data configurations. It reports distinct language scaling behaviors, benefits from language pairing and parallel pairing, and improved average performance from guided token allocation without degrading individual languages.

  • Proportion-dependent scaling laws enable token allocation that improves average performance without degrading individual language capabilities.Source: §8 · p. 14
  • Interpreted languages such as Python show larger scaling exponents than compiled languages such as Rust, with irreducible losses ordered from C# to Python.Source: §8 · p. 14
  • Strategic language pairing yields synergistic benefits, particularly for syntactically similar languages such as Java-C#, and most languages benefit from multilingual exposure.Source: §8 · p. 14
  • Parallel pairing of cross-lingual data significantly enhances translation capabilities and has favorable scaling properties.Source: §8 · p. 14

Limitations

The study's findings have defined language, model-scale, evaluation, and training-setting boundaries; broader generalization remains to be tested.

  • Experiments cover seven programming languages, leaving low-resource and domain-specific languages such as SQL and assembly unexplored.Source: Limitations · p. 14
  • The largest model is 14B parameters with 1T tokens, so scaling exponents at the greater-than-100B, multi-trillion-token frontier remain unvalidated.Source: Limitations · p. 14
  • Evaluation covers code translation and generation benchmarks, which may not capture tasks such as program repair or multi-file completion.Source: Limitations · p. 14
  • Synergy coefficients are fitted to one corpus, and the fixed-token-budget optimization does not explore dynamic curricula or adaptive sampling.Source: Limitations · p. 14
Loading 2512.13472v1…