Introduction
Modern Large Language Models (LLMs) exhibit impressive multilingual capabilities, even for low-resource languages. However, how these capabilities dynamically evolve during the pre-training phase has largely remained a black box. Most prior research focuses on probing fully trained models rather than observing the learning process in motion.
Without understanding this evolution, model developers are flying blind when mixing pre-training data. The standard approach is often to use the natural distribution of available data. But if we do not understand how languages interact inside the network, throwing all available data into the mix might actually hurt performance for certain languages by forcing them to prematurely abandon shared knowledge representations.
To address this, researchers introduce the Babel Tower Hypothesis to explain how LLMs develop multilingual capabilities during pre-training. By tracking internal model states, they discovered that LLMs initially rely on a dominant language's knowledge system (like Python) to process new languages before eventually building language-specific systems. Leveraging this insight, they propose a method to optimize the data mixture in pre-training corpora, significantly boosting the performance of multilingual code LLMs.
Methodology
The authors use code LLMs as an experimental sandbox, treating Python as the "dominant" language and observing how the model learns new languages (PHP, C#, Go, C++). The pre-training dataset is a custom multilingual code corpus collected from GitHub, and evaluation is performed using the HumanEval and MBXP benchmarks.
To peek inside the black box during training, they employ two main techniques:
- Working Languages (Logit Lens): They examine the outputs of intermediate layers to see what language the model is "thinking" in. This is done by tracking language-specific identifiers (e.g., Python uses
len()while PHP usescount()). If the model outputslenin an intermediate layer while generating PHP code, it is effectively thinking in Python. - Language Transferring Neurons: They track the activation of specific neurons responsible for transforming knowledge from the dominant language into the target language.
Using these observations, they introduce a novel algorithm to estimate the optimal pre-training data distribution. It uses training loss as a proxy to estimate the internal system's state, finding the exact data proportion that maximizes cross-lingual transfer without causing destructive interference.
The Babel Tower Hypothesis
The core insight of the paper is that multilingual learning happens in three distinct stages:
- Translation Stage: The model relies entirely on the dominant language (Python). It "thinks" in Python and translates to the new language. During this phase, performance improves rapidly.
- Transition Stage: The model starts building a dedicated system for the new language. Surprisingly, performance often dips here because the model shifts away from the highly capable dominant system to a nascent, weaker native system.
- Stabilization Stage: The new language's responses primarily depend on its own fully formed internal system.
A crucial takeaway is that more data isn't always better. For many languages, relying on a strong dominant language and "translating" its knowledge is actually more effective than building a standalone knowledge system from scratch. Feeding the model too much data for a secondary language can force it into the Stabilization Stage prematurely, resulting in lower overall performance.
Key Results and Optimization
During the early stages of training on PHP, intermediate layers consistently output Python tokens, and "language transferring neurons" are highly active, empirically proving the translation mechanism.
By carefully tuning the ratio of a new language to the dominant language in the pre-training mix, developers can effectively freeze the model's internal state at the optimal "Translation Stage" for that specific language, maximizing its performance.
The authors trained models from scratch (1.3B and 6.7B parameters) using their optimized data distribution and compared them against models trained on the original, natural data distribution. The gains were concrete:
- For the 1.3B model, the average Pass@1 score across HumanEval and MBXP improved from 25.03% (original) to 26.61% (optimized).
- For the 6.7B model, performance jumped from 38.31% to 41.96%—a massive gain achieved simply by re-weighting the data.
Limitations and Future Work
The authors acknowledge that their experiments are currently limited to code LLMs (with Python as the dominant language) and a specific set of programming languages. While code is a great proxy, the dynamics of natural language might differ. Future work will focus on extending the Babel Tower Hypothesis and data optimization methods to natural language scenarios. They also suggest scaling the approach to even larger models and combining it with data quality filtering techniques to construct the ultimate pre-training corpus.
Summary updated