---
title: "Examining Modularity in — paper by Choenni et al. (2024)"
description: "Choenni and colleagues use attention-head pruning and training-data attribution to examine language specialization and sharing in XLM-R."
canonical: "https://research.elamur.ai/free/en/papers/choenni-2024-examining-modularity-multilingual-lms-language/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/choenni-2024-examining-modularity-multilingual-lms-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / Examining Modularity in Multilingual LMs via Language-Specialized Subnetworks

# Examining Modularity in Multilingual LMs via Language-Specialized Subnetworks

Paper · 2024 · Rochelle Choenni, Ekaterina Shutova and Dan Garrette

**Authors:** [Rochelle Choenni](https://md.research.elamur.ai/free/en/authors/rochelle-choenni/), [Ekaterina Shutova](https://md.research.elamur.ai/free/en/authors/ekaterina-shutova/) and [Dan Garrette](https://md.research.elamur.ai/free/en/authors/dan-garrette/) · **Year:** 2024 · **Venue:** Findings of the Association for Computational Linguistics: NAACL 2024 · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Cited by **5** papers in our library of more than 163,000 papers whose bibliographies we read · Findings of the Association for Computational Linguistics: NAACL 2024 · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2024.findings-naacl.21/)
- [PDF](https://aclanthology.org/2024.findings-naacl.21.pdf)
- [DOI 10.18653/v1/2024.findings-naacl.21](https://doi.org/10.18653/v1/2024.findings-naacl.21)

## Summary

A multilingual system can learn from examples in one language and use what it learns in another. The same arrangement can also let training in one language make predictions worse in another. Choenni and colleagues ask how much of this interaction is already organized by language in XLM-R after ordinary multilingual [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/). They also ask what changes when training explicitly assigns each language a subset of the system’s attention heads. The two questions distinguish a training rule that partitions access to parameters from a property of the resulting predictions. This distinction matters for both [language models](https://md.research.elamur.ai/free/en/topics/language-models/) and [multilingual NLP](https://md.research.elamur.ai/free/en/topics/multilingual-nlp/).

The authors first adapt XLM-R to a classification task using examples from several languages together. For each language, they find a subnetwork by disabling attention heads that contribute relatively little to performance on that language. They then trace which fine-tuning examples are most influential for correct predictions, with and without the selected heads disabled. On natural language inference, paraphrase identification, and review sentiment, the language-matched subnetworks generally draw a larger share of their strongest positive influence from training examples in the test language. Where that share rises, the paper reports increases from +1 to +8%. Natural language inference shows the weakest tendency. The subnetworks appear even when multilingual training never used the language masks.

The authors then use the same head selections to constrain training as well as prediction. This sparse fine-tuning improves mean subnetwork test accuracy on PAWS-X from 74.8% to 78.4%, with an average improvement of +1.2% on MARC. Some subnetworks become less dependent on examples in their own language. Randomly chosen heads can show much stronger same-language reliance after sparse training while yielding substantially poorer predictions. Across the two tasks examined in this part of the study, pairs with more similar head selections also tend to show more positive cross-language influence. The combined evidence suggests that the choice of shared heads can help a language benefit from other languages’ data, even when each language has its own restricted path through XLM-R.

## Deep dive: Examining Modularity in Multilingual LMs via Language-Specialized Subnetworks

Choenni and colleagues use attention-head pruning and training-data attribution to examine language specialization and sharing in XLM-R. · about 34 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a shared system has to learn

A multilingual predictor serves several groups of inputs with a common pool of parameters. This is attractive when experience with one language can help with another. An example in one language can reinforce a way of performing a task that works elsewhere as well. The paper points to multilingual BERT as earlier evidence that cross-language sharing can be useful. In that account, sharing is a property of the predictor’s behavior that makes multilingual learning worthwhile. [How Multilingual is Multilingual BERT?](https://md.research.elamur.ai/free/en/papers/pires-2019-how-multilingual-is-multilingual-bert/)

Shared training can also cause interference. A parameter update that helps with some examples can move the system in an unfavorable direction for others. If examples from different languages regularly favor incompatible updates, learning those languages together can carry a performance cost. The paper situates this issue within what previous researchers called the curse of multilinguality. The difficulty is to preserve opportunities for transfer while limiting the situations in which jointly trained languages work against each other. [On Negative Interference in Multilingual Models](https://md.research.elamur.ai/free/en/papers/wang-2020-negative-interference-multilingual-models-findings/)

The presence of both effects complicates the meaning of a language-specific component. It might help by handling phenomena particular to a language, by shielding some parameters from conflicting updates, or by sharing selected parameters where common training is productive. These possibilities can coexist. An improvement in classification accuracy tells researchers that the overall arrangement helped, but the improvement alone leaves open which examples the predictor used to make its decisions. The paper therefore looks for evidence about training examples as well as evidence about task performance.

#### What researchers had already made modular

Modular learning predates the use of pretrained language systems. The paper describes earlier research motivated by the prospect of building systems whose parts perform identifiable roles and can be combined. In language work, a module can be an added part of the architecture. Adapters, for example, introduce specialized layers into an existing system. Prefix-tuning likewise introduces trainable parameters for adaptation. Both approaches give researchers a way to assign some of the training work to a distinct set of parameters. [Parameter-Efficient Transfer Learning for NLP](https://md.research.elamur.ai/free/en/papers/houlsby-2019-parameter-efficient-transfer-learning-nlp/)

Another approach works with the parameters already present. A mask selects which parts of an existing network can participate for a particular input or receive updates from a particular batch. Different masks can select some of the same parts. This gives researchers a way to enforce partial sharing, with some capacity common to several languages and some accessible to fewer. The paper places this approach alongside efforts to introduce modularity during multilingual pretraining, while concentrating its own intervention on task adaptation. [Lifting the Curse of Multilinguality by Pre-training Modular Transformers](https://md.research.elamur.ai/free/en/papers/pfeiffer-2022-lifting-curse-multilinguality-pre-training/)

The idea that small subnetworks can preserve useful behavior comes from pruning research. In the account the authors give, work on the Lottery Ticket Hypothesis showed that a pruned network could match its larger counterpart. Later research located useful subnetworks in BERT and found both language-specific and language-neutral subnetworks in multilingual systems. A subnetwork in this sense is a selection of existing computational components. Finding one through pruning establishes that the remaining components can support a task to the chosen performance standard. It creates an opportunity to ask what role those components play.

Earlier multilingual work had already used sparse updates to improve transfer. Alongside a machine translation method that chooses subnetworks for language pairs, the paper cites applications in natural language understanding, dependency parsing, and speech recognition. There was also evidence from earlier work by the authors that sparse training could reduce conflicts between gradients. Such results explain why sparse fine-tuning was regarded as a promising way to guide multilingual learning. They leave the source of the resulting predictions open, which motivates following the influence of individual training examples. [Learning Language Specific Sub-network for Multilingual Machine Translation](https://md.research.elamur.ai/free/en/papers/lin-2021-learning-language-specific-sub-network/)

#### What counts as specialization in this study

The paper separates language-specific access from language-specific reliance. Access is specified by a mask. Given a German input, for example, researchers can use the selection found for German. Reliance is a property the authors estimate from the fine-tuning data. They ask whether the strongest sources of support for a German prediction come disproportionately from German examples, and whether that pattern changes when they apply the German mask. A rule for selecting heads and the language composition of the examples behind a prediction are thus different objects of measurement.

That distinction makes it possible to ask about specialization in a system trained without language-specific routing. If the researchers can find a useful selection of heads after ordinary multilingual training, they can test what that selection does to the sources of influence. Any specialization observed under this test is present in the sense that it can be exposed by pruning the trained system. The procedure intentionally searches for a useful selection using data from the language, so the finding concerns what the shared system makes available to that search.

The authors also ask whether using those masks during training necessarily strengthens the same tendency. Assigning a language its own path could increase the use of its own examples. But an attention head can sit on several paths, and its updates can be useful to several languages. Restriction changes both which parts specialize and which parts have to serve common needs. The paper treats the balance of effects as an empirical question.

#### Why follow examples through training

Training-data attribution offers a way to investigate that balance. A standard question in this area is how much a test prediction’s loss would change if a training example were omitted. Loss is the quantity that training tries to reduce, and it records how well the prediction agrees with its target under the learning objective. Actual omission would require revisiting what training did with the other examples. Attribution methods instead estimate aspects of that influence from an existing training run. The paper grounds this question in earlier work on influence functions. [Understanding Black-box Predictions via Influence Functions](https://md.research.elamur.ai/free/en/papers/koh-2017-understanding-black-box-predictions-influence/)

Previous applications discussed in the paper used training-data attribution to inspect unusual examples, identify data artifacts, filter examples, or understand prediction errors. The direct predecessor to this study grouped influential examples by language to examine cross-language sharing under ordinary multilingual fine-tuning. Choenni and colleagues use the same general framework to compare predictions made with different selections of heads. The outcome of interest is the composition of highly ranked examples, which supplies a form of [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/) tied to the fine-tuning data.

### The method, step by step

#### From the complete network to a language-specific selection

The starting point is pretrained XLM-R base. For each task, the authors attach a simple classifier that reads the hidden representation of the opening `<S>` token. The representation is a vector produced by processing the input sequence. The classifier has one hidden layer with a tanh activation and uses that vector to predict a task label. Inference and paraphrase identification use input pairs, while sentiment classification uses reviews. Each is an instance of [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/).

Inside XLM-R, the basic unit that the authors enable or disable is an attention head. A head is part of a [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/) layer and contributes to the way information from positions in the input is combined. The paper uses whole heads as pruning units. A mask can therefore leave a head in operation or suppress its contribution. The resulting subnetwork is the path through the existing system with that selection of heads active.

The authors first fine-tune the complete system on a concatenated multilingual training set. They then look for a mask for each language and task. The mask search uses performance on the language concerned to judge which heads can be removed. It starts with the task-adapted system and successively removes heads with low estimated importance. The aim is to preserve useful task behavior while reducing the active set enough to reveal whether a particular selection has a distinct pattern of data reliance.

After identifying a mask, the authors study it in two uses. In the first, the underlying parameters have already been trained in the ordinary way and the mask is applied at evaluation. In the second, the mask also constrains training. Both uses can be evaluated with the same language-matched selection of heads. That design lets the researchers examine the effect of using a subnetwork and then compare what happens when training itself is organized around it.

Finding and evaluating language-specific attention subnetworks The steps in order.

#### How the pruning rule chooses heads

A mask for a language has one binary entry for each head position in each layer. The notation makes the arrangement of the mask explicit.

```
ξℓ ∈ {0, 1}ᴴˣᴸ
```

Here `ξℓ` denotes the mask for language `ℓ`. The symbol `∈` means membership in the set on the right. The braces contain the possible entry values: `0` disables the head and `1` enables it. The superscript `ᴴˣᴸ` describes an array with `H` head positions and `L` layers, with an entry for each head and layer combination.

The importance rule estimates how sensitive loss is to changes in the mask variable for a head. The sensitivity is averaged over examples of the language under study. The paper follows a pruning procedure developed for testing how much multi-head attention can be removed while keeping good task performance. [Are Sixteen Heads Really Better Than One?](https://md.research.elamur.ai/free/en/papers/michel-2019-sixteen-heads-really-better-than/)

```
HIℓ⁽ⁱ,ʲ⁾ = 𝔼ₓℓ∼Xℓ [∂𝓛(xℓ) / ∂ξℓ⁽ⁱ,ʲ⁾]
```

`HIℓ⁽ⁱ,ʲ⁾` is the importance score for head `i` in layer `j` for language `ℓ`. The expectation `𝔼` averages over examples, with `xℓ ∼ Xℓ` indicating that an example `xℓ` comes from the language’s data distribution `Xℓ`. The function `𝓛(xℓ)` is the loss on that example. The derivative, written with `∂`, expresses the sensitivity of the loss to the entry `ξℓ⁽ⁱ,ʲ⁾` controlling the head at that position. The slash puts the change in loss in relation to a change in that entry.

The derivative supplies a score for selecting heads even though the resulting mask makes a discrete decision at each position. The procedure repeatedly removes the 10% of heads with the lowest importance scores. It stops upon reaching 95% of the original performance for the language being pruned. The resulting mask is consequently tied to both a language and a classification task. A head that matters little under one such evaluation can be important under another.

The mask is a selection of heads under this performance criterion. It does not label the remaining heads with linguistic functions. Some may support a distinction shared by all the languages in a task. Others may be especially useful in the language for which the mask was found. The attribution analysis examines the behavior of their combined selection. The structural analysis later asks how often different language masks select the same heads.

#### What changes in sparse fine-tuning

The unrestricted fine-tuning run uses examples from all selected languages, with the ordinary XLM-R computation available to each. In the first experiment, this run supplies the checkpoints for tracing influence. For a test example, the authors compare the complete predictor with the predictor evaluated through the selected heads for that language. The two evaluations let them look for a change in the sources of influence while keeping the underlying shared training run fixed.

Sparse fine-tuning alters what happens during adaptation to the task. The authors draw batches containing examples from one language at a time and use those batches in random order. They sample each language equally often. For a given batch, its language determines the mask. Disabled heads stay off during the forward pass, when the system computes predictions. During back-propagation, when the learning procedure computes the gradients that guide parameter updates, the mask suppresses updates for the corresponding disabled parts. The optimizer receives the masked gradients. A head present in several masks can therefore participate in the training of several languages.

The settings apart from the sparse procedure follow those for full fine-tuning. The authors use AdamW and set the learning rates for XNLI, PAWS-X, and MARC to 2e-5, 9e-6, and 2e-5, respectively. Using the same pruning-based head selections in both regimes helps isolate the consequences of changing how a fixed set of masks is used. Sparse training changes the computations seen by examples and the updates they can produce. The study treats those as parts of the same intervention. [Decoupled Weight Decay Regularization](https://md.research.elamur.ai/free/en/papers/loshchilov-2017-decoupled-weight-decay-regularization/)

The importance of overlap becomes clearer when considering consecutive batches. An enabled head shared by their masks can be trained on both languages. A head enabled for only one of them can participate selectively. This defines where direct sharing through the selected heads can occur. The mask specifies those opportunities in advance, while the actual gradients depend on the examples. The later analysis asks whether more opportunity for sharing at the head level goes together with more positive influence at the example level.

#### How TracIn links training and test examples

For each test prediction, the authors want to rank training examples by their estimated influence. They use TracIn, which examines gradients at saved checkpoints. A gradient describes the direction of local change in the loss as the parameters change. If a training example and a test example have aligned loss gradients, a step taken to reduce the training example’s loss tends locally to reduce the test example’s loss as well. If the directions oppose one another, the same step can locally work against the test example. [Estimating Training Data Influence by Tracing Gradient Descent](https://md.research.elamur.ai/free/en/papers/pruthi-2020-estimating-training-data-influence-tracing/)

The paper gives the checkpoint-based gradient product as the starting expression for the influence score.

```
I(zᵢ, zₜₑₛₜ) = ∑ₑ₌₁ᴱ ∇θ 𝓛(zᵢ, θₑ) · ∇θ 𝓛(zₜₑₛₜ, θₑ)
```

`I(zᵢ, zₜₑₛₜ)` denotes the estimated influence of training instance `zᵢ` on test instance `zₜₑₛₜ`. The subscript `i` identifies a training instance, and the subscript `test` identifies the example whose prediction is being examined. The summation sign `∑` adds contributions over checkpoints, with `e` indexing epochs from `1` through `E`. The parameter vector saved at epoch `e` is `θₑ`. The loss `𝓛(z, θₑ)` evaluates example `z` at that parameter setting. The operator `∇θ` differentiates the loss with respect to the parameters `θ`, producing a gradient vector. The centered dot is the dot product of the two gradients.

Summing over epochs means an example can rank highly through repeated alignment during training. It can also receive opposing contributions at different stages. A checkpoint score describes the relationship between the examples’ gradient directions at that particular state of the parameters. The aggregate score describes a pattern across the saved states. The authors use the aggregate score in the main comparisons and inspect the checkpoints separately in an additional analysis.

The experiments substitute cosine similarity for the raw dot product. The magnitudes of gradients can differ across languages, and a large gradient could dominate a dot product through scale. Cosine similarity focuses on direction by dividing the product by the vector lengths.

```
cos(a, b) = (a · b) / (‖a‖ ‖b‖)
```

Here `a` and `b` are the vectors being compared, in this case the training and test loss gradients at a checkpoint. The expression `cos(a, b)` denotes their cosine similarity. The dot gives their inner product, and `‖a‖` and `‖b‖` are their Euclidean lengths. Dividing by the product of those lengths normalizes the score. Positive and negative values then reflect degrees of agreement and opposition between the gradient directions.

This distinction is important in the later results. Positive scores provide evidence of estimated support for a prediction under the approximation. Negative scores capture the opposite direction and are related to what earlier research calls gradient conflicts. A test example can be correctly classified even when some training examples rank among its strongest negative influences. The procedure examines both sides of the ranking to see whether language masks change the balance of support and conflict. [Gradient Surgery for Multi-Task Learning](https://md.research.elamur.ai/free/en/papers/yu-2020-gradient-surgery-multi-task-learning/)

#### How the authors make the calculation tractable

A single loss gradient can be large because XLM-R has many parameters. The experiment requires comparisons between each chosen test example and all training examples. Keeping a full gradient for every comparison would be expensive. Following the TracIn work, the authors compress gradients into sketches through random projection. They can compute and store the sketches for the training examples in advance, then reuse them for many test examples.

For a gradient viewed as a vector, the appendix describes a random matrix with fewer rows than the original gradient has coordinates. The projection preserves inner products in expectation. The matrix and its normalization are specified by the following relationships.

```
G ∈ ℝᵈˣᵖ,  d ≪ p,  Gᵣ꜀ ∼ 𝒩(0, 1/d),  𝔼[GᵀG] = I
```

`G` is the projection matrix. The notation `ℝᵈˣᵖ` describes a matrix of real numbers with `d` rows and `p` columns, where `p` is the original vector dimension and `d` is the projected dimension. The symbol `≪` says that `d` is much smaller than `p`. An entry `Gᵣ꜀` at row `r` and column `c` is drawn independently from the normal distribution `𝒩`, with mean `0` and variance `1/d`. The expectation `𝔼` is over these random draws. `Gᵀ` is the transpose of `G`, and `I` is the identity matrix for the original coordinates.

For a fully connected layer, the appendix writes the gradient with respect to the weight matrix as an outer product. Sketching can then operate from both sides of that product. This makes use of the gradient’s structure before it would otherwise be stored in full.

```
G₁ ∇ᵧf(y) xᵀ G₂ᵀ
```

In this expression, `x` is the input vector to the layer, `y` is the layer output, and `f(y)` is the loss as a function of that output. The gradient `∇ᵧf(y)` gives the loss derivatives with respect to the components of `y`. The transpose `xᵀ` is a row vector, so its product with the output gradient gives the matrix of weight derivatives. `G₁` and `G₂` are independently chosen projection matrices for the output and input coordinates, respectively, and `G₂ᵀ` is the transpose on the input side. The product is a compact matrix whose entries can be arranged as a vector for comparison. The paper sets the sketch dimension parameter `d` to 256.

With these sketches, influence estimation can reuse the same representation of a training gradient for many test gradients. The projection is part of the computation of the score. It does not select which training languages are represented, nor does it target a preferred direction of transfer. The language comparison comes after ranking the training examples.

#### From ranked examples to a language comparison

The authors evaluate 500 randomly drawn test examples per language and score the influence of all 10K training instances for each. They retain the 100 examples with the strongest positive influence and the 100 with the strongest negative influence as separate sets. The cutoff is carried over from work using the same tasks and setup. Ranking takes place across the pooled training data, so examples in all the training languages are eligible to appear in either set.

For a German test example, for example, the authors can count the share of positively ranked training examples written in German, and the shares written in the other training languages. They then average the contributions for the test language. The resulting breakdown describes how strongly a language is represented among the most influential examples. A change in share can come from examples entering or leaving the top group, so it describes a shift in the ranking’s composition. It does not measure the total gradient influence of a language outside that group.

The authors evaluate influence on correctly predicted examples. When comparing a subnetwork with the complete predictor, they use test cases both can classify correctly. This makes the comparison about the training evidence behind successful decisions on common inputs. Classification accuracy remains a separate measure of how often the predictor succeeds on the applicable evaluation split. The separation matters because a subnetwork can obtain a different accuracy and still show a clear change in the sources of influence for its shared correct predictions.

The authors call a subnetwork more language-specialized when its influential examples are more strongly concentrated in the test language. They examine positive and negative influence separately. A rise in same-language support and a decline in same-language negative influence are therefore distinct observations. Cross-language influence uses the same accounting of training examples, with a different training language from the test language.

### Experiments and results

#### The classification data and the comparisons

XNLI starts with premise and hypothesis pairs. Its original labels distinguish entailment, neutrality, and contradiction. The experiment asks a binary question about whether the premise entails the hypothesis, grouping the other labels together. The authors use English, French, German, Russian, and Spanish. The pairs originate in English and are available in translated versions. This allows examples with the same underlying content to compete in the attribution rankings across training languages.

PAWS-X asks whether the sentences in a pair are paraphrases. Its source is PAWS, a dataset organized around examples created through word scrambling. PAWS-X has automatically translated training data, while some of its development and test data received professional translation from English. The study uses English, French, German, Korean, and Spanish. As with XNLI, the aligned training content makes it possible for parallel versions of a training item to enter the influence ranking. [PAWS-X](https://md.research.elamur.ai/free/en/papers/yang-2019-paws-x-cross-lingual-adversarial/)

MARC supplies reviews written by users in their respective languages. A review record has title and review text along with a star rating. Each of the 5 ratings represents 20% of the corpus for a given language. The experiment groups 1 and 2 stars into the negative class and 4 and 5 stars into the positive class. The authors use Chinese, English, French, German, and Spanish. Here the examples in one language do not have aligned counterparts in the others, so a review in another language can contribute to a prediction without being a translation of the same item. [The Multilingual Amazon Reviews Corpus](https://md.research.elamur.ai/free/en/papers/keung-2020-multilingual-amazon-reviews-corpus/)

For each task, the full training set in the experiment contains 2K examples from each of 5 languages, for 10K in all. The restricted training size keeps attribution feasible. The binary setups for XNLI and MARC also help the authors obtain usable task performance with that amount of data. Under full fine-tuning, XNLI converges at epoch 4 with 78% development accuracy. PAWS-X and MARC converge at epoch 5, with development accuracies of 83% and 90%, respectively. These numbers characterize task adaptation before the comparisons of masked test predictions.

The main baseline for finding naturally available specialization is full fine-tuning followed by an unmasked test prediction. The corresponding experiment applies the matched language mask at test time. The sparse-training experiment asks what changes when the language masks also govern fine-tuning. For the accuracy comparison between fine-tuning techniques, the language-matched masks are used at evaluation in both cases. Randomized masks and masks borrowed from other languages give additional baselines for interpreting the effect of a specific head selection.

The paper reports accuracy as the proportion of correct classifications. Its attribution metric is the share of the highest-ranked positive or negative examples supplied by a training language, averaged for a test language. The cross-language results sometimes give an absolute share and sometimes a change from the full-model baseline. An absolute share shows the size of a source among the influential examples. A change shows how the source’s representation shifts under a different computation. The German MARC example illustrates why the two views are needed.

#### Language specialization after full fine-tuning

With the training procedure held fixed, applying a language’s mask at test time usually increases the share of positive influence from examples in that language. The paper describes increases from +1 to +8% in the contribution to the top 100 positively influential examples across the tasks. This is the main evidence that ordinary multilingual fine-tuning leaves useful head selections with a more language-specific pattern of reliance. Their behavior can be exposed by masking the shared parameters at test time.

The corresponding changes in negative influence are less uniform. For Chinese in MARC, the language-matched subnetwork reduces negative influence from Chinese training examples. More same-language support and less same-language conflict would both alter how a language contributes to its own predictions, but the paper looks at these as separate sides of the ranking. The most consistent signal across tasks is the change in positive influence.

XNLI shows the weakest effect. Under the full predictor, it is already the task on which the authors observe the least reliance on same-language examples. The English subnetwork shows no change in language specialization. The authors connect this to the fact that each of the German and Russian subnetworks shares all of its own active head capacity with English. The direction of that comparison matters. German and Russian can use only heads that English also uses while English retains some additional heads of its own.

On MARC, the German subnetwork increases the contribution of German training examples from 33% to 35% among the most positively influential examples for German inputs. The change is reported as +2%. English starts at 17% and increases to 24%, a change the paper gives as +7%. When the English mask is used on English inputs, the corresponding increase in positive influence from German training data is +5%. The authors identify English and German as the most typologically similar languages in this comparison. They interpret the mutual increases as suggestive of useful transfer.

German and English training shares of positive influence for German MARC test predictions The German subnetwork increases both shares, with English gaining more and German remaining the larger source.

**The numbers**

| System or setting | share of top positively influential examples % |
| --- | --- |
| English training data with all heads | 17 |
| English training data with the German subnetwork | 24 |
| German training data with all heads | 33 |
| German training data with the German subnetwork (this paper) | 35 |

The larger increase for the English contribution coexists with a larger absolute share for German. Looking at the changes alone could obscure why the authors still characterize the German selection as language-specialized. Looking only at the absolute shares could obscure the strong gain from English. Together the results show that a mask can concentrate reliance on the test language while also increasing the contribution of a particular outside language. The authors suggest that another language can become especially helpful once the predictor has drawn on much of the useful same-language evidence. That explanation remains a hypothesis about the observed pattern.

MARC is useful for this example because English and German reviews are independently collected. The attribution pattern does not require the presence of a translated counterpart for each review. At the same time, the result records the languages of highly ranked examples. It does not establish which aspects of those reviews made the gradients align. Plausible sources of alignment include signals relevant to the sentiment label and features of review data, both of which are consistent with the task as set up.

#### Accuracy and attribution after sparse fine-tuning

The sparse fine-tuning comparisons focus on PAWS-X and MARC. The authors set XNLI aside at this stage because its masks yield the smallest changes in data reliance, the English mask is less distinct, and the attribution analysis is costly. Retaining PAWS-X and MARC gives a comparison between parallel paraphrase data and non-parallel review data.

On PAWS-X, the mean test accuracy of the identified subnetworks after full fine-tuning is 74.8%. It rises to 78.4% when those masks also constrain training. The authors report a gain of +3.6%. Both scores concern predictions made using the appropriate language mask. The improvement therefore describes a change in the training procedure for the subnetworks.

Average PAWS-X test accuracy of identified subnetworks by fine-tuning procedure Training with the language masks improves mean accuracy when the matched subnetworks are used for prediction.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Full fine-tuning, masks at test time | 74.8 |
| Sparse fine-tuning, masks during training and testing (this paper) | 78.4 |

The PAWS-X test accuracies in the appendix show where that average comes from. German reaches 68.0 under full fine-tuning and 78.8 under sparse fine-tuning, with the German mask applied for both evaluations. The analogous English scores are 78.6 and 83.0. Spanish records 78.2 and 80.5, while Korean records 67.1 and 69.9. French is the exception, moving from 82.1 to 79.8. Each pair is a test accuracy comparison between the two fine-tuning procedures with the language-matched subnetwork.

For MARC, the reported mean gain in subnetwork test accuracy is +1.2%. The scores for German are 75.3 after full fine-tuning and 76.4 after sparse fine-tuning. English records 75.1 and 75.8, while Spanish records 76.6 and 77.4. French goes from 76.2 to 77.6, and Chinese from 69.5 to 71.1. The MARC appendix scores are thus higher for sparse fine-tuning in each studied language. As on PAWS-X, these values measure the masked predictors on the corresponding language’s test examples.

The attribution comparison tells a different part of the story. Some masks receive a smaller positive contribution from their own language after being used for sparse fine-tuning. The paper calls out Korean on PAWS-X and Chinese, French, and Spanish on MARC. The absolute distributions still show substantial positive influence from each subnetwork’s own language. Lower concentration means that other languages occupy more of the influential set relative to the reference, which is compatible with the same language remaining a major source of support.

Putting the scores alongside the attributions gives cases in which better prediction coincides with reduced concentration on examples in the test language. The paper uses this evidence to argue that the benefit of sparse fine-tuning cannot be accounted for entirely by the subnetworks becoming more self-reliant. The alternative mechanism the authors examine is use of other languages’ data through heads that the masks share.

### What the ablations show

#### Whether the right heads matter at test time

The first mask controls keep ordinary multilingual fine-tuning and vary which heads are available for German PAWS-X examples at test time. The authors choose German because the identified German mask produced one of the weaker increases in same-language specialization, at +2% for positive influence. A relatively modest effect makes this a useful case for checking whether a mask of the right size might produce a comparable result by chance.

The random control shuffles the entries of the German mask using 3 random seeds. Each shuffled mask keeps the sparsity level of the original while changing the positions of the active heads. These masks make little overall difference to the influence distributions compared with unmasked prediction. The authors find no increase in German influence with the shuffled masks. The result supports the view that the original mask’s selection of heads matters for the observed increase. It tests arbitrary placement of the active heads while holding their count fixed.

The other control borrows an identified mask from a different language. The authors use English as the closer language to German and Korean as the more distant one in this setup. These masks come from the same head selection procedure but are matched to different languages. On German test inputs the English and Korean masks increase Korean negative influence, with the paper reporting the changes as +10 and 8%. The randomized masks show a tendency in the opposite direction for Korean negative influence. The comparison establishes that a language-mismatched, purposefully selected mask can change the ranking differently from a shuffled one. It also shows why the effects of subnetworks are worth measuring in terms of particular training and test language pairs.

Together, the controls distinguish the selection’s content from its size. The count of enabled heads tells researchers how restrictive a mask is. It gives little information about which language’s examples will rise among the most influential once those heads are used. Matching the mask to the test language supplied a signal that the shuffled controls did not reproduce on German PAWS-X. The study leaves that particular control localized to the language and benchmark it tests.

#### What random masks learn during sparse training

The next random-mask test changes the training procedure. The authors shuffle the identified mask for each language, preserving its sparsity, and then use the random mask for both training and prediction. A random set of heads can consequently adapt to the language it has been assigned. This differs from shuffling at evaluation, when the parameters have had no opportunity to adjust to the randomized selection.

The resulting PAWS-X subnetworks rely strongly on same-language training examples. For English, the authors report a +64% change compared with the full-model reference, resulting in 97% reliance on English data for positive influence. The randomized subnetworks nevertheless achieve an average of only ±56% accuracy across languages. This is a counterexample to treating strong same-language concentration as a sufficient measure of a useful subnetwork. A mask can direct learning towards a language’s examples while giving poor task performance.

The authors hypothesize that a random selection of heads has to adapt to the language and task together. The easiest available training evidence may initially come from examples in the language the mask is assigned to. Under their interpretation, cross-language sharing can become useful after the subnetwork learns how to exploit that immediate evidence. The experiment measures learning outcomes and influence rankings. The proposed order in which the random masks acquire different kinds of information is an explanation for those outcomes.

The two random controls are thus informative for different reasons. Shuffling only at test time asks whether comparable pruning can expose the same behavior in an already trained predictor. Training with shuffled masks asks whether a poor initial assignment can acquire a concentrated pattern of reliance through repeated language-specific updates. The first gives little evidence of the original specialization effect for German. The second produces a great deal of same-language concentration, alongside low accuracy across languages. A specialization measure needs accurate task performance as context in both cases.

#### Specialization and accuracy across checkpoints

The French PAWS-X result motivates a broader analysis. French is the language whose masked accuracy declines with sparse fine-tuning, and its subnetwork also has the strongest reported increase in same-language specialization in that experiment, at +6%. This raises the question of whether greater language concentration is generally associated with better task performance.

The authors compare specialization and accuracy for all languages and saved checkpoints in PAWS-X and MARC. In both tasks, greater specialization is negatively correlated with accuracy. This goes beyond the individual French case. It shows that the checkpoints and languages with more concentrated positive influence from their own language tend to be those with poorer task performance. The result is consistent with the interpretation that effective subnetworks take advantage of cross-language evidence.

Checkpoint measurements also give a view of how the relationship develops. The main attribution comparison sums contributions over epochs, while the additional analysis makes a separate ranking for each checkpoint. For PAWS-X, the authors find that both kinds of fine-tuning reach similar maximum levels of cross-language sharing, corresponding to ∼25% same-language reliance. The difference is in how broadly that behavior is available. Under sparse training with the identified masks, all training languages begin drawing more on other languages. Under full fine-tuning, Korean and English stay more isolated. The authors report a similar general trend for MARC, with a different pattern of individual language trajectories.

On PAWS-X, sparse training with randomized masks also leaves Korean and English comparatively isolated. That resembles the uneven sharing seen under full fine-tuning more than the pattern under sparse fine-tuning with the identified masks. This checkpoint comparison suggests that the benefit of the identified masks concerns participation in sharing across languages. The best level of sharing reached anywhere in training can be similar even while the coverage of that behavior differs across languages.

#### Where overlap is associated with positive influence

The authors next compare the masks themselves. They flatten each mask into a vector and compute cosine similarity between masks for language pairs. In this application of cosine similarity, the entries record whether heads are active. A higher cosine means the two masks select more of the same heads relative to the sizes of their selections. This quantity is distinct from cosine similarity between gradients. One measures structural overlap, and the other measures agreement in what a training or test example locally asks from the parameters.

For PAWS-X and MARC, greater structural similarity is associated with more positive cross-language influence in the absolute contribution of training languages. Since overlapping heads can participate in training for both languages, this is consistent with positive transfer taking place through those heads. The authors find no comparably strong relationship between overlap and negative cross-language influence. This gives a reason to consider positive and negative influence separately. Sharing more heads can accompany stronger positive support without a matching pattern of greater negative influence over the measured pairs.

An additional way to display structural overlap is to ask what share of one mask’s active heads appears in the other mask. These percentages can depend on which language is the starting point. On PAWS-X, English shares 75% of the heads active for German, while German shares 88% of those active for English. The paper explains that the English mask retains fewer heads. On XNLI, the German-to-English share is 100%, while the share in the other direction is 73%. The underlying set of shared positions is the same within each pair. The reported percentage depends on the originating mask’s size.

The head selections have broadly similar sparsity within a task but still differ in where they retain capacity. The appendix reports, for instance, 42 disabled heads for German on PAWS-X and 56 for English. For XNLI, it reports 70 disabled for German and 42 for English. On MARC, the Chinese mask disables 84 heads. These counts describe the pruning outcomes. The overlap analysis adds information about the positions of the enabled heads, which is needed to interpret how languages can interact under sparse training.

MARC subnetworks overlap more on average than PAWS-X subnetworks. The authors suggest that this could help explain their weaker language specialization after sparse fine-tuning. More overlap gives more languages access to some of the same parameters. The resulting behavior remains task-dependent, since the datasets differ in content, task objective, and the languages included. The comparison describes an association across these experiments rather than a manipulation of overlap alone.

#### Why the layer and the way masks are combined matter

The authors also compute overlap within individual layers and compare it with positive cross-language influence. Some layers have similarities that are more indicative of language-pair influence than others. PAWS-X and MARC show similar layer-wise patterns in that analysis, even though their complete masks differ considerably. This suggests that where overlap occurs can be informative in addition to the amount of overlap across the whole system.

The mask visualizations give a related perspective. The authors find heads that are unused by any language in each task, and heads that all languages share. Fully shared heads appear especially in lower layers for PAWS-X and higher layers for XNLI. The authors relate this pattern to earlier work associating lower layers with more syntactic processing and higher layers with semantic processing. Paraphrase identification in their discussion draws more on low-level syntactic information than inference does. The shared-head locations are compatible with that account, with the layer comparison leaving the detailed function of an individual head open. [BERT Rediscovers the Classical NLP Pipeline](https://md.research.elamur.ai/free/en/papers/tenney-2019-bert-rediscovers-classical-nlp-pipeline/)

Finally, the authors ask whether masks can be composed to direct cross-language influence at test time. They take pairs of identified masks from a run trained with sparse fine-tuning. An intersection keeps only the heads present in both masks. A union keeps any head active in either. The combined masks are used for prediction after training with the individual language masks. The intervention changes which learned components can contribute at evaluation, while leaving their trained weights in place.

The clearest positive results occur for pairs already showing increased sharing with their individual masks. These include French and Spanish on PAWS-X and English and German on MARC. For such pairs, intersecting the masks strengthens the existing tendency toward mutual positive influence. Unions produce a smaller sharing effect. For pairs whose individual masks showed no such tendency, the authors find no clear benefit from composing them. The result suggests that selecting jointly active heads can reinforce an existing relationship, while evidence for creating a new one through mask composition remains limited.

### Limitations

#### Limits identified by the authors

The authors identify computational cost as a major constraint. Random projections make gradient comparisons more practical, but the experiment still requires influence estimates for many pairs of training and test examples at saved checkpoints. The resulting study uses one underlying pretrained system, a limited number of training examples, and classification tasks chosen to work with those data. The authors explain that the cost prevented them from studying a wider range of systems and sizes.

The setup also favors tasks compatible with sequence-level attribution. TracIn relates a whole training example to a prediction on a test example. The method is therefore a natural fit for classification or regression at the sequence level. A task in which different positions or structured outputs call for separate credit assignments would raise a different measurement problem. The authors give masked language modeling and [dependency parsing](https://md.research.elamur.ai/free/en/concepts/dependency-parsing/) as examples of tasks that could require more language-specific information than those studied.

The task simplifications matter to how the findings should be read. The XNLI experiment separates entailment from the other relations, and the MARC experiment uses the grouped positive and negative ratings. The authors suggest that relatively easy tasks could limit how much sparse fine-tuning can improve performance and how pronounced the resulting specialization effects become. A more demanding task might change the usefulness of language-specific capacity as well as the opportunities for sharing.

The paper also identifies the number of languages as an open issue. As masked paths have to accommodate more languages, more of their available capacity may have to overlap. The authors propose testing whether sparse fine-tuning still works under that pressure. They also propose studying how to exploit overlap for positive influence while keeping negative influence under control. Their observations on the selected languages establish a relationship worth investigating at larger scale.

#### Limits of what the design establishes

The starting point for the natural specialization claim is a pretrained system that has already undergone multilingual fine-tuning for a task. The language masks are then deliberately discovered by evaluating performance in individual languages. The finding establishes that useful language-related structure can be uncovered without enforcing those masks during multilingual adaptation. The timing and origin of that structure remain open. It could reflect properties acquired during pretraining, changes made during task adaptation, or a combination.

Specialization here is operationally defined through attribution rankings. The measure depends on a pruning method, a unit of pruning, a retained-performance criterion, and a cutoff for influential examples. A head selection that preserves performance under this rule can show a particular pattern of positive and negative influence. The experiment does not exhaust the possible ways of partitioning the network or describing its linguistic organization. A different unit of analysis could reveal properties of parts of the system outside the selected attention heads.

The attributions themselves are gradient-based estimates from saved states. They provide a principled way to compare many examples at reasonable cost, but they do not directly measure the effect of removing an example and rerunning training. The use of cosine similarities emphasizes gradient directions, and retaining the most extreme examples emphasizes the ranking tails. An increase in the share of one language means it becomes more represented in the selected set. It gives no independent measurement of how the combined effect of all examples from that language changes.

Evaluation on common correct cases makes the influence comparison easier to interpret, since it holds the input and correctness outcome fixed. It also narrows the claim. The influence distributions characterize successful predictions by both predictors in a comparison. The examples on which a subnetwork uniquely succeeds, or on which either predictor fails, can have different patterns. Test accuracy records the broader success rate, while the paired attributions answer a question about how those shared successes are supported.

The two parallel datasets and the independently authored review corpus offer complementary evidence. In parallel data, equal representation and aligned content improve comparability across training languages. Strong cross-language support can draw on another version of the same underlying example. MARC avoids that form of alignment, while allowing language samples to differ in review content as well as language. These setups support complementary readings of cross-language influence. Neither alone identifies a language effect with all properties of the examples held fixed.

Finally, the main sparse-training intervention changes the forward computation and the gradients used for updates together. The comparison therefore measures the combined procedure. The checkpoint correlations also pool changes in training state with differences between languages. A negative association between specialization and accuracy can arise when learning improves and sharing expands together. The overlap analysis relates masks selected for functioning subnetworks to their attribution behavior. Establishing how much added overlap itself improves accuracy would require deliberately varying that overlap while keeping other relevant properties comparable.

### What came after

Follow-on studies of this paper’s method are undocumented here. Its conclusion and additional experiments leave two connected questions about what a successor could establish. The layer-wise analysis suggests that the placement of shared heads may matter as much as the total number shared. The composition experiment shows that selecting the intersection of two masks can strengthen positive exchange when the individual masks already support it. An open question is whether training can make that exchange controllable for pairs that share little positive influence initially.

Scale is the other question the authors leave open. With more training languages, a sparse assignment has to accommodate more potential sources of support and conflict. Testing the same attribution and accuracy comparisons at that scale would show whether the favorable relationship between overlap and positive influence persists. The evidence in this paper comes from the smaller setting, where masked training can improve performance and broaden the use of other languages’ examples even as some subnetworks become less reliant on examples in their own language.

## Cite

Cite as Rochelle Choenni, Ekaterina Shutova and Dan Garrette. 2024. Examining Modularity in Multilingual LMs via Language-Specialized Subnetworks. Findings of the Association for Computational Linguistics: NAACL 2024.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2024.findings-naacl.21](https://doi.org/10.18653/v1/2024.findings-naacl.21)

```bibtex
@inproceedings{choenni2024examining,
  title = {{Examining Modularity in Multilingual LMs via Language-Specialized Subnetworks}},
  author = {Rochelle Choenni, Ekaterina Shutova and Dan Garrette},
  booktitle = {Findings of the Association for Computational Linguistics: NAACL 2024},
  year = {2024},
  doi = {10.18653/v1/2024.findings-naacl.21},
  url = {https://doi.org/10.18653/v1/2024.findings-naacl.21}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
