Skip to content
AI360XpertBeta
Core ML

Visual explainer

Self-Supervised Learning

Extract dense supervision directly from raw, unlabelled data using pretext tasks like masking and contrastive pairs to pretrain foundation backbones for downstream fine-tuning.

The raw example supplies both a training input and its target.
The raw example supplies both a training input and its target.

Self-supervised learning creates prediction targets from the data itself. In our synthetic text example, the original phrase is not good. Withhold good, give the model not ?, and retain the original token as the answer. No person assigns that token a new category label. Data preparation, model training and evaluation still consume resources.

Predict A Missing Token

A masked token is predicted from the remaining context.
A masked token is predicted from the remaining context.

The bars show a deliberately tiny vocabulary: good, bad and okay, with probabilities 0.25, 0.50 and 0.25. Their heights share a scale of 200 drawing units per probability unit. The correct answer is good because it came from the original text; the highest prediction is currently wrong.

The loss for this selected position is −log⁡p(good∣not ?)=−log⁡(0.25)≈1.386-\log p(\text{good}\mid\text{not ?})=-\log(0.25)\approx1.386. The logarithm is natural. BERT uses masked language modelling with selected token positions: 15% are selected, then 80% of those are masked, 10% replaced randomly and 10% kept unchanged. This one-position drawing illustrates the prediction, not those sampling proportions. Low loss does not guarantee factual understanding.

Another Objective: Compare Views

Contrastive supervision compares two views against another example.
Contrastive supervision compares two views against another example.

Contrastive learning is another way to derive supervision. A and B are two views of one example, while square C comes from another. For the illustrated unit vectors A=(1,0)A=(1,0), B=(0.8,0.6)B=(0.8,0.6) and C=(−1,0)C=(-1,0), cosine similarities are 0.8 and -1. The circle is the unit circle, not an empirical cluster plot.

A SimCLR-style objective rewards identifying the partner among other views. It excludes the anchor itself from the denominator. Contrastive training is one self-supervised family; self-supervision does not universally require negatives. Continue with the contrastive sequence for its loss.

Preserve What The Task Needs

Two crops can preserve the same foreground object.
Two crops can preserve the same foreground object.

The triangle is the foreground object; dots represent incidental background. The two schematic crop windows preserve the triangle while changing background coverage. These are symbolic views, not pixel-accurate crops from one rendered photograph. An object-oriented task might benefit from this invariance. A task that needs the background might not. No measured similarity follows from these pictures.

Reuse The Encoder

A pretrained encoder can feed a new labelled head.
A pretrained encoder can feed a new labelled head.

The dashed token head belongs to the pretraining task. The solid polarity head is a new downstream task using human-supplied positive and negative labels. A frozen probe trains only that head; fine-tuning also updates some or all encoder parameters. Both require held-out evaluation against an appropriate baseline. Pretraining alone establishes neither an accuracy gain nor a fixed label saving.

Images Can Be Masked Too

Masked reconstruction also applies to image patches.
Masked reconstruction also applies to image patches.

Here the modality changes explicitly: a 2×2 image-patch grid replaces the text example. The lower-right patch is withheld, and its original triangle supplies the target. The visible patches provide context; the answer is available for computing the loss, not as an encoder input. This simplified grid illustrates the missing-patch task, not a guaranteed inferable triangle. Masked autoencoders reconstruct missing image pixels, so vision self-supervision is not limited to contrastive pairs.

Check For Answer Leakage

Leaking the held-out answer defeats the intended prediction task.
Leaking the held-out answer defeats the intended prediction task.

Return to not good. The dashed amber bypass mistakenly exposes good on the input side. A learner can exploit that answer instead of the intended context. The bypass depicts an information path, not a measured neural circuit or accuracy. Keep the target separate from the encoder's inputs and inspect preprocessing for shortcuts. A falling pretext loss can coexist with a useless representation.

Read The Training Signal

More probability on the withheld answer lowers its loss.
More probability on the withheld answer lowers its loss.

Compare two hypothetical predictions on the same masked input. Good rises from 0.25 to 0.75; all other tokens together fall from 0.75 to 0.25. Both distributions sum to one, with the same bar scale. Loss falls from 1.386 to −log⁡(0.75)≈0.288-\log(0.75)\approx0.288. These are constructed states, not an observed training trajectory. They measure the pretext answer, not downstream polarity classification.

Evaluate A Frozen Probe

A frozen representation can be checked with a labelled probe.
A frozen representation can be checked with a labelled probe.

Assume the frozen encoder produces scalar features -1 for our negative phrase and +1 for a positive phrase. Those positions are synthetic. A linear probe with score s=zs=z and threshold zero separates these two supplied labels; a fresh feature z=0.4z=0.4 would be predicted positive. Actual transfer assessment needs separate probe-training and evaluation data, representative labels and a baseline. A two-point illustration provides no performance estimate.

Where It Breaks

Deleting negation can merge inputs whose task labels differ.
Deleting negation can merge inputs whose task labels differ.

Suppose augmentation deletes the first word from both not good and very good. Each becomes good, although their intended polarity labels differ. Identical transformed inputs cannot reveal which original polarity they had. Enforcing invariance to this deletion can erase information the downstream task needs. Select the pretext transformation around what must be preserved, then test the representation on held-out task data.

The Quick Version

  • Derive targets from original examples while withholding the answer.
  • Predict selected tokens from their remaining context.
  • Contrastive objectives compare related views with competing examples.
  • Augmentations must preserve information relevant to the intended task.
  • A new labelled head can reuse a pretrained encoder.
  • Images also support masked reconstruction.
  • Leaked answers can make the pretext task misleadingly easy.
  • Higher target probability reduces cross-entropy loss.
  • Frozen probes check task information using separate labelled evaluation.
  • Deleting negation can destroy distinctions a downstream task needs.