Abstract
Recent works have demonstrated that multilingual BERT (mBERT) learns rich cross-lingual representations that allow for transfer across languages. This paper investigates the word-level translation information embedded in mBERT and presents two simple methods that expose remarkable translation capabilities without fine-tuning. The results suggest that while some information is recoverable with linear tools, most is encoded non-linearly. Furthermore, the study identifies an empirical language-identity subspace within mBERT representations, supporting the hypothesis that the model decomposes information into language-specific and cross-lingual components.
Introduction
While mBERT has shown remarkable success in "zero-shot" transfer—learning a task in English and performing it in another language—the mechanisms underlying its cross-lingual capabilities remain poorly understood. This research investigates whether mBERT implicitly "knows" how to translate words and how this knowledge is structured within its internal representations. Specifically, it explores whether translation information is accessible through simple linear transformations or buried in complex non-linear patterns.
Methodology
The authors propose two distinct methods to extract translations from a pre-trained, frozen mBERT model:
- Template-based Querying: This non-linear method treats mBERT as a knowledge base by providing a fill-in-the-blank prompt: "The word ‘SOURCE’ in LANGUAGE is: [MASK]." The model's prediction for the
[MASK]token reveals its internal translation mapping. - Analogies-based Translation: This linear approach uses vector arithmetic. A "language vector" is calculated for each language by averaging word embeddings. To translate from English to French, the English word vector is modified by subtracting the "English" vector and adding the "French" vector.
- Iterative Null-space Projection (INLP): To isolate language identity, the authors use INLP to identify and "neutralize" dimensions encoding language membership. This allows for the decomposition of word vectors into a language-encoding component and a language-neutral semantic component.
The Language Subspace
A key finding is that language identity is stored in a specific linear subspace. When word vectors are projected onto this subspace, they cluster distinctly by language.
This clustering confirms that mBERT builds language-specific context as information flows through its layers. Interestingly, higher layers are found to be more "language-aware" than initial embedding layers, separating languages more distinctly as processing progresses.
Key Results
The study yields several significant insights into mBERT's internal logic:
- Translation Accuracy: The template-based method achieved an accuracy@1 of 44.9% and an accuracy@10 of 70.3% across various language pairs. This significantly outperforms a simple nearest-neighbor baseline in the embedding space (3.6% accuracy@1), proving that mBERT is a "closet translator."
- Language Prediction: mBERT excels at identifying target languages from prompts. For Greek, it predicted the correct language 98.6% of the time when the language name itself was masked.
- Linear vs. Non-linear Storage: The superior performance of the template method over the analogy method suggests that while some translation info is "on the surface" (linear), the majority is stored in the model's complex, non-linear processing layers.
- Semantic Preservation: After removing the language-identity component via INLP, the model's predictions for masked words shifted from language-specific to a cross-lingual mix (e.g., "mother" might be predicted as "moeder" or "мать"), while maintaining the core semantic meaning.
Limitations and Future Work
The study is constrained by its focus on single-token words, potentially oversimplifying the challenges of morphologically rich languages. Additionally, the success of the querying method is highly sensitive to template wording, indicating that the model's knowledge is "brittle." Future work should investigate the source of this implicit translation data, potentially tracing it to "accidental" parallel data within Wikipedia.
Summary updated