- Type
- Multilingual NLP representation task
What does it do?
Cross-lingual text analysis encodes documents written in different languages with a multilingual transformer, such as mBERT or XLM-R, into one shared vector space, so they can be studied together without translation.
It builds on Pires et al. (2019), who examined how well multilingual BERT transfers across languages, and on Conneau et al. (2020), who introduced XLM-R. The shared space is what allows texts from several languages to be compared directly.
The intuition behind the method
When research material spans several languages, equivalent expressions occupy different vocabularies, so a model trained on one language cannot read the others. This approach projects text from each language into a single shared space where passages with similar meaning tend to sit close together, whatever language they were written in. Once everything is in that space, documents can be compared, clustered, or contrasted across languages. The closeness is an approximation, though: how well it holds varies between languages, as discussed under pitfalls.
History
Cross-lingual analysis grew out of multilingual representation learning. Pires et al. (2019) examined multilingual BERT and found that it transfers across languages, with the strongest transfer between typologically similar languages and systematic deficiencies for some language pairs. Conneau et al. (2020) introduced XLM-R and showed that unsupervised cross-lingual representation learning can be scaled up. These models provide the shared multilingual vector spaces on which this analysis relies.
When to use it
Choose cross-lingual analysis when your material is in two or more languages and the question requires comparing or exploring it jointly, for example contrasting how a topic appears in each language. Check first that a multilingual model covers your languages, because transfer quality varies between language pairs. Do not use it when all texts are in one language; a monolingual pipeline is simpler and avoids the additional questions a shared multilingual space raises. Stability depends on corpus size and should be checked on your own data, as described under limitations. The method applies to textual documents.
Limitations and considerations
- Transfer quality depends on the languages involved. Pires et al. (2019) found that zero-shot transfer works best between typologically similar languages and that M-BERT representations show systematic deficiencies for certain language pairs. Whether this affects a given comparison should be checked directly for the pairs under study.
- Language imbalance in the corpus may affect the shared space and bias comparisons toward the better-represented languages. Record how many documents each language contributes and check how each one is represented.
- Stable results need a reasonable amount of material, and very small corpora can give unstable comparisons. The amount required depends on the corpus and the comparisons being made, so check stability by seeing whether the main comparisons change when documents are added or removed.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Places texts from different languages in one vector space, so they can be compared directly without a translation step.
- Uses pretrained multilingual transformers such as mBERT and XLM-R, so a separate model does not have to be built for each language. Pires et al. (2019) summarise mBERT as released by Devlin et al. (2019) as a single model pretrained on monolingual corpora in 104 languages.
- Supports joint comparison of how a shared topic or theme is expressed across languages, which per-language pipelines cannot provide within a single space.
Applications
- Comparing how a topic is discussed across documents written in different languages.
- Exploring and clustering multilingual corpora in humanities and social-science research.
- Cross-language information retrieval and similarity search.
- Studying multilingual public discourse or literature within a single shared space.
How it works
How it works
Texts in the languages of interest are gathered into one multilingual corpus. Results depend on how much material each language contributes, so the number of documents per language should be recorded at this stage.
Each document is encoded with a multilingual transformer such as mBERT or XLM-R. These models are pretrained on text from many languages together, so they produce vectors in one shared space rather than a separate space per language. mBERT was released by Devlin et al. (2019) as a single model pretrained on monolingual corpora in 104 languages, as summarised by Pires et al. (2019). Transformers accept inputs only up to a maximum length, so long documents must be truncated or split into chunks. The token-level outputs are then typically pooled, for example by averaging, into one vector per document.
This stage does not learn an explicit mapping between languages. The shared space comes from the pretrained model, so the stage is a check on that space rather than an alignment step. Before comparing, confirm that the languages of interest are covered by the chosen model, and record how much each language contributes, since a heavily over-represented language may affect comparisons.
Within the shared space, documents are compared with a similarity measure, most commonly cosine similarity between document vectors. Documents can then be clustered, related across languages, or contrasted to show how a topic is expressed in each language. Similarity values are approximate: a high score means two texts lie close together in the model's space, not that they are equivalent in meaning, so results should be checked against the texts themselves.
Common pitfalls
- Ignoring language imbalance: a heavily over-represented language may dominate the shared space and skew comparisons, so track how much each language contributes and account for it when interpreting results.
- Using a model that does not cover one of the corpus languages, which may leave those documents poorly represented in the shared space.
- Assuming the shared space is equally well aligned for every language pair. Pires et al. (2019) report systematic deficiencies affecting certain language pairs, so quality should be checked for the specific pairs being compared.
Frequently asked questions
Which model should I use, mBERT or XLM-R?
Both are multilingual transformers that produce a shared cross-lingual space. mBERT (multilingual BERT) was an early such model, while XLM-R, introduced by Conneau et al. (2020) as a model for unsupervised cross-lingual representation learning at scale, is the later model. Which performs better depends on your languages, so compare them on a sample of your own data and check coverage of each language.
Do I need to translate my texts first?
No. The point of cross-lingual analysis is to avoid translation: each document is encoded directly with a multilingual model into a shared space, so texts in different languages can be compared without a translation step.
Why does language balance matter?
If one language dominates the corpus, it may distort the shared vector space and bias comparisons toward that language. Tracking how much material each language contributes, and accounting for imbalance, helps keep the analysis fair across languages.
How much text do I need?
The amount needed depends on your corpus and on the comparisons you make, so there is no fixed number to rely on. To check stability, see whether the main comparisons change noticeably when documents are added or removed.
Related methods
Sources
Conneau, A. et al. (2020). Unsupervised Cross-lingual Representation Learning at Scale. Proceedings of ACL.
Open DOI referencePires, T., Schlinger, E. & Garrette, D. (2019). How Multilingual is Multilingual BERT? Proceedings of ACL.
Open DOI reference