Self-supervised learning invents a pretext task whose labels come from the data itself — no human annotation needed. Here the pretext task is rotation prediction: every unlabelled image is rotated by 0°, 90°, 180° or 270°, and the network must predict which rotation was applied. To solve it, the encoder is forced to learn real object structure (edges, orientation, parts) — features that transfer to downstream tasks later.
Each point is an embedding f(x) for one rotated image. Its predicted-class probabilities come from a softmax over negative squared distance to four learned class centroids ck, exactly the geometry of a distance-based (RBF/prototype) classifier:
logit_k = −‖f(x) − c_k‖² / T
p_k = softmax(logit)_k
L = −log p_true (cross-entropy)
Every training step moves each embedding by real gradient descent on that loss:
∂L/∂f = (2/T) · [ (1 − p_true)(f − c_true)
− Σ_{k≠true} p_k (f − c_k) ]
f ← f − η · ∂L/∂f
The true-class term pulls the point toward its own centroid; the wrong-class terms push it away from the other three, weighted by how confidently (and wrongly) the classifier currently favours them — the same push/pull that drives contrastive and prototype-based self-supervised methods. Temperature T controls task difficulty: a high T flattens the softmax so gradients stay weak and clusters stay loose (a harder pretext task); a low T sharpens decisions and clusters converge fast. Learning rate η scales the step size; too high overshoots and destabilises the clusters, just as in real optimisers.
- Train — runs the gradient-descent loop continuously.
- Step — advances exactly one gradient step, useful for watching the geometry move.
- Samples per class — how many embeddings populate each rotation cluster.
- Cluster separation — mean inter-centroid distance versus mean intra-cluster spread; the ratio a real evaluation would report as linear-probe separability.