- Introduced by
- LeCun, Y. and community (formalized ~2018–2020)
- Year
- 2018–2020
- Type
- Representation learning paradigm
- Family
- Machine learning
What does it do?
Self-supervised learning (SSL) trains a model on unlabeled data by first defining an auxiliary pretext task whose targets are derived from the data itself, such as predicting masked words, rotating images, or matching augmented views of the same sample.
The encoder learned on this task is then reused for downstream tasks that have only a small labeled set.
The intuition behind the method
Most real-world data is unlabeled. Self-supervised learning uses it by inventing a prediction problem that the data can answer by itself, for example hiding part of a sentence and asking the model to recover it. Solving that problem requires the model to encode regularities of the data, such as grammar or object shape, in its internal representation. If the representation is useful, a small labeled dataset is often enough to adapt it to a specific task, which reduces the labeling needed compared with training from scratch.
History
The idea of learning from unlabeled data through proxy tasks predates deep learning. The term self-supervised learning became prominent around 2018–2020, when BERT (Devlin et al., 2018) in NLP and MoCo and SimCLR in computer vision used this approach. Yann LeCun is associated with popularising the term; a 2022 Meta AI blog post by LeCun and Misra describes SSL as the 'dark matter of intelligence'. The approach now underlies many large language and vision models.
When to use it
Choose self-supervised learning when a large unlabeled corpus from your target domain is available and labels are expensive or slow to obtain, as is common in medical imaging, NLP, satellite imagery and scientific data. It is also the usual route when building large foundation models (BERT, GPT, DINO). For most applied projects, the practical option is to reuse a publicly available SSL-pretrained checkpoint and fine-tune it on your labeled data. Running your own SSL pre-training stage is mainly worth its cost when the domain is highly specialized and existing checkpoints transfer poorly. Avoid SSL when the unlabeled corpus is small, when no pretext task aligns with the downstream task, or when compute is tightly limited. In those cases, supervised training on the available labels is usually more practical.
Limitations and considerations
- Pre-training large models needs substantial compute and large unlabeled corpora; this entry's reference point is days to weeks on GPUs or TPUs.
- The pretext task is a design choice with no automatic guarantee. A task that can be solved from low-level cues, such as texture, may yield representations that lack the semantics the downstream task needs.
- Fine-tuning is sensitive to the learning rate and to how many layers are unfrozen, so results can vary between runs.
- Pretext performance is an indirect proxy: a lower pretext loss does not reliably imply higher downstream accuracy.
- When the pre-training corpus differs from the target domain, the learned features may transfer poorly, and the size of this domain gap largely determines how much is gained.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Can draw on large unlabeled corpora, which typically far exceed the available labeled data; this is the main reason it scales to large pre-training runs.
- Pre-training is done once, so one encoder can serve several downstream tasks, each with a small labeled set.
- Supervision comes from the data's own structure (masked tokens, augmented views, frame order), so the pre-training stage needs no annotation.
- Cross-modal pretext tasks, such as matching paired images and text, allow multi-modal representations to be learned from naturally paired data.
- Embeddings from the pre-trained encoder can be used directly for retrieval, clustering and similarity-based anomaly detection before any fine-tuning.
Applications
- Pre-training large language models (BERT, GPT, T5) for NLP tasks such as classification and question answering.
- Vision foundation models (DINO, MAE, SimCLR) for image recognition, segmentation, and retrieval.
- Medical image analysis where labeled scans are scarce but unlabeled images are plentiful.
- Speech and audio representation learning (wav2vec, HuBERT) for ASR and speaker verification.
- Molecular and protein representation learning (ChemBERTa, ESM) for drug discovery.
- Anomaly detection and retrieval via embedding similarity without labeled anomalies.
How it works
How it works
The pretext (auxiliary) task is designed so that its targets come from the structure of the data, without human annotation. Examples include masked token prediction in text (BERT), next-frame prediction in video, and maximizing agreement between differently augmented views of the same image (SimCLR, MoCo). The design of this task determines which structure the encoder is pushed to learn.
A neural encoder maps each input x to a dense representation z = f(x; theta). The architecture depends on the modality: Transformers for text and vision, convolutional networks for audio, or graph neural networks for molecular data. This representation is what is carried over to downstream tasks.
Formula
z = f_{\theta}(x)Training minimizes a loss that scores performance on the pretext task: cross-entropy for masked prediction, the InfoNCE contrastive loss for agreement between views, or reconstruction error for autoencoder-style objectives. Minimizing this loss is what shapes the representation.
After pre-training, the encoder is transferred to a downstream task. A lightweight classification or regression head is attached, and either the whole model or only the head is trained on the labeled set. Gains relative to fully supervised training depend on the task and should be measured for the case at hand.
Common pitfalls
- Choosing a pretext task without checking whether the invariances it encourages match the downstream task; for example, augmentations that remove colour can hurt a task that depends on colour.
- Pre-training on a small or unrepresentative unlabeled corpus, which can give features that score well on the pretext loss but not on the target domain.
- Fine-tuning all layers at a high learning rate, which can overwrite the pre-trained representation (catastrophic forgetting).
- Reporting downstream accuracy without a baseline trained with direct supervision or without pre-training, so the contribution of the pre-training stage stays unknown.
- Treating augmentation choice in contrastive methods as a minor detail. Augmentations define which variations the representation is trained to ignore, so they strongly affect representation quality.
Frequently asked questions
What is the difference between self-supervised and unsupervised learning?
Both use unlabeled data, but self-supervised learning constructs a specific supervisory signal from the data structure (e.g., masked tokens, augmented views) and trains with a defined loss function. Classic unsupervised learning (clustering, PCA) instead finds structure without any explicit prediction objective. The boundary between the two is blurry, and SSL can be viewed as either supervised or unsupervised learning depending on whether the learning mechanism or the application context is emphasized.
Do I need to pre-train from scratch or can I use an existing checkpoint?
For most applied projects, fine-tuning a publicly available checkpoint (e.g., BERT from Hugging Face, DINO from Meta) is more practical than pre-training from scratch. Pre-training from scratch is mainly worth considering when the domain is highly specialized (e.g., clinical text) and existing checkpoints transfer poorly.
How much unlabeled data is needed?
There is no firm minimum. The answer depends heavily on model size and the complexity of the pretext task. Larger unlabeled corpora are generally preferable for pre-training.
What is a contrastive pretext task?
Contrastive pretext tasks (SimCLR, MoCo) create two differently augmented views of the same sample and train the encoder so the views are similar in representation space while being different from representations of other samples. This teaches the model to be invariant to augmentation while preserving semantic content.
Is self-supervised learning suitable for tabular data?
It can be, although gains are generally smaller than for images or text. Approaches such as SCARF, TabNet pre-training, and masked feature prediction have been used when labeled tabular data is scarce. For tabular datasets with ample labels, supervised ensemble methods are often a simpler and strong baseline, so the benefit of pre-training should be checked on the dataset at hand.
Related methods
Sources
LeCun, Y. & Misra, I. (2022). Self-supervised learning: The dark matter of intelligence. Meta AI Blog. https://ai.facebook.com/blog/self-supervised-learning-the-dark-matter-of-intelligence/
Open publication referenceSelf-supervised learning. Wikipedia.
Open publication reference