Multilingual Doc2Vec

Machine Learning
Introduced by
Le, Q. & Mikolov, T. (Doc2Vec); multilingual extension by community
Year
2014–2016
Type
Distributed document embedding (unsupervised / self-supervised)
Family
Deep learning / NLP / CV

What does it do?

Multilingual Doc2Vec extends the Paragraph Vector model of Le and Mikolov (2014) to texts in two or more languages.

It learns one vector per document, aiming to place documents with similar content close together whatever language they are written in. The core training uses monolingual text from each language; a small bilingual lexicon is needed only when the vocabularies are kept separate and must be aligned afterwards.

The intuition behind the method

Doc2Vec assigns each document its own vector, a point in a high-dimensional space that is learned so that it helps predict the words the document contains. Multilingual variants place documents from different languages in one common space. There are two routes: train on a shared or language-tagged vocabulary, or train each language separately and align the resulting spaces afterwards. Either way, the aim is for the vectors to reflect what a document is about rather than the surface words of one language.

History

Le and Mikolov introduced the Paragraph Vector (Doc2Vec) model at ICML 2014 as an extension of Word2Vec to variable-length texts. Multilingual adaptations of the model are generally of two kinds: joint training on concatenated multilingual corpora, or alignment of separately trained vector spaces through a learned cross-lingual mapping.

When to use it

Choose Multilingual Doc2Vec for document-level tasks such as topic classification, clustering, or cross-lingual retrieval across two or more languages, when a compact fixed-size vector per document is needed and compute is limited. It is generally used for moderate-sized corpora, from thousands to hundreds of thousands of documents. This range is a practical guideline rather than a fixed limit, and very small corpora tend to yield less stable vectors. Avoid it when the question depends on sentence-level correspondence; Multilingual Sentence Embeddings are the better fit there. Also consider alternatives when enough labelled data exists and a fine-tuned multilingual BERT or XLM-R fits the available compute, since such contextual models often score higher on classification in reported comparisons.

Limitations and considerations

  • Representation quality is often below that of fine-tuned multilingual transformers such as mBERT and XLM-R on classification and retrieval tasks in reported comparisons.
  • Document vectors are not contextualised: a given word contributes the same vector regardless of its surrounding words.
  • Alignment quality may degrade for typologically distant language pairs or when the anchor lexicon is small.
  • Training is sensitive to hyperparameters such as vector size, window, and number of epochs, and results vary across runs unless a fixed random seed is set.
  • Vectors for documents not seen during training must be obtained through a separate inference step, so the space is not updated when new documents arrive.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Produces fixed-length document vectors that any downstream classifier or clustering algorithm can take directly as input.
  • Core training needs only monolingual text from each language; a small bilingual lexicon can be used for alignment when separate vocabularies are trained.
  • Memory use is modest compared with large transformer models, and vectors for a corpus of documents are cheap to compute.
  • Unsupervised training means no labelled data is needed to learn the embeddings.
  • Cross-lingual transfer is relatively simple: a classifier trained on the vectors of one language can be applied to the vectors of another once the spaces are aligned.

Applications

  • Cross-lingual document classification and sentiment analysis using a single trained classifier.
  • Multilingual document clustering and topic discovery across language boundaries.
  • Cross-lingual information retrieval — ranking foreign-language documents against a query in another language.
  • Multilingual recommendation systems that surface content regardless of the user's language.
  • Lightweight feature extraction for downstream NLP pipelines when transformer compute is unavailable.

How it works

How it works

1

The text of each language is tokenised and preprocessed on its own, because tokenisation rules differ between languages. Each document receives a unique identifier that carries a language tag, so the model can tell a German article from an English one while training both under the same objective.

2

The vocabulary is either merged across languages or kept separate for each language. A merged vocabulary can rely on sub-word units or named entities that recur across languages as anchors. Separate vocabularies require the alignment step described below.

3

The Doc2Vec objective is run over the combined corpus, using either PV-DM, which predicts a word from its surrounding context together with the document vector, or PV-DBOW, which predicts context words from the document vector alone. Document vectors and word vectors are updated together by stochastic gradient descent.

4

When vocabularies are kept separate, a linear mapping is commonly estimated from anchor word pairs in a small bilingual lexicon, for example by orthogonal Procrustes, and used to map each language's space into a common one. This step can be skipped when a single joint vocabulary is used from the start.

5

The resulting document vectors are used as fixed-length, language-agnostic feature representations for downstream tasks such as cross-lingual classification, clustering, retrieval, or similarity ranking. A simple classifier, for example logistic regression, trained on English vectors can be applied to French or Spanish document vectors once the spaces have been aligned. Transfer quality depends on the alignment and should be checked before relying on it.

Common pitfalls

  • Applying one tokeniser to morphologically rich languages such as Finnish or Turkish without language-specific normalisation can produce a larger and noisier vocabulary.
  • Proceeding to downstream tasks without checking the alignment: inspect cross-lingual nearest neighbours for a sample of known parallel documents before using the vectors.
  • Comparing Doc2Vec vectors with transformer embeddings in multilingual benchmarks as if they were interchangeable, without noting the difference in architecture.
  • Leaving the random seed unset, which produces non-reproducible vector spaces and downstream results that differ between runs.

Frequently asked questions

Do I need parallel documents to train Multilingual Doc2Vec?

No. The core training uses monolingual text from each language independently. When vocabularies are kept separate, a small bilingual lexicon is used for the Procrustes alignment step. Alignment quality depends on lexicon size and language distance, so check it with cross-lingual nearest-neighbour tests. Parallel documents can improve alignment but are not required.

How does Multilingual Doc2Vec compare with multilingual BERT?

Multilingual BERT and XLM-R produce contextualised, subword-level representations and, in many reported benchmarks, outperform Doc2Vec on classification and retrieval. Results depend on the task and data, so check on your own held-out data. Doc2Vec is faster to train and deploy, uses less memory, and remains a practical choice when compute is limited or when a simple fixed-vector representation is needed.

What vector dimensionality should I use?

Common practice is 100 to 300 dimensions. These are heuristics rather than rules. Larger vectors can capture more nuance but require more data and compute. For small corpora (fewer than 10 000 documents) a size of 100 is a common starting point. Choose the final dimension by comparing downstream evaluation on held-out data.

PV-DM or PV-DBOW — which should I pick?

The two differ in what the document vector is trained to predict: PV-DBOW predicts context words from the document vector alone, while PV-DM also uses the surrounding words in a context window. Which variant gives better cross-lingual vectors depends on the corpus, so it is worth comparing both on a held-out evaluation. Concatenating the two sets of vectors is one option to test against each model alone.

How do I evaluate the quality of the multilingual embedding space?

Compute cross-lingual nearest-neighbour precision for a held-out set of known parallel document pairs, and measure precision@1 and precision@5. Additionally, run a cross-lingual classification experiment: train a logistic regression on one language's labelled data, test on another language, and compare against a monolingual baseline.

Related methods

Sources

  1. Le, Q., & Mikolov, T. (2014). Distributed representations of sentences and documents. In Proceedings of the 31st International Conference on Machine Learning (ICML), PMLR 32(2), 1188–1196.

    Open publication reference
  2. Multilingualism. Wikipedia.

    Open publication reference