Embedding structure matters: Comparing methods to adapt multilingual vocabularies to new languages

C. M. Downey, Terra Blevins, Nora Goldfine, Shane Steinert-ThrelkeldarXiv 2023

Abstract

Pre-trained multilingual language models underpin a large portion of modern NLP tools outside of English. A strong baseline for specializing these models for specific languages is Language-Adaptive Pre-Training (LAPT). However, retaining a large cross-lingual vocabulary and embedding matrix comes at considerable excess computational cost during adaptation. In this study, we propose several simple techniques to replace a cross-lingual vocabulary with a compact, language-specific one. Namely, we address strategies for re-initializing the token embedding matrix after vocabulary specialization. We then provide a systematic experimental comparison of our techniques, in addition to the recently-proposed Focus method. We demonstrate that: 1) Embedding-replacement techniques in the monolingual transfer literature are inadequate for adapting multilingual models. 2) Replacing cross-lingual vocabularies with smaller specialized ones provides an efficient method to improve performance in low-resource languages. 3) Simple embedding re-initialization techniques based on script-wise sub-distributions rival techniques such as Focus, which rely on similarity scores obtained from an auxiliary model.

Introduction

Pre-trained multilingual models (mPLMs) like XLM-R have become indispensable for global NLP, providing coverage for hundreds of languages. When adapting these models to specific, often low-resource, languages (e.g., Erzya or North Sami), researchers typically employ Language-Adaptive Pre-Training (LAPT).

However, a significant efficiency bottleneck exists: "vocabulary bloat." mPLMs utilize massive shared vocabularies—often exceeding 250,000 tokens—to ensure broad linguistic coverage. When specializing for a single target language, only a small fraction of these tokens are utilized. Despite this, the model retains the full embedding matrix, which can constitute up to 70% of the total parameters and incur substantial computational overhead. Simply replacing the vocabulary with a smaller, language-specific one often leads to catastrophic performance drops because randomly initialized embeddings are misaligned with the pre-trained transformer layers.

Methodology

This study investigates how to replace large cross-lingual vocabularies with compact (32k token) language-specific ones without sacrificing the knowledge embedded in the model's weights. We compare several re-initialization strategies designed to align new embeddings with the existing transformer architecture:

  1. REINIT-IDENT (Identity): This baseline copies embeddings for tokens that are present in both the original and the new specialized vocabulary.
  2. REINIT-SCRIPT: New tokens are initialized by sampling from the distribution (mean and standard deviation) of all tokens belonging to the same Unicode script (e.g., Cyrillic, Latin, Armenian) in the original model.
  3. REINIT-POSN (Position): This method refines script-based initialization by distinguishing between "word-initial" tokens and "word-medial" tokens. PCA analysis suggests these categories occupy distinct sub-clusters within the embedding space.
  4. FOCUS: A more complex baseline that utilizes an auxiliary model (FastText) to identify semantically similar tokens in the original vocabulary, using their embeddings to compute a weighted average for new tokens.
PCA visualizations of the four proposed re-initialization strategies, showing how they attempt to map new tokens into the existing embedding space.

The effectiveness of these methods is evaluated under two training regimes: LAPT-FULL (fine-tuning all layers) and LAPT-EMB (training only the new embeddings while freezing the transformer encoder).

Experimental Setup

The models were pre-trained on data sourced from OSCAR v.22.01, OPUS, and the JHU Bible Corpus, focusing on a diverse set of languages including Armenian, Basque, Erzya, Estonian, Finnish, Hebrew, Hungarian, Russian, North Sami, and Telugu. Performance was benchmarked on two core syntactic tasks:

  • Part-of-Speech (POS) Tagging: Using Universal Dependencies (UD) treebanks.
  • Named Entity Recognition (NER): Using the WikiAnn benchmark.

Key Insights: The Structure of Embedding Space

A fundamental observation of this work is that mPLM embedding spaces are highly structured rather than arbitrary. PCA visualizations reveal that tokens naturally cluster based on their Unicode script and their relative position within a word.

PCA visualization of the XLM-R embedding space, illustrating clear clustering based on Unicode scripts.
  • Failure of Random Initialization: In monolingual transfer, random initialization is often sufficient. However, in multilingual adaptation, it fails because it ignores the specific "neighborhoods" the transformer layers expect for certain scripts or positions.
  • Structural vs. Semantic Cues: Surprisingly, simple structural heuristics (Script + Position) perform as well as, or better than, the FOCUS method, which requires an auxiliary model. This suggests that a token's distributional "location" is often more critical for the transformer's initial adaptation than its precise semantic meaning.
  • Computational Efficiency: Utilizing specialized vocabularies allows for a 2x to 3x reduction in total Floating Point Operations (FLOPs) during adaptation with negligible loss in accuracy, creating a more efficient Pareto frontier for model specialization.

Key Results

  • Full Fine-tuning is Essential: LAPT-FULL consistently outperformed LAPT-EMB across all tasks. Freezing the encoder leads to a significant performance penalty, such as a ~7-point drop in POS accuracy.
  • Vocab Replacement Success: For the majority of tested languages (5/8 in POS, 5/7 in NER), models with compact, specialized vocabularies outperformed the original "full-sized" XLM-R baseline.
  • Low-Resource Gains: For extremely low-resource languages like Erzya, script-based initialization was particularly effective, outperforming the more complex FOCUS method.

Conclusion

This study demonstrates that replacing bloated cross-lingual vocabularies with specialized ones is an effective and efficient strategy for language adaptation. By leveraging the inherent structure of the embedding space—specifically script and position—simple re-initialization techniques can rival more computationally expensive semantic methods. Future research should investigate whether these structural patterns hold for decoder-only architectures and higher-level semantic tasks.

Summary updated

BibTeX
@misc{downey2023embedding,
  author = {C. M. Downey and Terra Blevins and Nora Goldfine and Shane Steinert-Threlkeld},
  title = {{Embedding structure matters: Comparing methods to adapt multilingual vocabularies to new languages}},
  year = {2023},
  eprint = {2309.04679},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.04679},
}
Figure