Multilingual Pre-training and Data Balancing › A Toy Model of Transfer-Interference

Michael BrenndoerferNovember 26, 20268 min read
Language AI HandbookAll chapters
Part 26 of 67Multilingual Language Models and Cross-Lingual Transfer
Chapter 185Multilingual Pre-training and Data Balancing › A Toy Model of Transfer-Interference
Reading section 8 of 11 · A Toy Model of Transfer-Interference · 8 minSection 8 of 11 · 8 min

Section 8 of 11 · 8 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Sampling shares do not tell you what happens to accuracy. To see the trade-off, we need a model with shared capacity. The smallest one that exhibits interference is a single linear map trained on data from several languages whose optimal maps differ slightly.

The toy is deliberately minimal. It strips away tokenization, optimization, and architecture, and keeps only the part of the problem that produces interference: multiple languages with different optima sharing one set of weights. If the trade-off appears here, it is not an artifact of scale or training instability; it is a property of sharing.

Let language ll have optimum wl=δlw_l = \delta_l (we drop the shared component because it cancels out of the risk expression below), and let inputs satisfy E[xx⊤]=I\mathbb{E}[xx^\top] = I. A model must choose one weight vector ww for all languages. Under mixture qq, the population objective is

L(w)=∑lql El[(y−x⊤w)2].\mathcal{L}(w) = \sum_l q_l \, \mathbb{E}_l \left[ (y - x^\top w)^2 \right].

The identity raw second moment gives each language an isotropic squared-distance penalty. If all languages share an invertible second moment AA, the normal equations cancel AA and the weighted mean still holds. For different per-language moments Al=El[xx⊤]A_l=\mathbb{E}_l[xx^\top], the equation becomes (∑lqlAl)w=∑lqlAlδl(\sum_l q_l A_l)w=\sum_l q_l A_l\delta_l.

A shared fit must compromise when the participating languages have distinct unique optima. With singular moments, the minimizing sets can intersect. If one language constrains only the first coordinate and another only the second, the shared vector can satisfy both. For the identity case used in this toy, set the gradient to zero:

∑lql(El[xy]−El[xx⊤]w)=0  ⟹  w⋆=∑lql δl.\sum_l q_l \left( \mathbb{E}_l[xy] - \mathbb{E}_l[xx^\top] w \right) = 0 \;\Longrightarrow\; w^\star = \sum_l q_l \, \delta_l .

The result is worth pausing on. The model does not learn a compromise that is equally bad for everyone; it learns the mixture-weighted average of the optima. Languages whose optima are close to that average are well served. Languages whose optima are far from it are poorly served, and the farther they are, the worse the quadratic penalty. This is why interference is not uniform: it falls hardest on the languages that are most different from the weighted consensus.

The model learns the mixture-weighted average of the per-language optima. Its risk on language ll is therefore

Rl=∥∑kqkδk−δl∥2+σ2,R_l = \left\| \sum_k q_k \delta_k - \delta_l \right\|^2 + \sigma^2,

Here σ2\sigma^2 is a common noise floor. The toy assumes known optima and fits one shared point, so it omits estimation error from finite samples and any positive transfer between languages.

With the other languages kept in fixed relative proportions, the shared optimum follows the segment from their weighted centroid toward the target language’s optimum as its share rises. The target’s squared-distance loss decreases if those points differ and stays constant if they coincide. If several relative shares change simultaneously, check how the shared point actually moves.

A fuller model could add a term for estimation error that declines with exposure. An interior optimum then depends on the shape of that term and the interference loss. For example, for one share variable qq between zero and one, adding 0.04/q0.04/q to q2q^2 gives an interior minimum.

PythonIn [21]
CollapseExpand
n_lang = len(languages)
dim = 8

# Synthetic scale factors for the language-specific deviations.
distance = np.array([0.4, 0.5, 0.6, 0.9, 0.8, 1.4, 1.6, 1.5])
delta = rng.normal(0, 1, (n_lang, dim)) * distance[:, None]
sigma2 = 0.25


def interference_risk(p, alpha, delta, sigma2):
    """Per-language risk when a shared linear model is trained on mixture q."""
    q = temperature_mixture(p, alpha)
    w_star = q @ delta
    return ((delta - w_star) ** 2).sum(axis=1) + sigma2


alpha_grid = np.linspace(0.0, 1.0, 51)
R = np.array([interference_risk(p, a, delta, sigma2) for a in alpha_grid])

macro = R.mean(axis=1)  # every language weighted equally
micro = R @ p  # weighted by natural corpus share

The distance vector scales the random deviations in the fixture. The scales are synthetic. The realized distances from the shared optimum depend on the random directions and the mixture. The common noise floor shifts every risk by the same amount.

