- Introduced by
- Le, Q. V. & Mikolov, T. (base Doc2Vec); semi-supervised extensions by various authors circa 2015–2019
- Year
- 2014–2017
- Type
- Semi-supervised representation learning
- Family
- Deep learning / NLP / CV
What does it do?
Semi-supervised Doc2Vec is a variant of the Paragraph Vector framework introduced by Le and Mikolov (2014).
It learns dense document embeddings from labeled and unlabeled text, primarily in one joint training process, and uses class labels on a subset of documents as an auxiliary signal that shapes the embedding space toward task-relevant structure.
The intuition behind the method
Doc2Vec already learns a fixed-length vector for every document by predicting surrounding words in context. In the semi-supervised variant, a small share of documents carry class labels, and those labels are injected as additional prediction targets during training, acting like a gentle compass that nudges the embedding space so that similar-class documents cluster together. The large unlabeled majority helps limit overfitting to the few labeled examples, giving the representation the breadth of an unsupervised model with some of the discriminative sharpness of a supervised one.
History
The Paragraph Vector (Doc2Vec) framework was introduced by Quoc Le and Tomas Mikolov at ICML 2014 as a document-level extension of word vector learning. Semi-supervised variants add label-aware auxiliary losses to the PV-DM or PV-DBOW objectives. Transformer models have since become dominant in many text tasks, while semi-supervised Doc2Vec remains an option in low-resource and domain-specific classification.
When to use it
Choose this method for text classification, sentiment analysis, or topic labeling when labeled examples are scarce relative to a much larger unlabeled corpus from the same domain. It is most relevant in specialized settings, such as clinical notes, legal documents, or scientific abstracts, where general pretrained transformer models may give weak coverage. Avoid it when the unlabeled corpus is small, because the embeddings may underfit. It is also a poor fit when many documents must be embedded in real time, since inference requires a gradient-descent pass per document. When a large labeled dataset is available, supervised training of a transformer may already be sufficient, and whether the unlabeled corpus adds value should be checked by benchmarking.
Limitations and considerations
- Inference for unseen documents needs an additional gradient-descent pass per document, which becomes slow when many documents must be embedded.
- The results are sensitive to the labeled-to-unlabeled ratio and to the weight given to the supervised auxiliary loss.
- Where many labels are available, supervised transformer fine-tuning is a relevant alternative, and comparative benchmarking is needed before assuming a Doc2Vec-based approach is competitive.
- Document vectors trained with a bag-of-context objective capture long-range syntactic and semantic dependencies less explicitly than attention-based architectures.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Uses unlabeled documents in the same training run, so the representation is shaped by more text than the labeled subset alone.
- Produces one fixed-length vector per document, so a simple downstream classifier such as logistic regression can be trained on top at low cost.
- Does not require a pretrained language model; the embeddings are trained on the corpus at hand, which suits domain text that general pretrained models cover poorly.
- A single auxiliary-loss weight controls how strongly labels influence the embedding, so the balance between supervised and unsupervised signal is adjustable in one place.
- Its architecture is lighter than transformer-based models, so training may be less demanding in compute; the actual cost depends on corpus size and configuration and should be measured.
Applications
- Low-resource document classification in specialized domains such as biomedical or legal text.
- Sentiment analysis when only a fraction of reviews carry explicit rating labels.
- Scientific abstract categorization where full-text annotation is expensive.
- Document retrieval and clustering with the learned embeddings, where the label-shaped geometry may help; the benefit should be checked on held-out data.
How it works
How it works
The labeled and unlabeled documents are pooled and tokenized, and each document receives a unique ID token. Labeled documents are usually a small fraction of the corpus. The appropriate labeled share depends on the task and should be determined empirically on held-out labeled data. Labeled documents are flagged so that the label-injection step can target them.
The standard Doc2Vec objective (PV-DM or PV-DBOW) is applied to all documents, so each document's ID vector is updated to predict the words it contains. This phase is unsupervised and uses the full corpus, which means unlabeled documents still contribute to the shared embedding space.
For labeled documents, the training loss is augmented with a supervised term over the class labels, for example a softmax cross-entropy for single-label classification. The weight of this auxiliary term is a hyperparameter that sets how strongly the labels reshape the embedding geometry relative to the unsupervised objective.
After joint training, the labeled document vectors may be refined with a supervised objective, optionally with a lightweight classifier head on top. Whether the final classifier is trained on vectors from joint training or on vectors produced by this refinement is a pipeline choice, and the choice should be stated in any reported results so that the procedure can be reproduced. Unlabeled document vectors receive gradient only from the unsupervised term, but label information still reaches them indirectly through the shared model parameters.
For a new document, a vector is inferred by gradient descent on its ID token while the other model weights stay frozen. The inferred vector is then passed to the trained classifier, such as logistic regression or a shallow MLP, to produce a class prediction.
Common pitfalls
- Evaluation must use a labeled held-out split that is not used for training. Unlabeled documents have no labels, so they cannot contribute to accuracy estimates, and a split drawn from the labeled training distribution can inflate performance.
- Setting the auxiliary label-loss weight too high lets the small labeled set dominate training and weakens the signal from unlabeled documents.
- Using document vectors from an unconverged stage of joint training, rather than the final state, degrades downstream accuracy.
- Treating semi-supervised Doc2Vec as a drop-in replacement for transformer fine-tuning without benchmarking both on the target task.
Frequently asked questions
How is semi-supervised Doc2Vec different from plain Doc2Vec?
Plain Doc2Vec is entirely unsupervised: it learns document vectors purely from word co-occurrence without using any class labels. The semi-supervised variant adds a class-conditional loss for the labeled subset, bending the embedding geometry toward discriminative structure while still exploiting all unlabeled documents for coverage.
When should I prefer semi-supervised Doc2Vec over BERT fine-tuning?
It is worth considering when labeled examples are very few and a large unlabeled corpus exists in a narrow domain where general-purpose pretrained transformers have weak coverage, such as specialized clinical or legal text. Neither approach is guaranteed to win in that setting, so both should be benchmarked on held-out labeled data before a choice is made.
How do I set the auxiliary label-loss weight?
The weight is a hyperparameter with no default value on this page. Tune it on a held-out labeled validation set, trying several values. A very large weight risks suppressing the unsupervised signal, while a very small weight makes the model behave almost like plain Doc2Vec.
Can I use semi-supervised Doc2Vec for multi-label classification?
Yes. The change is in the auxiliary loss: a sigmoid binary cross-entropy applied independently to each label replaces the softmax cross-entropy. The rest of the procedure stays the same.
Does the unlabeled corpus need to be in the same domain as the labeled data?
Not strictly, but the closer the domains are, the more the unlabeled data benefits the task-relevant embedding. Out-of-domain unlabeled text dilutes the signal and may hurt performance if it dominates the corpus.
Related methods
Sources
Le, Q. V., & Mikolov, T. (2014). Distributed Representations of Sentences and Documents. Proceedings of the 31st International Conference on Machine Learning (ICML 2014), PMLR 32(2), 1188–1196.
Open publication referenceWord2vec. Wikipedia.
Open publication reference