Multilingual Pre-training and Data Balancing › Worked Example: One Exponent, Two Languages

Michael BrenndoerferNovember 26, 20263 min read
Language AI HandbookAll chapters
Part 26 of 67Multilingual Language Models and Cross-Lingual Transfer
Chapter 185Multilingual Pre-training and Data Balancing › Worked Example: One Exponent, Two Languages
Reading section 6 of 11 · Worked Example: One Exponent, Two Languages · 3 minSection 6 of 11 · 3 min

Section 6 of 11 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Before writing code, compute one case by hand so the arithmetic is concrete. Take a two-language corpus with p=(0.98,0.02)p = (0.98, 0.02): one dominant language and one small one.

The point of doing this by hand is to build intuition for the magnitudes before trusting a library function. The formula is simple enough that the results can be surprising, and the surprises are easier to absorb with a pencil than with a plot.

At α=1\alpha = 1 the mixture stays at q=(0.98,0.02)q = (0.98, 0.02). The small language receives 2% of the expected draws in the unit used for pp. That is also its share of the expected token count if the sampler draws individual tokens.

At α=0.5\alpha = 0.5 (square-root sampling):

0.980.5=0.98995,0.020.5=0.14142,Z=1.131370.98^{0.5} = 0.98995, \qquad 0.02^{0.5} = 0.14142, \qquad Z = 1.13137 q=(0.989951.13137, 0.141421.13137)=(0.8750, 0.1250).q = \left(\frac{0.98995}{1.13137},\ \frac{0.14142}{1.13137}\right) = (0.8750,\ 0.1250).

The small language jumps from 2% to 12.5% of the mixture, an upweighting factor of 0.125/0.02=6.25×0.125/0.02 = 6.25\times. The dominant language's mixture share drops to 87.5%. Its effective epochs per pass are 0.875/0.98≈0.8930.875/0.98\approx0.893.

The tail receives more than six corpus-equivalents of draws per nominal pass. The head's expected volume is below one corpus-equivalent. Distinct coverage depends on how the loader chooses items within each language.

At α=0.3\alpha = 0.3, the value XLM-R and mT5 used:

0.980.3=0.99396,0.020.3=0.30925,Z=1.303210.98^{0.3} = 0.99396, \qquad 0.02^{0.3} = 0.30925, \qquad Z = 1.30321 q=(0.7627, 0.2373).q = (0.7627,\ 0.2373).

The small language is now at 23.7% of the mixture, upweighted by 11.86×11.86\times. Its expected draw volume per nominal pass is roughly twelve corpus-equivalents, compared with 0.780.78 for the head. At α=0.1\alpha = 0.1 the small language reaches 40% of the mixture and roughly twenty expected effective epochs.

At 0.3, a language with 2% of the corpus supplies nearly a quarter of the draws. At 0.1, that language supplies about 40%. As the expected repetitions rise, check whether the available corpus is clean and varied enough to justify the draw budget.

Two lessons follow:

  • α\alpha is not a gentle dial. Small changes near zero move the tail enormously.
  • Use the full distribution to compute ZZ. The same exponent can give different absolute shares when the set of languages or their natural shares changes.

In a two-language mixture, one language's gain equals the other's loss. Adding languages changes the normalizer, but a single dominant language can still account for all the lost share.

The worked example also shows why effective epochs communicate better than shares:

  • "The small language is at 23.7% of the mixture" invites the question "is that enough?"
  • “We expect twelve corpus-equivalents of draws per pass” prompts an audit of whether the corpus is clean and varied enough for that much reuse.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy