Lifting the Curse of Multilinguality by Pre-training Modular Transformers

Jonas Pfeiffer, Naman Goyal, Xi Victoria Lin, Xian Li, James Cross, Sebastian Riedel, Mikel Artetxe

Abstract

Multilingual pre-trained models typically suffer from the "curse of multilinguality," where per-language performance degrades as the model is forced to cover an increasing number of languages within a fixed parameter budget. We introduce Cross-lingual Modular (X-Mod) transformers to address this limitation. By incorporating language-specific modules during the pre-training phase, we increase the total model capacity while keeping the number of trainable parameters per language constant. Our experiments across natural language inference (NLI), named entity recognition (NER), and question answering (QA) demonstrate that X-Mod not only mitigates negative interference between languages but also facilitates positive transfer. Furthermore, our architecture allows for the post-hoc addition of new languages without performance loss, removing the constraints of a fixed pre-trained language set.

Introduction: The Curse of Multilinguality

In modern Natural Language Processing (NLP), multilingual models like mBERT and XLM-R have become the standard for cross-lingual transfer. However, these models face a fundamental bottleneck known as the "curse of multilinguality." Because these models have a fixed capacity, adding more languages forces the model to share its internal representations across more diverse linguistic structures. This often leads to "negative interference," where the performance on individual languages drops as the model's linguistic scope expands.

While previous research has attempted to use "adapters"—small modules added after a model has been pre-trained—to specialize models for specific languages, these base models are often already hampered by the interference encountered during their initial training. X-Mod proposes a different path: building modularity into the transformer architecture from the very first step of pre-training.

The X-Mod Architecture

The Cross-lingual Modular (X-Mod) transformer is designed to decouple language-specific learning from universal linguistic representation.

Language-Specific Routing

In a standard transformer, all parameters are shared across all languages. In contrast, X-Mod shares the majority of its parameters (such as Multi-Head Attention and standard Feed-Forward layers) but introduces a language-specific bottleneck module in every layer. This module consists of a small "down-projection" and "up-projection" block. During both training and inference, the model routes the input through the module corresponding to that specific language. This ensures that the number of parameters activated for any given input remains constant, even as the total model size grows with the addition of new languages.

Pre-training and Post-hoc Extension

Crucially, X-Mod is pre-trained with these modules from scratch. This allows the shared parameters to focus on universal features while the modules capture language-specific nuances. This modularity also enables a unique capability: post-hoc extension. If a user needs to support a language not included in the original pre-training set, they can freeze the shared weights and train only a new set of language modules and embeddings. This avoids the catastrophic interference typically seen when fine-tuning standard multilingual models on new languages.

Experimental Evaluation

We pre-trained X-Mod models on the CC100 dataset, scaling from 13 to 75 languages. To evaluate performance, we utilized several cross-lingual benchmarks:

  • XNLI: For Natural Language Inference.
  • WikiANN: For Named Entity Recognition (NER).
  • XQuAD & MLQA: For Cross-lingual Question Answering.

Mitigating Interference and Enabling Transfer

Our results show that X-Mod consistently outperforms "Shared" baselines (models with a single shared bottleneck to match X-Mod's per-language parameter count). While the Shared baseline's performance significantly declined as the number of languages increased from 13 to 75, X-Mod's performance remained stable or even improved.

Specifically, on the 60-language setup, X-Mod achieved an average XNLI accuracy of 73.5% compared to the Shared baseline's 72.5%. The gap was even more pronounced in NER tasks, where X-Mod reached a 62.8 F1 score against the baseline's 58.8. This suggests that X-Mod successfully avoids negative interference and, in some instances, benefits from positive transfer, where the shared parameters learn more robust representations due to the diversity of the input data.

Key Insights

  1. Modularity as a Long-term Investment: Modular models require more update steps to reach peak performance compared to fully shared models. However, this "kick-in" period results in a significantly higher performance ceiling as training progresses.
  2. The Necessity of Early Modularity: We found that adding modules post-hoc to a standard multilingual model does not yield the same benefits. If the base model is already "cursed" by interference during pre-training, subsequent modularization cannot fully recover the lost performance.
  3. Seamless Language Addition: X-Mod's ability to add new languages post-hoc resulted in performance nearly identical to models where those languages were included in the initial pre-training, providing a scalable solution for low-resource or emerging language support.

Conclusion and Future Directions

X-Mod represents a significant step toward scalable, high-performance multilingual NLP. By moving away from a "one-size-fits-all" parameter sharing approach, we can build models that grow in capacity alongside their linguistic diversity.

Future work will focus on improving the stability of the model when adding extremely low-resource languages, which currently suffer from infrequent module updates. Additionally, we aim to explore the impact of X-Mod on a wider variety of language families and more diverse source languages for cross-lingual transfer beyond English.

Summary updated

BibTeX
@inproceedings{pfeiffer2022lifting,
  author = {Jonas Pfeiffer and Naman Goyal and Xi Victoria Lin and Xian Li and James Cross and Sebastian Riedel and Mikel Artetxe},
  title = {{Lifting the Curse of Multilinguality by Pre-training Modular Transformers}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=KSgj0UdTCL},
}
Figure