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 DaiarXiv 2025 · DOI

Introduction

Training state-of-the-art Large Language Models (LLMs) for code is a resource-intensive endeavor. Traditionally, researchers have relied on "scaling laws"—mathematical frameworks like the Chinchilla law—to predict how model performance improves with increased compute, data, and parameters. However, these laws typically treat all training data as a monolithic block. This paper argues that for code, the composition of the dataset is just as critical as its size. By analyzing how different programming languages (PLs) scale and interact, the authors propose a more nuanced "proportion-dependent" scaling law that optimizes data allocation for superior performance.

The Problem: One Size Does Not Fit All

Most Code LLMs are trained on massive, multilingual corpora. The prevailing assumption has been that more data is always better, regardless of the specific language. This leads to two significant inefficiencies:

  1. Inaccurate Performance Predictions: A model trained on 1 trillion tokens of Python will not behave the same as one trained on 1 trillion tokens of Rust. Standard laws fail to account for these inherent differences.
  2. Suboptimal Resource Allocation: Using a uniform distribution of languages often wastes compute on "fast-saturating" languages (those that stop improving quickly) while starving languages that require more data to reach peak performance.

Methodology: A Massive Empirical Study

To address these gaps, the researchers conducted over 1,000 experiments, totaling approximately 336,000 H800 GPU hours. They trained models ranging from 0.2 billion to 14 billion parameters on up to 1 trillion tokens.

3D scaling surface for Python, illustrating the relationship between model size, data size, and evaluation loss.

The team first fitted Chinchilla-style power-law equations to seven individual languages (Python, Java, JavaScript, TypeScript, C#, Go, and Rust) to identify their unique scaling exponents ($\alpha_N, \alpha_D$) and irreducible losses ($L_\infty$). They then explored "bilingual" training to quantify cross-language synergies and experimented with "parallel pairing"—concatenating code snippets with their translations—to enhance cross-lingual transfer.

Key Insights: Interpreted vs. Compiled Scaling

One of the paper's most striking findings is the difference between interpreted and compiled languages. Interpreted languages, like Python, exhibit higher scaling exponents. This means they continue to show significant performance gains as model size and data volume increase. In contrast, compiled languages like Rust have smaller exponents; while they are easier for models to grasp initially due to their rigid syntax, they saturate much faster.

The researchers also established a "Complexity Hierarchy" based on irreducible loss ($L_\infty$). They found that strict, statically-typed languages are more predictable for LLMs than dynamic, expressive ones. The hierarchy ranked languages from most to least predictable: C# < Java ≈ Rust < Go < TypeScript < JavaScript < Python.

Cross-Language Synergy and Asymmetry

The study revealed that languages do not exist in isolation within a model. Some languages act as "givers," where their inclusion helps the model learn other languages. Python is a primary example of a giver; including it improves performance in languages like Java. However, Python is not a "receiver"—adding other languages to a Python-heavy mix can actually cause a slight performance drop in Python, a phenomenon known as negative interference.

Results: Optimizing the Training Mix

By applying their new proportion-dependent scaling law, the authors demonstrated that strategic data allocation yields better results than uniform distribution for the same compute budget.

Comparison of the proposed Multilingual Scaling Law against equal-weighted averages across model size and training tokens.

Key results include:

  • Synergy Gains: Mixing Java and C# led to a 20.5% improvement in validation loss compared to training on Java alone.
  • Consistent Improvements: Guided by the new scaling law, the researchers prioritized high-scaling languages (Python) and high-synergy pairs, resulting in consistently higher average performance across all tested languages.
  • Enhanced Translation: Models trained with "parallel pairing" showed drastically improved zero-shot translation capabilities, even between language pairs never seen together during training.

Conclusion

This research moves beyond the "more is better" philosophy of LLM training. By understanding the unique scaling properties and synergies of different programming languages, developers can train more capable code models more efficiently. Future work will look to expand these laws to low-resource languages and explore how these dynamics change at the scale of hundreds of billions of parameters.

Summary updated

BibTeX
@misc{yang2025scaling,
  author = {Jian Yang and Shawn Guo and Lin Jing and Wei Zhang and Aishan Liu and Chuan Hao and Zhoujun Li and Wayne Xin Zhao and Xianglong Liu and Weifeng Lv and Bryan Dai},
  title = {{Scaling Laws for Code: Every Programming Language Matters}},
  year = {2025},
  eprint = {2512.13472},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.13472},
}
Figure