Abstract
Modern multilingual pretrained language models (mPLMs) aim to serve as universal text encoders. However, the removal of explicit language identifiers in recent architectures forces token embeddings to encode language-specific nuances, hindering crosslingual semantic alignment. We propose LangSAMP (Language-Script Aware Multilingual Pretraining), a method that injects learnable language and script embeddings at the final stage of the model during pretraining. By offloading language-specific information to these auxiliary embeddings, the core Transformer layers are incentivized to learn highly language-neutral representations. LangSAMP significantly improves zero-shot crosslingual transfer, especially for low-resource languages, without requiring language IDs during downstream inference.
Introduction
Multilingual models like XLM-R have revolutionized natural language processing by enabling zero-shot crosslingual transfer. A model fine-tuned on a high-resource language like English can be deployed for tasks in low-resource languages without additional training. While early models utilized explicit language IDs, modern mPLMs often omit them to maintain a "universal" input interface.
The drawback of this approach is that the model's internal representations must now account for all language- and script-specific variations. This leads to a lack of "language neutrality," where semantically identical sentences in different languages occupy disparate regions of the embedding space. This misalignment is particularly detrimental for "tail" languages with limited pretraining data.
Methodology: Decoupling Language and Script
LangSAMP addresses the neutrality problem by introducing a "late-stage hint" mechanism. Instead of providing language information at the input layer—which would necessitate knowing the language at inference time—LangSAMP adds learnable language ($Emb_{Lang}$) and script ($Emb_{Script}$) embeddings to the output of the final Transformer block, just before the Masked Language Modeling (MLM) head.
By providing this information to the prediction head, the model can offload the "heavy lifting" of language-specific prediction quirks. The core Transformer layers are thus freed to focus on learning language-neutral semantic features. Crucially, these auxiliary embeddings and the MLM head are discarded after pretraining. The resulting core model can be used exactly like a standard mPLM, requiring no language or script IDs from the user during downstream fine-tuning or deployment.
Experimental Setup
The model was pretrained on Glot500-c, a diverse corpus covering 610 languages and 30 scripts. Evaluation focused on zero-shot crosslingual transfer across several benchmarks:
- Sentence Retrieval: Bible (SR-B) and Tatoeba (SR-T).
- Text Classification: Taxi1500 and SIB200.
- Sequence Labeling: WikiANN (NER) and Universal Dependencies (POS tagging).
Key Results and Discussion
LangSAMP consistently outperformed baseline models across all tasks. The most significant improvements were observed in sequence-level tasks and for low-resource languages. For instance, on the Taxi1500 classification task, average performance for tail languages increased from 47.1% to 50.8%.
Enhanced Language Neutrality
To verify the increased neutrality, researchers measured the pairwise cosine similarity of semantically equivalent sentences across ten diverse languages. LangSAMP showed higher similarity scores compared to the baseline, confirming that its internal representations are better aligned across the linguistic spectrum.
Emergent Typology and Donor Selection
A fascinating byproduct of LangSAMP is that the learnable embeddings naturally capture linguistic and geographic relationships. Visualizing these embeddings reveals tight clusters of related languages and scripts.
This learned typology enables more intelligent "donor" language selection. While English is the standard choice for fine-tuning, LangSAMP allows practitioners to mathematically identify the closest related language for a specific target. Fine-tuning on a linguistically similar donor often yields dramatic gains; for example, using Chinese instead of English as a donor for Cantonese improved classification accuracy from 55.4% to 67.7%.
Conclusion
LangSAMP demonstrates that architectural decoupling of language-specific information during pretraining is a powerful tool for building more effective multilingual models. By incentivizing the core Transformer to remain language-neutral, LangSAMP improves crosslingual transfer and provides a valuable framework for understanding linguistic relationships in a high-dimensional space.
Summary updated