The macro average weights each language equally. The micro average in this fixture weights by natural corpus share. Use an independently measured user distribution if you want an average-user metric. The next printout gives the grid minimum for each of the two plotted objectives.

PythonIn [22]
CollapseExpand
print(f"alpha minimising micro average: {alpha_grid[np.argmin(micro)]:.2f}")
print(f"alpha minimising macro average: {alpha_grid[np.argmin(macro)]:.2f}")
print(
    f"risk at alpha=1.0  -> micro {micro[np.argmin(np.abs(alpha_grid - 1.0))]:.3f}, "
    f"macro {macro[np.argmin(np.abs(alpha_grid - 1.0))]:.3f}"
)
print(
    f"risk at alpha=0.3  -> micro {micro[np.argmin(np.abs(alpha_grid - 0.3))]:.3f}, "
    f"macro {macro[np.argmin(np.abs(alpha_grid - 0.3))]:.3f}"
)
print(f"risk at alpha=0.0  -> micro {micro[0]:.3f}, macro {macro[0]:.3f}")
alpha03_index = np.argmin(np.abs(alpha_grid - 0.3))
for objective, risks in (("Micro", micro), ("Macro", macro)):
    minimum = risks.min()
    excess = risks[alpha03_index] - minimum
    print(
        f"{objective} excess at alpha=0.3: {excess:.3f} ({excess / minimum:.1%})"
    )
ConsoleOut [22]
CollapseExpand
alpha minimising micro average: 1.00
alpha minimising macro average: 0.00
risk at alpha=1.0  -> micro 1.729, macro 7.252
risk at alpha=0.3  -> micro 1.873, macro 6.896
risk at alpha=0.0  -> micro 2.246, macro 6.735
Micro excess at alpha=0.3: 0.144 (8.3%)
Macro excess at alpha=0.3: 0.161 (2.4%)

Weighted least squares minimizes the risk measured with its own weights. Here α=1\alpha=1 gives a micro-risk minimizer because the fit uses natural corpus shares. Setting α=0\alpha=0 gives a macro-risk minimizer because the fit gives every language equal weight.

In this seeded fixture, the intermediate exponents on the grid have higher micro risk than the micro minimum and higher macro risk than the macro minimum. The general least-squares result allows ties. If the two weighted means coincide, both objectives can share a minimizer.

At α=0.3\alpha=0.3 in this fixture, the micro risk exceeds its own minimum at α=1\alpha=1 by 0.144 MSE, about 8.3%. The macro risk exceeds its own minimum at α=0\alpha=0 by 0.161 MSE, about 2.4%. The percentages divide each excess by that objective’s own minimum.

Figure @fig-per-language-risk shows why the compromise is not a simple "everyone moves together."

VisualizationOut [23]
CollapseExpand
Line chart of per-language risk against alpha, with some curves rising and others falling.
Per-language risk in the shared-capacity toy model. As the sampling exponent decreases, the English curve rises and the Spanish curve falls to its minimum before rising again. The Welsh and Yoruba curves reach their lowest risk at uniform sampling.

As α\alpha decreases from 1 to 0, English and Chinese risk rise throughout the sweep. Spanish risk first falls and then rises, with a grid minimum at α=0.58\alpha=0.58. The shared fit can pass closer to a language's optimum at an intermediate mixture. Welsh and Yoruba each end with lower risk than they started with, despite a brief rise near α=1\alpha=1. Report per-language validation results alongside the aggregate so you can spot these different responses.

The aggregate view is Figure @fig-macro-micro.

VisualizationOut [24]
CollapseExpand
Micro risk falls and macro risk rises as alpha increases, with the curves staying apart.
Macro and micro average risks for the seeded toy model. The corpus-weighted objective reaches its minimum at alpha = 1, and the language-uniform objective reaches its minimum at alpha = 0. At alpha = 0.3, compare each curve with its own minimum.

On this fixture’s grid, as α\alpha increases from 0 to 1, corpus-weighted risk falls from 2.25 to 1.73 and language-uniform risk rises from 6.73 to 7.25. At α=0.3\alpha=0.3, the objectives are about 1.87 and 6.90, respectively. Compare movements along each curve to judge the effect of a mixture change.

The two controls in this fixture are the synthetic deviation scales and the common noise floor. For a transfer experiment, compare whether access to a donor language improves held-out outcomes in the target language.

Compare real sweeps against their own controls. With three different optima, a language’s share can rise while a redistribution of the other weights moves the shared point away from that language. Log the other shares before attributing a tail regression to data quality or tokenization.

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