Self-supervised learning

On this page 7

Self-supervised learning is a machine learning paradigm in which a model learns from unlabeled data by generating its own training signal: part of each input is hidden, transformed or paired, and the model is trained to predict or match the missing part. In artificial intelligence, it is the approach behind large language models, modern vision encoders and speech models, because it turns raw text, images and audio into supervised-style training tasks without human annotation.

Within AI fundamentals, self-supervised learning is usually placed between supervised and unsupervised learning. Its training is technically supervised, with a loss computed against a target, but the targets come from the data itself. The resulting pretrained representations are later adapted to specific tasks with far fewer labeled examples.

How self-supervised learning creates its own labels

Self-supervised learning works through a pretext task, an artificial objective that can be scored automatically. The model never sees a human label; instead, a rule applied to the input defines both the question and the answer. Solving the pretext task well forces the network to capture structure, context and semantics that are useful far beyond the task itself.

The most widespread pretext tasks fall into a few families, summarized in the following table.

Pretext taskWhat the model predictsTypical domain
Next-token predictionThe following token given all previous onesText, code, audio tokens
Masked token modelingRandomly hidden tokens, often about 15 percentText encoders
Masked image modelingPixels or features of masked patches, often 40 to 75 percentVision transformers
Contrastive matchingWhich pairs of views belong togetherImages, image and text pairs
Self-distillationOutput of a slowly updated teacher networkVision encoders without negatives
Common pretext tasks

After pretraining, the learned network serves as a backbone. Its internal representations are reused through fine-tuning, a small task-specific head, or direct prompting in the case of generative language models.

Main families of methods

Self-supervised methods are usually grouped into generative, contrastive and non-contrastive approaches. Generative methods reconstruct the input or predict its continuation. Contrastive methods pull together two augmented views of the same sample and push apart views of different samples. Non-contrastive methods avoid explicit negatives and rely on architectural tricks to prevent the model from collapsing to a constant output.

FamilyCore ideaMain difficulty
Autoregressive generativePredict the next element in sequenceVery high compute at scale
Masked reconstructionFill in hidden parts of the inputChoice of masking ratio and target
ContrastiveMatch positive pairs against negativesNeeds many negatives or large batches
Non-contrastiveAlign views with teacher or variance termsRisk of representation collapse
Method families and their trade-offs

The choice of data augmentation is decisive for contrastive and non-contrastive vision methods. Cropping, color distortion and blurring define what the model learns to ignore; an augmentation that removes information needed downstream, such as color for a flower classifier, can silently degrade transfer performance.

How it differs from neighboring paradigms

Self-supervised learning differs from its neighbors mainly in where the training signal comes from. Supervised learning depends on human-provided labels; unsupervised learning in the classic sense, such as clustering, has no prediction target at all; semi-supervised learning mixes a small labeled set with a large unlabeled one during the same training run.

ParadigmSource of the training signalTypical output
Supervised learningHuman labels for each exampleTask-specific model
Self-supervised learningTargets derived from the data itselfGeneral-purpose representations
Unsupervised learningNo targets, only data structureClusters, densities, projections
Semi-supervised learningFew labels plus unlabeled dataTask model with less labeling
Reinforcement learningRewards from an environmentPolicy for sequential decisions
Learning paradigms compared

In practice these paradigms are stacked rather than exclusive. A typical foundation model is pretrained with self-supervised learning, adapted with supervised fine-tuning, and refined with reinforcement learning from feedback. Transfer learning is the mechanism that carries the self-supervised representation into the later stages.

Practical choices and scaling

Self-supervised pretraining pays off when unlabeled data is abundant and labels are expensive. Its quality depends on three levers: the amount and diversity of training data, model capacity, and compute. For language models, data is commonly measured in hundreds of billions to many trillions of tokens, and performance improves smoothly with scale, although with diminishing returns.

SituationRecommended approachReason
Large unlabeled corpus, few labelsSelf-supervised pretraining, then fine-tuningLabels are spent only on adaptation
Suitable public foundation model existsReuse it and fine-tunePretraining cost is avoided
Highly specialized domain dataContinued pretraining on domain dataCloses the vocabulary and style gap
Small dataset with ample labelsPlain supervised trainingPretraining adds little value
Deciding whether to pretrain

Representations are usually evaluated with a linear probe, which trains only a linear classifier on frozen features, or with fine-tuning on a downstream benchmark. A strong linear-probe result indicates that the pretext task has organized the representation well.

Limitations and misconceptions

Self-supervised learning removes the need for labels but not the need for careful data work. Models absorb whatever regularities exist in the corpus, including biases, errors and duplicated content, and the absence of labels makes these problems harder to notice.

  • It is not free of supervision: the loss is supervised, only the labels are automatic.
  • Pretext success is not task success: a low pretraining loss does not guarantee useful features for a given downstream task.
  • Compute cost is high: pretraining large models requires substantial accelerator time and energy.
  • Data quality dominates: deduplication and filtering often matter more than architectural tweaks.
  • Collapse is a real failure mode in non-contrastive methods when regularization is misconfigured.

Understanding it simply

Self-supervised learning is like learning a language by reading millions of books with random words covered up and guessing what belongs in each gap. Nobody grades the answers by hand; the book itself reveals the correct word. After enough practice, the reader understands grammar, meaning and context surprisingly well.

The same trick works for pictures, where pieces of an image are hidden, and for sound. The result is a general understanding that can then be taught a specific job with only a few labeled examples.

Applied in practice

A hospital imaging department holds about two million unlabeled chest X-rays but only 8,000 images labeled by radiologists for a rare lung condition. Training a classifier directly on the labeled set produces a model that overfits and misses subtle cases.

The team first pretrains a vision transformer on all unlabeled images with masked image modeling, hiding three quarters of each image and asking the model to reconstruct it. They then fine-tune the encoder on the 8,000 labeled scans. The pretrained model reaches clearly higher sensitivity on a held-out validation set than the model trained from scratch, and it needs fewer labeled examples to match earlier results, so radiologist time can go to reviewing difficult cases instead of annotating routine ones.